John Reiser
17:27 (18 godzin temu)

> ==19124== at 0x40054EC: ??? (in /lib/ld-uClibc-0.9.33.2.so <
http://ld-uClib...
Kacper Kowalski <kacper.s.kowal...@gmail.com>
11:57 (1 minutÄ™ temu)


do John
Hi!

By default valgrind is not selectable in menuconfig for IMX6 platform when
cross compiling for Openwrt, but this platform is based on ARM Cortex A9
core which is implementing ARMv7 architecture. This architecture is
supported by valgrind, so I made little changes in Makefile of valgrind
package to make the package selectable from menuconfig and compilable.
I'm using GCC-5.3 and uClibc-0.9.33.2 (can't proceed to musl for now
because it is very expensive).
The problem is that valgrind is not working properly even for /bin/true:

> valgrind --leak-check=yes /bin/true

Output:
==19124== Memcheck, a memory error detector
==19124== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==19124== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==19124== Command: /bin/true
==19124==
==19124== Invalid read of size 4
==19124==    at 0x40054EC: ??? (in /lib/ld-uClibc-0.9.33.2.so)
==19124==  Address 0x7df01864 is on thread 1's stack
==19124==  20 bytes below stack pointer
==19124==
==19124== Invalid read of size 4
==19124==    at 0x48B8CD4: ??? (in /lib/libuClibc-0.9.33.2.so)
==19124==  Address 0x7df01a5c is on thread 1's stack
==19124==  20 bytes below stack pointer
==19124==
==19124== Invalid read of size 4
==19124==    at 0x48B8AC0: ??? (in /lib/libuClibc-0.9.33.2.so)
==19124==  Address 0x7df01a04 is on thread 1's stack
==19124==  20 bytes below stack pointer
==19124==
==19124== Invalid read of size 4
==19124==    at 0x4000E54: ??? (in /lib/ld-uClibc-0.9.33.2.so)
==19124==  Address 0x7df019f4 is on thread 1's stack
==19124==  20 bytes below stack pointer
==19124==
==19124==
==19124== HEAP SUMMARY:
==19124==     in use at exit: 0 bytes in 0 blocks
==19124==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==19124==
==19124== All heap blocks were freed -- no leaks are possible
==19124==
==19124== For counts of detected and suppressed errors, rerun with: -v
==19124== ERROR SUMMARY: 64 errors from 4 contexts (suppressed: 0 from 0)

I found that "-D__UCLIBC__" flag should be applied when compiling valgrind,
but that didn't help, the output is the same.
Thank you for the answer.
I thought that the complaint is incorrect because it's complaining on a
simple program. Now I know that the complaint could be correct.

I couldn't run /bin/true in way you recommended, because no debug
information was provided, so I compiled simplest program with debug switch:

    #include <iostream>
    int main()
    {
        return 0;
    }

Started gdbserver and connected to it using command:
    (gdb) target remote | /usr/lib/valgrind/../../bin/vgdb --pid=2418

The output from gdb till first error:
    Remote debugging using | /usr/lib/valgrind/../../bin/vgdb --pid=2418
    relaying data between gdb and process 2418
    Reading symbols from /lib/ld-uClibc.so.0...(no debugging symbols
found)...done.
    Loaded symbols for /lib/ld-uClibc.so.0
    warning: Unable to find dynamic linker breakpoint function.
    GDB will be unable to debug shared library initializers
    and track explicitly loaded dynamic code.
    Cannot access memory at address 0x0
    0x04000e68 in ?? ()
    (gdb) c
    Continuing.

    Program received signal SIGTRAP, Trace/breakpoint trap.
    0x040054ec in ?? ()

    (gdb) info reg
    r0             0x4007148    67137864
    r1             0x0    0
    r2             0x49ba000    77307904
    r3             0x49bd90c    77322508
    r4             0x4015f78    67198840
    r5             0x4006054    67133524
    r6             0xa    10
    r7             0x4006ac0    67136192
    r8             0x24    36
    r9             0x401602c    67199020
    r10            0x7d87aa48    2106042952 <%28210%29%20604-2952>
    r11            0x7d87a674    2106041972 <%28210%29%20604-1972>
    r12            0x7d87a678    2106041976 <%28210%29%20604-1976>
    sp             0x7d87a678    0x7d87a678
    lr             0x40054ec    67130604
    pc             0x40054ec    0x40054ec
    cpsr           0x20000010    536870928

