What does this mean in gdb?
Program 开发者_如何学编程received signal SIGSEGV, Segmentation fault. 0x08049795 in execute_jobs () Current language: auto; currently asm
(gdb) info symbol 0x08049795 execute_jobs + 22 in section .text
(gdb) ptype 0x08049795 type = int
How to get the line number at which the error occurred?
Your binary was not compiled with debugging information. Rebuild with at least -g
(or -ggdb
, or -ggdb -g3
, see GCC manual.)
The exact lines from GDB output:
(gdb) info symbol 0x08049795 execute_jobs + 22 in section .text
means that instruction at address 0x08049795
, which is 22 bytes from beginning of function execute_jobs
, generated the segmentation fault.
(gdb) ptype 0x08049795 type = int
Here you are asking for type of an integer, and GDB happily replies. Do
(gdb) x/10i 0x08049795
or
(gdb) disassemble execute_jobs
to see actual instructions.
The gdb command "bt" will show you a back trace. Unless you've corrupted the stack this should show the sequence of function calls that lead to the segfault. To get more meaningful information make sure that you've compiled your program with debug information by including -g on the gcc/g++ command line.
精彩评论