Originally posted by lynx_abraxas
Yes. Use gdb for determining the point where the segmentation fault appears and then step back the function stack to find the call of the function that has a wrong pointer.
Did any graphic turn up till the segmentation fault? A lot segmentation faults I solved came from a very bad usage (reinterpret_cast) of void pointers that are used for storing integer index values of lists. There are other segmentation faults that originate from pointer mess in the battle view. (I didn't find out the real problem concerning proper drawing of the sprites but I managed to eliminate a segmentation fault)
Good luck searching
Yes. Use gdb for determining the point where the segmentation fault appears and then step back the function stack to find the call of the function that has a wrong pointer.
Did any graphic turn up till the segmentation fault? A lot segmentation faults I solved came from a very bad usage (reinterpret_cast) of void pointers that are used for storing integer index values of lists. There are other segmentation faults that originate from pointer mess in the battle view. (I didn't find out the real problem concerning proper drawing of the sprites but I managed to eliminate a segmentation fault)
Good luck searching
Code:
josh@josh:~/CTP2/ctp2_program/ctp$ gdb GNU gdb 6.6-debian Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". (gdb) run ctp2 Starting program: ctp2 No executable file specified. Use the "file" or "exec-file" command. (gdb) quit josh@josh:~/CTP2/ctp2_program/ctp$ gdb ctp2 GNU gdb 6.6-debian Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /home/josh/CTP2/ctp2_program/ctp/ctp2 [Thread debugging using libthread_db enabled] [New Thread 47331906192720 (LWP 6369)] [New Thread 1082132816 (LWP 6372)] [New Thread 1090525520 (LWP 6374)] No medium found All resolutions available. ui/aui_ctp2/c3blitter.cpp L719: MMX-Test succeded! [New Thread 1098918224 (LWP 6375)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1098918224 (LWP 6375)] 0x000000000050f434 in C3Blitter::Blt16To16FastMMX (this=0x18e4560, destSurf=0x19b4750, destRect=0x41801f70, srcSurf=0x18d7880, srcRect=0x41801f80, flags=17) at ui/aui_ctp2/c3blitter.cpp:402 402 ); (gdb)
Code:
(gdb) continue Continuing. [Thread 1090525520 (LWP 6374) exited] Program received signal SIGSEGV, Segmentation fault. 0x000000000050f434 in C3Blitter::Blt16To16FastMMX (this=0x18e4560, destSurf=0x19b4750, destRect=0x41801f70, srcSurf=0x18d7880, srcRect=0x41801f80, flags=17) at ui/aui_ctp2/c3blitter.cpp:402 402 ); (gdb) continue Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb)
Looking at line 402 of c3blitter.cpp, it appears to be the end of a section of assembly code but I have no idea what to do with it.
Comment