|
From: linux u. <lin...@gm...> - 2009-02-15 05:56:53
|
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.
-------------------------------------------------
|
|
From: Julian S. <js...@ac...> - 2009-02-15 06:22:16
|
> 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). Is this the user mode simulator or the full system simulator? > 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? Hmm. That's strange. Can you send me (in private email) the executable, ./ppc-test? > $/bin/valgrind --leak-check=full --show-reachable=yes ./ppc-test > invalid/unsupported opcode: 04 - 02 - 12 (10000484) 380302e0 1 > <-------What does this signify? This message is from QEMU and is expected. Valgrind tries to determine the capabilities of the underlying CPU, by testing certain instructions and seeing if it gets a SIGILL or not. J |
|
From: linux u. <lin...@gm...> - 2009-02-15 06:42:04
|
---------- Forwarded message ---------- From: linux user <lin...@gm...> Date: Sun, Feb 15, 2009 at 1:39 AM Subject: Fwd: [Valgrind-users] Valgrind 3.4 doesn't report errors To: val...@li... ---------- Forwarded message ---------- From: linux user <lin...@gm...> Date: Sun, Feb 15, 2009 at 1:37 AM Subject: Re: [Valgrind-users] Valgrind 3.4 doesn't report errors To: Julian Seward <js...@ac...> Julian, 1)This is a full system simulator.(PPC 32) 2)I've alsosent you the binary ppc-test in a private mail. |
|
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.
-------------------------------------------------
|
|
From: linux u. <lin...@gm...> - 2009-02-15 22:42:55
|
I'd like to add that while cross compiling Valgrind 3.4,I ran into the
following error:
Our codebase is based on Linux 2.6.Valgrind is supposed to get built as part
of the Linux utility and kernel build.
mpicc -g -O -fno-omit-frame-pointer -Wall -fpic -shared -m32 \
-I../include \
-o libmpiwrap-PPC32_LINUX.so libmpiwrap.c
gcc: libmpiwrap.c: No such file or directory *<-----------------*
make-3.81[4]: *** [libmpiwrap-PPC32_LINUX.so] Error 1
make-3.81[4]: Leaving directory
`/build/valgrind/contrib/valgrind/obj-ppc/auxprogs'
make-3.81[5]: Nothing to be done for `all-am'.
make-3.81[5]: Leaving directory
`/build/valgrind/contrib/valgrind/obj-ppc/docs'
make-3.81[4]: Leaving directory
`/build/valgrind/contrib/valgrind/obj-ppc/docs'
make-3.81[3]: *** [all-recursive] Error 1
make-3.81[3]: Leaving directory `/build/valgrind/contrib/valgrind/obj-ppc'
make-3.81[2]: *** [all] Error 2
make-3.81[2]: Leaving directory `/build/valgrind/contrib/valgrind/obj-ppc'
make-3.81[1]: Leaving directory `/build/valgrind'
make-3.81: *** [all] Error 2
Also,the object directory used for Valgrind is obj-ppc.
$ls obj-ppc/auxprogs
Makefile valgrind-listener valgrind_listener-valgrind-listener.o
In order to get rid of this error,I made the following change to
obj-ppc/auxprogs/Makefile
(Even if making a change is allowed,I think the right thing would be do to
change
valgrind/auxprogs/Makefile.am,since both valgrind/auxprogs/Makefile.in and
obj-ppc/auxprogs/Makefile are generated from valgrind/auxprogs/Makefile.am)
-------------------------------------
# The kludge that passes for vex's build system can't handle parallel
# builds. So, for the time being, serialise all Valgrind building.
# (this is equivalent to enforcing "make -j 1".
.NOTPARALLEL:
libmpiwrap-PPC32_LINUX.so: libmpiwrap.c
*-$(MPI_CC) $(HACKY_FLAGS_PRI) \*
-I../include \
-o libmpiwrap-PPC32_LINUX.so libmpiwrap.c
----------------------------------------------------
I added a leading '-' to $(MPI_CC) so that the compilation proceeds even if
the command fails.
With this change,the build succeeded.
Is libmpiwrap-PPC32_LINUX.so needed for Valgrind to function properly?Is it
okay to make the change I've made and ignore the error?
Thanks.
|
|
From: Julian S. <js...@ac...> - 2009-02-20 17:19:25
|
> 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.
Some questions:
* what does
readelf -a /lib/libc-2.3.4.so | grep soname
produce?
* what Linux distro and version is this with?
J
|