--- Comment #3 from loizeaux1 at hotmail dot com 2006-01-19 17:30 ---
Here's the results I got after following the directions on the website you gave
me (I realize this may be moot since you pointed out that it is a false
positive, but I'll just do this for completeness' sake):
> cat test.cpp
#include
#include
extern "C" void __libc_freeres(void);
void do_something()
{
std::cerr << "This is a message" << std::endl;
}
int main ( int argc, char* argv[] )
{
atexit( __libc_freeres );
do_something();
return 0;
}
> g++ -g -O0 -o test test.cpp -lpthread
[Author's note: The webpage you forwarded gave an example of how to use
valgrind. You left off the --tool option, which may not have been required
with version 1.0.4, but is with 2.2.0 (I have never used valgrind before, and
so I don't know when it may have changed). I assume you wanted me to use the
"memcheck" tool option. You might want to have someone look at that page if
you are going to give it to newbies to reference.]
> valgrind -v --tool=memcheck --num-callers=20 --leak-check=yes
> --leak-resolution=high --show-reachable=yes test
==22877== Memcheck, a memory error detector for x86-linux.
==22877== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==22877== Using valgrind-2.2.0, a program supervision framework for x86-linux.
==22877== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==22877== Valgrind library directory: /usr/lib/valgrind
==22877== Command line
==22877==test
==22877== Startup, with flags:
==22877==-v
==22877==--tool=memcheck
==22877==--num-callers=yes
==22877==--leak-check=yes
==22877==--leak-resolution=high
==22877==--show-reachable=yes
==22877== Contents of /proc/version:
==22877== Linux version 2.6.9-11.ELsmp ([EMAIL PROTECTED])
(gcc version 3.4.3 20050227 (Red Hat 3.4.3-22)) #1 SMP Fri May 20 18:26:27 EDT
2005
==22877== Reading syms from /home/john/testcase/test (0x8048000)
==22877== Reading syms from /lib/ld-2.3.4.so (0x1B8E4000)
==22877==object doesn't have any debug info
==22877== Reading syms from /usr/lib/valgrind/stage2 (0XB000)
==22877== Reading syms from /lib/ld-2.3.4.so (0xB100)
==22877==object doesn't have any debug info
==22877== Reading syms from /usr/lib/valgrind/vgskin_memcheck.so (0xB7CA9000)
==22877== Reading syms from /lib/tls/libc-2.3.4.so (0xB7ED2000)
==22877==object doesn't have any debug info
==22877== Reading syms from /lib/libdl-2.3.4.so (0xB7FFB000)
==22877==object doesn't have any debug info
==22877== Reading suppressions file: /usr/lib/valgrind/default.supp
==22877== REDIRECT soname:libc.so.6(__GI___ernno_location) to
soname:libpthread.so.0(__errno_location)
==22877== REDIRECT soname:libc.so.6(__errno_location) to
soname:libpthread.so.0(__ernno_location)
==22877== REDIRECT soname:libc.so.6(__GI___h_errno_location) to
soname:libpthread.so.0(__h_errno_location)
==22877== REDIRECT soname:libc.so.6(__h_errno_location) to
soname:libpthread.so.0(__h_errno_location)
==22877== REDIRECT soname:libc.so.6(__GI___res_state) to
soname:libpthread.so.0(__res_state)
==22877== REDIRECT soname:libc.so.6(__res_state) to
soname:libpthread.so.0(__res_state)
==22877== REDIRECT soname:libc.so.6(stpcpy) to *vgpreload_memcheck.so*(stpcpy)
==22877== REDIRECT soname:libc.so.6(strnlen) to
*vgpreload_memcheck.so*(strnlen)
==22877== REDIRECT soname:ld-linux.so.2(stpcpy) to
*vgpreload_memcheck.so*(stpcpy)
==22877== REDIRECT soname:ld-linux.so.2(strchr) to
*vgpreload_memcheck.so*(strchr)
==22877==
==22877== Reading sysm from /usr/lib/valgrind/vg_inject.so (0x1B8FE000)
==22877== Reading syms from /usr/lib/valgrind/vgpreload_memcheck.so
(0x1B901000)
==22877== TRANSLATE: 0x1B8F5EE0 redirected to 0x1B904100
==22877== Reading syms from /usr/lib/valgrind/libpthread.so (0x1B908000)
==22877== Reading syms from /usr/lib/libstdc++.so.6.0.3 (0x26E000)
==22877==object doesn't have a symbol table
==22877==object doesn't have any debug info
==22877== Reading syms from /lib/tls/libm-2.3.4.so (0xC7D000)
==22877==object doesn't have any debug info
==22877== Reading syms from /lib/libgcc_s-3.4.3-20050228.so.1 (0x244000)
==22877==object doesn't have a symbol table
==22877==object doesn't have any debug info
==22877== Reading syms from /lib/tls/libc-2.3.4.so (0xB52000)
==22877==object doesn't have any debug info
==22877== Reading syms from /lib/libdl-2.3.4.so (0xCA2000)
==22877==object doesn't have any debug info
==22877== TRANSLATE: 0x1B8E47A0 redirected to 0x52BFF040
This is a message==22877== TRANSLATE: 0xBB5E80 redirected to 0x1B9048F8
==22877== TRANSLATE: 0xBB3DB0 redirected to 0x1B904E24
==22877==
==22877== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)
--22877--
--22877-- supp: 18 dl_relocate_object/dl_main
==22877== malloc/free: in use at exit: