[SDL] Need help tracking down a SegFault
Erik
esigra at gmail.com
Sun Feb 24 09:26:31 PST 2008
Michael Sullivan skrev:
> michael at camille ourrpg $ valgrind ./main
> ==14210== Memcheck, a memory error detector.
> ==14210== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==14210== Using LibVEX rev 1732, a library for dynamic binary
> translation.
> ==14210== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
> ==14210== Using valgrind-3.2.3, a dynamic binary instrumentation
> framework.
> ==14210== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==14210== For more details, rerun with: -v
> ==14210==
> ==14210== Syscall param write(buf) points to uninitialised byte(s)
> ==14210== at 0x40DD69E: write (in /lib/libpthread-0.10.so)
> ==14210== by 0x458DE7D: (within /usr/lib/libX11.so.6.2.0)
> ==14210== Address 0x465897B is 19 bytes inside a block of size 16,384
> alloc'd
> ==14210== at 0x4021ABE: calloc
> (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
> ==14210== by 0x45731B3: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
> ==14210==
> ==14210== Conditional jump or move depends on uninitialised value(s)
> ==14210== at 0x80498A0: Battle::initialize()
> (in /home/michael/ourrpg/main)
> ==14210== by 0x804AEE0: main (in /home/michael/ourrpg/main)
> Line is 65; i = 0
> ==14210==
> ==14210== Use of uninitialised value of size 4
> ==14210== at 0x80498D6: Battle::initialize()
> (in /home/michael/ourrpg/main)
> ==14210== by 0x804AEE0: main (in /home/michael/ourrpg/main)
> ==14210==
> ==14210== Invalid read of size 4
> ==14210== at 0x407F752: SDL_MapRGB (in /usr/lib/libSDL-1.2.so.0.11.0)
> ==14210== by 0x80498F8: Battle::initialize()
> (in /home/michael/ourrpg/main)
> ==14210== by 0x804AEE0: main (in /home/michael/ourrpg/main)
> ==14210== Address 0x0 is not stack'd, malloc'd or (recently) free'd
> ==14210==
> ==14210== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 37 from
> 1)
> ==14210== malloc/free: in use at exit: 75,377 bytes in 476 blocks.
> ==14210== malloc/free: 4,930 allocs, 4,454 frees, 1,735,303 bytes
> allocated.
> ==14210== For counts of detected errors, rerun with: -v
> ==14210== searching for pointers to 476 not-freed blocks.
> ==14210== checked 898,684 bytes.
> ==14210==
> ==14210== LEAK SUMMARY:
> ==14210== definitely lost: 10 bytes in 2 blocks.
> ==14210== possibly lost: 187 bytes in 8 blocks.
> ==14210== still reachable: 75,180 bytes in 466 blocks.
> ==14210== suppressed: 0 bytes in 0 blocks.
> ==14210== Rerun with --leak-check=full to see details of leaked memory.
> Segmentation fault
>
> I don't completely understand how to interpret valgrind's or gdb's
> output, so if there is something useful there, please tell me...
You should build the program with debug symbols so that GDB and Valgrind
shows filename:linenumber information.
More information about the SDL
mailing list