Valgrind running on PowerPc but does not report any leaks?

Discussion in 'Mac Programming' started by maddybit, Jul 11, 2012.

  1. macrumors newbie

    Joined:
    Jul 11, 2012
    #1
    HI

    I Downloaded the latest version, Valgrind 3.7.0, untarred it to create a folder "Valgrind-3.7.0" Now, what I did was export gcc for compatibility with the target machine and configured to disable tls and give the host. Also I made a C Program "leak.c" and its object file "a.out" compiled with the following command

    export CC=/usr/local/netd_tools_v1/powerpc/bin/powerpc-linux-gnu-gcc leak.c

    so

    a. export CC=/usr/local/netd_tools_v1/powerpc/bin/powerpc-linux-gnu-gcc
    b. ./configure --prefix=/netd --host=powerpc-linux --disable-tls
    c. make
    d. make install

    Link the library path and valgrind executable (go to /netd/lib and do ln –s /u/netd/lib/valgrind THEN goto /netd/usr/sbin and do ln –s /u/netd/bin/valgrind) Some files were made in "Valgrind-3.7.0" and a folder "netd" was formed. "netd" contained "lib", "bin", "share" and "include"

    (/netd/lib and /netd/usr/sbin are project specific directories)

    Copied these files (files in "netd") into the Target Machine and ran Valgrind on the file "a.out" by the following command :

    valgrind --log-file=/u/july5.txt --leak-check=summary --tool=memcheck ./a.out

    (/u is the mount point, july5 is the log file)

    The output shows 0 leaks reported

    int main()
    {
    printf("I am leaking.");
    int *a =(int *) malloc(100);
    return 0;
    }

    This ran on linux just fine and reported memory leaks. If this would have worked, then I would have run Valgrind on project specific processes.

    Output of Log File on LINUX for a.out:

    [asaini@OTN05 abhaysaini]$ vi xyz.txt

    ==14843== Memcheck, a memory error detector

    ==14843== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
    ==14843== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
    ==14843== Command: ./a.out
    ==14843== Parent PID: 51

    61
    ==14843==
    ==14843==
    ==14843== HEAP SUMMARY:
    ==14843== in use at exit: 100 bytes in 1 blocks
    ==14843== total heap usage: 1 allocs, 0 frees, 100 bytes allocated
    ==14843==
    ==14843== LEAK SUMMARY:
    ==14843== definitely lost: 100 bytes in 1 blocks
    ==14843== indirectly lost: 0 bytes in 0 blocks
    ==14843== possibly lost: 0 bytes in 0 blocks
    ==14843== still reachable: 0 bytes in 0 blocks
    ==14843== suppressed: 0 bytes in 0 blocks
    ==14843== Rerun with --leak-check=full to see details of leaked memory
    ==14843==
    ==14843== For counts of detected and suppressed errors, rerun with: -v
    ==14843== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 6)

    OUTPUT of Log File on PowerPc

    [00002003-Unknown] Debug> cat leak.txt
    ==1208== Memcheck, a memory error detector
    ==1208== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
    ==1208== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
    ==1208== Command: ./a.out
    ==1208== Parent PID: 1195
    ==1208==
    --1208-- WARNING: Serious error when reading debug info
    --1208-- When reading debug info from /lib/ld-2.3.2.so:
    --1208-- Can't make sense of .data section mapping
    --1208-- WARNING: Serious error when reading debug info
    --1208-- When reading debug info from /u/Leak/a.out:
    --1208-- Can't make sense of .data section mapping
    --1208-- WARNING: Serious error when reading debug info
    --1208-- When reading debug info from /u/netd/lib/valgrind/vgpreload_core-ppc32-linux.so:
    --1208-- Can't make sense of .eh_frame section mapping
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x4011E08: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4016517: ???
    ==1208== by 0x400917F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4005083: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4006967: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4002C0F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400DF03: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4001BD3: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400215F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400EF2B: ??? (in /lib/ld-2.3.2.so)
    ==1208==
    --1208-- WARNING: Serious error when reading debug info
    --1208-- When reading debug info from /u/netd/lib/valgrind/vgpreload_memcheck-ppc32-linux.so:
    --1208-- Can't make sense of .eh_frame section mapping
    --1208-- WARNING: Serious error when reading debug info
    --1208-- When reading debug info from /lib/libc-2.3.2.so:
    --1208-- Can't make sense of .data section mapping
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x4011CC0: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x7: ???
    ==1208== by 0x400AB33: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4002ECB: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400DF03: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4001BD3: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400215F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400EF2B: ??? (in /lib/ld-2.3.2.so)
    ==1208==
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x4011D38: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x7: ???
    ==1208== by 0x400AB33: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4002ECB: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400DF03: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4001BD3: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400215F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400EF2B: ??? (in /lib/ld-2.3.2.so)
    ==1208==
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x4011D64: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x7: ???
    ==1208== by 0x400AB33: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4002ECB: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400DF03: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x4001BD3: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400215F: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0x400EF2B: ??? (in /lib/ld-2.3.2.so)
    ==1208==
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x400B958: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0xFE8ABE7: ??? (in /lib/libc-2.3.2.so)
    ==1208== by 0xFE7278B: ??? (in /lib/libc-2.3.2.so)
    ==1208==

    ... snip ...

    ==1208==
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x400BBE0: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0xFE8ABE7: ??? (in /lib/libc-2.3.2.so)
    ==1208== by 0xFE7278B: ??? (in /lib/libc-2.3.2.so)
    ==1208==
    ==1208== Use of uninitialised value of size 4
    ==1208== at 0x400BB0C: ??? (in /lib/ld-2.3.2.so)
    ==1208== by 0xFE8ABE7: ??? (in /lib/libc-2.3.2.so)
    ==1208== by 0xFE7278B: ??? (in /lib/libc-2.3.2.so)
    ==1208==
    ==1208==
    ==1208== HEAP SUMMARY:
    ==1208== in use at exit: 0 bytes in 0 blocks
    ==1208== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==1208==
    ==1208== All heap blocks were freed -- no leaks are possible
    ==1208==
    ==1208== For counts of detected and suppressed errors, rerun with: -v
    ==1208== Use --track-origins=yes to see where uninitialised values come from
    ==1208== ERROR SUMMARY: 40 errors from 20 contexts (suppressed: 3908 from 442)

    I executed the same file (a.out) on linux and powerpc but i got leak report when i ran it on linux.
    The command I used to compile the file on linux is written below :
    gcc leak.c (Compiled)
    valgrind --log-file=/home/abhaysaini/xyz.txt ./a.out (executed)
    Output of xyz.txt for linux, Steps of compilation and execution for PowerPc are already shown above. Kindly let me know why Valgrind is showing 0 memory leaks instead of 1 memory leak of 100 bytes for PowerPc?:mad:
     

Share This Page