|
From: Paul E. <blu...@bl...> - 2004-03-19 12:20:04
|
Hi there, I've been using valgrind to debug my program, and today I decided to try to fix some of the memory leaks (normally I just use it to root out bad stuff such as free vs. delete, etc.). Anyway when I tried to enable leak checking, upon quitting my application I got a segfault. ---------------- snip ---------------- paul@xp2000 eboxy $ valgrind -v --leak-check=yes ./eboxy ~/eboxy-skin/testminimal.xml ==1044== Memcheck, a memory error detector for x86-linux. ==1044== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward. ==1044== Using valgrind-2.1.0, a program supervision framework for x86-linux. ==1044== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward. ==1044== Command line ==1044== ./eboxy ==1044== /home/paul/eboxy-skin/testminimal.xml ==1044== Startup, with flags: ==1044== --suppressions=/usr/lib/valgrind/default.supp ==1044== -v ==1044== --leak-check=yes ==1044== Reading syms from /home/paul/eboxy-0.3/eboxy/eboxy/eboxy ==1044== Reading syms from /lib/ld-2.3.2.so ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/valgrind/vgskin_memcheck.so ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/valgrind/valgrind.so ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libxml2.so.2.6.6 ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libjpeg.so.62.0.0 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libpng.so.3.1.2.5 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libfreetype.so.6.3.4 ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libz.so.1.1.4 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libSDL_gui-0.10.3.so ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libSDL_ttf-2.0.so.0.6.0 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libSDL-1.2.so.0.0.6 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/valgrind/libpthread.so ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libSDL_image-1.2.so.0.1.2 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libstdc++.so.5.0.5 ==1044== object doesn't have a symbol table ==1044== object doesn't have any debug info ==1044== Reading syms from /lib/libm-2.3.2.so ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcc_s.so.1 ==1044== Reading syms from /lib/libc-2.3.2.so ==1044== object doesn't have any debug info ==1044== Reading syms from /lib/libdl-2.3.2.so ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libasound.so.2.0.0 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/X11R6/lib/libX11.so.6.2 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/X11R6/lib/libXext.so.6.4 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libvga.so.1.9.17 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libaa.so.1.0.4 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/lib/libslang.so.1.4.9 ==1044== object doesn't have any debug info ==1044== Reading suppressions file: /usr/lib/valgrind/default.supp ==1044== Estimated CPU clock rate is 1674 MHz ==1044== REPLACING libc(__GI___errno_location) with libpthread(__errno_location) ==1044== REPLACING libc(__GI___h_errno_location) with libpthread(__h_errno_location) ==1044== REPLACING libc(__GI___res_state) with libpthread(__res_state) ==1044== ==1044== TRANSLATE: 0x405FAFC0 redirected to 0x404C5485 ==1044== Invalid read of size 1 ==1044== at 0x4000FD5A: strcmp (in /lib/ld-2.3.2.so) ==1044== by 0x406E80FA: dl_open_worker (in /lib/libc-2.3.2.so) ==1044== by 0x4000B787: _dl_catch_error_internal (in /lib/ld-2.3.2.so) ==1044== by 0x406E86FB: __GI__dl_open (in /lib/libc-2.3.2.so) ==1044== Address 0xFFFFE210 is not stack'd, malloc'd or free'd ==1044== Reading syms from /usr/X11R6/lib/libXcursor.so.1.0 ==1044== object doesn't have any debug info ==1044== ==1044== Invalid read of size 1 ==1044== at 0x4000FD5A: strcmp (in /lib/ld-2.3.2.so) ==1044== by 0x4000A3B7: openaux (in /lib/ld-2.3.2.so) ==1044== by 0x4000B787: _dl_catch_error_internal (in /lib/ld-2.3.2.so) ==1044== by 0x4000A705: _dl_map_object_deps_internal (in /lib/ld-2.3.2.so) ==1044== Address 0xFFFFE210 is not stack'd, malloc'd or free'd ==1044== Reading syms from /usr/X11R6/lib/libXrender.so.1.2 ==1044== object doesn't have any debug info ==1044== Reading syms from /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2 ==1044== object doesn't have any debug info ==1044== warning: Valgrind's sem_destroy is incomplete ==1044== (it always succeeds, even if semaphore waited on) ==1044== your program may misbehave as a result ==1044== ==1044== Syscall param writev(vector[...]) contains uninitialised or unaddressable byte(s) ==1044== at 0x406B2B3E: do_writev (in /lib/libc-2.3.2.so) ==1044== by 0x4081A3AF: _X11TransSocketWritev (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x4081922E: _X11TransWritev (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x407FB6E0: _XSend (in /usr/X11R6/lib/libX11.so.6.2) ==1044== Address 0x423A4693 is 19 bytes inside a block of size 2048 alloc'd ==1044== at 0x4002B685: calloc (in /usr/lib/valgrind/vgskin_memcheck.so) ==1044== by 0x407EC77A: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x4048C9B2: X11_VideoInit (in /usr/lib/libSDL-1.2.so.0.0.6) ==1044== ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402AC427: xmlValidateOneElement (in /usr/lib/libxml2.so.2.6.6) ==1044== by 0x804BD9F: (within /home/paul/eboxy-0.3/eboxy/eboxy/eboxy) ==1044== ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402A68C3: xmlAddID (in /usr/lib/libxml2.so.2.6.6) ==1044== ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402A6FBC: xmlAddRef (in /usr/lib/libxml2.so.2.6.6) Could not find file '/usr/local/lib/eboxy/filebrowser.so' eboxy: could not connect to socket eboxy: Connection refused Couldn't initialise LIRC (is lircd running?) ==1044== warning: Valgrind's pthread_attr_destroy does nothing ==1044== your program may misbehave as a result ==1044== TRANSLATE: 0x406C8180 redirected to 0x404C559D ==1044== ==1044== ERROR SUMMARY: 111 errors from 6 contexts (suppressed: 36 from 3) ==1044== ==1044== 2 errors in context 1 of 6: ==1044== Syscall param writev(vector[...]) contains uninitialised or unaddressable byte(s) ==1044== at 0x406B2B3E: do_writev (in /lib/libc-2.3.2.so) ==1044== by 0x4081A3AF: _X11TransSocketWritev (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x4081922E: _X11TransWritev (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x407FB6E0: _XSend (in /usr/X11R6/lib/libX11.so.6.2) ==1044== Address 0x423A4693 is 19 bytes inside a block of size 2048 alloc'd ==1044== at 0x4002B685: calloc (in /usr/lib/valgrind/vgskin_memcheck.so) ==1044== by 0x407EC77A: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2) ==1044== by 0x4048C9B2: X11_VideoInit (in /usr/lib/libSDL-1.2.so.0.0.6) ==1044== ==1044== 7 errors in context 2 of 6: ==1044== Invalid read of size 1 ==1044== at 0x4000FD5A: strcmp (in /lib/ld-2.3.2.so) ==1044== by 0x406E80FA: dl_open_worker (in /lib/libc-2.3.2.so) ==1044== by 0x4000B787: _dl_catch_error_internal (in /lib/ld-2.3.2.so) ==1044== by 0x406E86FB: __GI__dl_open (in /lib/libc-2.3.2.so) ==1044== Address 0xFFFFE210 is not stack'd, malloc'd or free'd ==1044== ==1044== 11 errors in context 3 of 6: ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402A6FBC: xmlAddRef (in /usr/lib/libxml2.so.2.6.6) ==1044== ==1044== 12 errors in context 4 of 6: ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402A68C3: xmlAddID (in /usr/lib/libxml2.so.2.6.6) ==1044== ==1044== 26 errors in context 5 of 6: ==1044== Conditional jump or move depends on uninitialised value(s) ==1044== at 0x402AC427: xmlValidateOneElement (in /usr/lib/libxml2.so.2.6.6) ==1044== by 0x804BD9F: (within /home/paul/eboxy-0.3/eboxy/eboxy/eboxy) ==1044== ==1044== 53 errors in context 6 of 6: ==1044== Invalid read of size 1 ==1044== at 0x4000FD5A: strcmp (in /lib/ld-2.3.2.so) ==1044== by 0x4000A3B7: openaux (in /lib/ld-2.3.2.so) ==1044== by 0x4000B787: _dl_catch_error_internal (in /lib/ld-2.3.2.so) ==1044== by 0x4000A705: _dl_map_object_deps_internal (in /lib/ld-2.3.2.so) ==1044== Address 0xFFFFE210 is not stack'd, malloc'd or free'd --1044-- --1044-- supp: 28 libX11.so.6.2/libX11.so.6.2/libX11.so.6.2(Cond) --1044-- supp: 2 *libc_write/libX11.so.6.2/*X11TransWrite(Param) --1044-- supp: 6 dl_relocate/dl_open_worker ==1044== ==1044== IN SUMMARY: 111 errors from 6 contexts (suppressed: 36 from 3) ==1044== ==1044== malloc/free: in use at exit: 135541 bytes in 3414 blocks. ==1044== malloc/free: 7412 allocs, 3998 frees, 5175663 bytes allocated. ==1044== ==1044== searching for pointers to 3414 not-freed blocks. Segmentation fault ---------------- snip ---------------- I tried to use gdb to debug it but unfortunately I really don't know what I'm doing when it comes to using gdb directly (I use it via KDevelop, but that handles everything internally). Also, it doesn't appear that you can run valgrind inside itself anymore either. It's not even really clear whether it's valgrind or my application crashing. I first got this problem with valgrind 2.0.0. As you can see I tried upgrading to 2.1.0, but that doesn't seem to have helped. Leak checking used to work with my application, though I may have upgraded a few libraries since I last tried it. I'm running Gentoo Linux with GCC 3.3.2. Any ideas? Cheers, Paul |
|
From: Paul E. <blu...@bl...> - 2004-03-21 00:53:40
|
OK, I figured out how to use gdb to debug this crash. It looks like valgrind is the one that's crashing, although my application could still be at fault. Note that I re-emerged valgrind 2.1.0 without optimisations before running this. As the output logs were somewhat large I have uploaded them to my website: http://www.bluelightning.org/files/valgrind_crash_gdboutput1.txt http://www.bluelightning.org/files/valgrind_crash_vgoutput1.txt Any help here would be much appreciated, as I'd like to be able to sort out the leaks in my program. Cheers, Paul |
|
From: Tom H. <th...@cy...> - 2004-03-21 08:58:33
|
In message <200...@bl...>
Paul Eggleton <blu...@bl...> wrote:
> OK, I figured out how to use gdb to debug this crash. It looks like valgrind
> is the one that's crashing, although my application could still be at fault.
> Note that I re-emerged valgrind 2.1.0 without optimisations before running
> this.
Try using 2.1.1 as that will stop your program being able to trash
valgrind's data structures and alert you at the point that it tries
to do so, assuming that is what is happening.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|
|
From: Paul E. <blu...@bl...> - 2004-03-21 09:33:17
|
On Sun, 21 Mar 2004 20:58, Tom Hughes wrote: > Try using 2.1.1 as that will stop your program being able to trash > valgrind's data structures and alert you at the point that it tries > to do so, assuming that is what is happening. Well, upgrading to 2.1.1 fixed the problem, however it doesn't appear to be complaining about any of its data structures being overwritten. Perhaps there was a bug in 2.1.0? Cheers, Paul |
|
From: Tom H. <th...@cy...> - 2004-03-21 12:09:30
|
In message <200...@bl...>
Paul Eggleton <blu...@bl...> wrote:
> On Sun, 21 Mar 2004 20:58, Tom Hughes wrote:
> > Try using 2.1.1 as that will stop your program being able to trash
> > valgrind's data structures and alert you at the point that it tries
> > to do so, assuming that is what is happening.
>
> Well, upgrading to 2.1.1 fixed the problem, however it doesn't appear to
> be complaining about any of its data structures being overwritten. Perhaps
> there was a bug in 2.1.0?
It's pssible although I'm not aware of anything of that nature that
was fixed. In fact I can't ever remember a genuine case of valgrind's
shadow memory structures getting trashed like that.
Of course the rearrangment of the address space in 2.1.1 may just mean
that whatever out of bounds memory access your program may have been
doing is no longer going near valgrind ;-)
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|