GDB找不到行号 [英] GDB can not find line numbers
问题描述
我正在使用GDB调试Linux内核模块。
加载模块后,我使用 add-symbol-file
添加模块符号。
当我在GDB中使用 list
命令来查找模块中的符号,例如:
(gdb)list __do_restart
122 *将提供错误或成功类型。在
123 * cr_mods提前重新启动支持的情况下,信号将在适当的时候发布。
124 *
125 *注意:此类重新启动可用于迁移并行进程。
126 * /
127 int __do_restart(void * data){
128 struct siginfo info;
129 struct object_stored_data * sd;
130 struct crmod_clients * clt = get_client(data);
131 memset(& info,0,sizeof(struct siginfo));
(gdb)b __do_restart
0xe081740e处的断点1:file /home/amrzar/Workspace/common/commod.c,第130行。
我甚至可以为它设置一个断点。但是在第一次中断执行时,当我使用 list
时,它表示:
(gdb)list __do_restart
__do_restart没有行号已知
它简单地丢失了符号!为什么? (我确信在目标文件中存在调试信息)
谢谢
我不知道是什么原因这个问题,但一旦我使用添加符号文件
但添加 -readnow
选项同样的问题解决了它对我来说!
I am using GDB for debugging a Linux kernel module.
After loading the module, i use add-symbol-file
to add module symbols.
When i use list
command in GDB to find a symbol in module, it will find it for example:
(gdb) list __do_restart
122 * would provide type of error or success. In the case of early restart support from
123 * cr_mods a signal will be posted at appropriate time.
124 *
125 * NOTE: This type of restarting could be used for migrating parallel processes.
126 */
127 int __do_restart(void *data){
128 struct siginfo info;
129 struct object_stored_data *sd;
130 struct crmod_clients *clt = get_client(data);
131 memset(&info, 0, sizeof(struct siginfo));
(gdb) b __do_restart
Breakpoint 1 at 0xe081740e: file /home/amrzar/Workspace/common/commod.c, line 130.
I can even set a breakpoint for it. But after the first interrupt in execution when i use list
it says:
(gdb) list __do_restart
No line number known for __do_restart
It simply lost symbols! Why? (I am sure about presence of debugging information in object file) Thanks
I do not really know what causes this problem but once I had same trouble using add-symbol-file
but adding -readnow
option solved it for me!
这篇关于GDB找不到行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!