简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM