|
From: linux u. <lin...@gm...> - 2009-02-15 08:03:56
|
I'd like to add that I am using Valgrind on PPC32.
---------- Forwarded message ----------
From: linux user <lin...@gm...>
Date: Sun, Feb 15, 2009 at 12:56 AM
Subject: Valgrind 3.4 doesn't report errors
To: val...@li...
Hi All,
I've cross compiled Valgrind 3.4 and 3.2.3 for PPC on a Linux/x86
machine.I'm using Valgrind on QEMU(PPC emulator).
Valgrind 3.4 doesn't seem to report errors properly when used with a test
program,while Valgrind 3.2.3 reports errors when run on the same test
program.Am I missing something?I'd appreciate any pointers.
Sample program:
---------------------------------------
#include <stdlib.h>
void foo(void)
{
int* x = malloc(10 * sizeof(int));
x[10] = 0; // problem 1: heap block overrun
} // problem 2: memory leak -- x not freed
int main(void)
{
printf("vg: Calling foo...\n");
foo();
printf("vg: Done.\n");
return 0;
}
-------------------------------
When I use Valgrind 3.4 on the above test program,I get the following output:
$/bin/valgrind --leak-check=full --show-reachable=yes ./ppc-test
invalid/unsupported opcode: 04 - 02 - 12 (10000484) 380302e0 1
<-------What does this signify?
invalid/unsupported opcode: 3f - 16 - 00 (fc00002c) 380303b4 1
<-------
==839==
==839== Conditional jump or move depends on uninitialised value(s)
==839== at 0x4002690: (within /lib/ld-2.3.4.so)
==839== by 0x4010433: (within /lib/ld-2.3.4.so)
==839==
==839== Conditional jump or move depends on uninitialised value(s)
==839== at 0x40026C0: (within /lib/ld-2.3.4.so)
==839== by 0x4010433: (within /lib/ld-2.3.4.so)
==839==
==839== Conditional jump or move depends on uninitialised value(s)
==839== at 0x40022F8: (within /lib/ld-2.3.4.so)
==839== by 0x4002763: (within /lib/ld-2.3.4.so)
==839== by 0x4010433: (within /lib/ld-2.3.4.so)
vg: Calling foo...
vg: Done.
==839==
==839== ERROR SUMMARY: 5 errors from 3 contexts (suppressed: 2 from 1)
<----- Doesn't report memory leaks
==839== malloc/free: in use at exit: 0 bytes in 0 blocks.
==839== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==839== For counts of detected errors, rerun with: -v
==839== Use --track-origins=yes to see where uninitialised values come from
==839== All heap blocks were freed -- no leaks are possible.
------------------------------------------------------------------
Valgrind 3.2.3 reports errors when run on the same test program.
/bin/valgrind --leak-check=full --show-reachable=yes ./ppc-test
==838== Memcheck, a memory error detector.
==838== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==838== Using LibVEX rev 1732, a library for dynamic binary translation.
==838== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==838== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==838== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==838== For more details, rerun with: -v
==838==
vg: Calling foo...
==838== Invalid write of size 4
<-------Valgrind 3.2.3 reports heap block overrun
==838== at 0x10000580: ???
==838== by 0x100005C0: ???
==838== by 0xFE4BF1C: (below main) (libc-start.c:209)
==838== Address 0x402A054 is 4 bytes after a block of size 40 alloc'd
==838== at 0xFFBABC0: malloc (vg_replace_malloc.c:149)
==838== by 0x10000568: ???
==838== by 0x100005C0: ???
==838== by 0xFE4BF1C: (below main) (libc-start.c:209)
vg: Done.
==838== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 7 from 3)
==838== malloc/free: in use at exit: 40 bytes in 1 blocks.
==838== malloc/free: 1 allocs, 0 frees, 40 bytes allocated.
==838== For counts of detected errors, rerun with: -v
==838== searching for pointers to 1 not-freed blocks.
==838== checked 156,828 bytes.
==838==
==838==
==838== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
<------
==838== at 0xFFBABC0: malloc (vg_replace_malloc.c:149)
==838== by 0x10000568: ???
==838== by 0x100005C0: ???
==838== by 0xFE4BF1C: (below main) (libc-start.c:209)
==838==
==838== LEAK SUMMARY:
==838== definitely lost: 40 bytes in 1 blocks.
==838== possibly lost: 0 bytes in 0 blocks.
==838== still reachable: 0 bytes in 0 blocks.
==838== suppressed: 0 bytes in 0 blocks.
-------------------------------------------------
|