GNU gdb how to show source file name and character string

when using GNU gdb to debug a process c.

Command

list will print the lines but will not tell me the file name.

set breakpoints can display all the line and file information that I want, but I do not want to set a breakpoint and disable or delete it.

(gdb) b oyss_funtion Breakpoint 13 at 0x8049130: file main.c, line 119. 

Is there a gdb command or settings to show me information about the line string of a function (character) without setting a breakpoint there?

+6
source share
1 answer

Use the info line command.

 info line oyss_function 

For example, suppose the test.c file contains:

 #include <stdio.h> int main(void) { printf("\n"); return 0; } 

Then, calling info line main in GDB, we get:

 (gdb) info line main Line 4 of "test.c" starts at address 0x400498 <main> and ends at 0x40049c <main+4>. 
+7
source

All Articles