本文介绍了GNU gdb如何显示源文件名和符号行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用GNU gdb调试c进程时.
when use GNU gdb to debug a c process.
list命令将打印行,但不会告诉我文件名.
list command will print the lines but not telling me the file name.
设置断点可以显示我想要的所有行和文件信息,但是我不想设置断点,而必须禁用或删除它.
set breakpoints can display all the line and file info I want but I don't want to set a breakpoint and have to disable or delete it.
(gdb) b oyss_funtion
Breakpoint 13 at 0x8049130: file main.c, line 119.
是否存在gdb命令或设置可以向我显示函数(符号)的文件行信息,而无需在那里设置断点?
Is there a gdb command or settings can show me the file line info of a function(symbol) without setting a breakpoint there?
推荐答案
使用info line
命令.
info line oyss_function
例如,假设文件test.c
包含:
#include <stdio.h>
int main(void)
{
printf("\n");
return 0;
}
然后,在GDB中调用info line main
会得到:
Then, invoking info line main
in GDB gets:
(gdb) info line main
Line 4 of "test.c" starts at address 0x400498 <main> and ends at 0x40049c <main+4>.
这篇关于GNU gdb如何显示源文件名和符号行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!