Corresponding output from gdbserver:
==2418== Invalid read of size 4
==2418==    at 0x40054EC: ??? (in /lib/ld-uClibc-0.9.33.2.so)
==2418==  Address 0x7d87a664 is on thread 1's stack
==2418==  20 bytes below stack pointer
==2418==
==2418== (action on error) vgdb me ...

Next error:
    (gdb) info reg
    r0             0x7d87ad21    2106043681 <%28210%29%20604-3681>
    r1             0x4a2b000    77770752
    r2             0x10680    67200
    r3             0x4a2f494    77788308
    r4             0x7d87ad03    2106043651 <%28210%29%20604-3651>
    r5             0x104d8    66776
    r6             0x7d87aa60    2106042976 <%28210%29%20604-2976>
    r7             0x8    8
    r8             0x0    0
    r9             0x0    0
    r10            0x4015f78    67198840
    r11            0x7d87aa4c    2106042956 <%28210%29%20604-2956>
    r12            0x7d87aa50    2106042960 <%28210%29%20604-2960>
    sp             0x7d87aa50    0x7d87aa50
    lr             0x4a15cd4    77683924
    pc             0x4a15cd4    0x4a15cd4
    cpsr           0x20000010    536870928

And corresponding gdbserver output:
==2418== Invalid read of size 4
==2418==    at 0x4A15CD4: ??? (in /lib/libuClibc-0.9.33.2.so)
==2418==  Address 0x7d87aa3c is on thread 1's stack
==2418==  20 bytes below stack pointer

Next error:
    (gdb) info reg
    r0             0x207d8    133080
    r1             0x1    1
    r2             0x0    0
    r3             0x10680    67200
    r4             0x4a2b000    77770752
    r5             0x0    0
    r6             0x7d87aa60    2106042976 <%28210%29%20604-2976>
    r7             0x4a2b400    77771776
    r8             0x0    0
    r9             0x0    0
    r10            0x4015f78    67198840
    r11            0x7d87aa2c    2106042924 <%28210%29%20604-2924>
    r12            0x7d87aa30    2106042928 <%28210%29%20604-2928>
    sp             0x7d87aa30    0x7d87aa30
    lr             0x4a15ac0    77683392
    pc             0x4a15ac0    0x4a15ac0
    cpsr           0x20000010    536870928

Gdbserver:
==2418== Invalid read of size 4
==2418==    at 0x4A15AC0: ??? (in /lib/libuClibc-0.9.33.2.so)
==2418==  Address 0x7d87aa1c is on thread 1's stack
==2418==  20 bytes below stack pointer

And the last one:
    (gdb) info reg
    r0             0x482778c    75659148
    r1             0x1    1
    r2             0x4817000    75591680
    r3             0x4817678    75593336
    r4             0x4006178    67133816
    r5             0x0    0
    r6             0x4016034    67199028
    r7             0x401602c    67199020
    r8             0x0    0
    r9             0x0    0
    r10            0x4015f78    67198840
    r11            0x7d87aa1c    2106042908 <%28210%29%20604-2908>
    r12            0x7d87aa20    2106042912 <%28210%29%20604-2912>
    sp             0x7d87aa20    0x7d87aa20
    lr             0x4000e54    67112532
    pc             0x4000e54    0x4000e54
    cpsr           0x20000010    536870928

Gdbserver:
==2418== Invalid read of size 4
==2418==    at 0x4000E54: ??? (in /lib/ld-uClibc-0.9.33.2.so)
==2418==  Address 0x7d87aa0c is on thread 1's stack
==2418==  20 bytes below stack pointer

Summary:
==2418== HEAP SUMMARY:
==2418==     in use at exit: 0 bytes in 0 blocks
==2418==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2418==
==2418== All heap blocks were freed -- no leaks are possible
==2418==
==2418== For counts of detected and suppressed errors, rerun with: -v
==2418== ERROR SUMMARY: 128 errors from 4 contexts (suppressed: 0 from 0)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to