为什么某些调试符号丢失,如何跟踪他们? [英] Why are some debug symbols missing and how to track them?

查看:168
本文介绍了为什么某些调试符号丢失,如何跟踪他们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在调试一个内核模块,并为此,我建有调试信息的整个内核(生产kallsyms,等...)。

I am currently debugging a Kernel module and to this purpose, I built the whole kernel with debug information (produces kallsyms, etc ...).

当我尝试纳米my_module.ko ,我得到我的模块包含的符号列表。所有是豪鹏除了一些符号形式的缺失,因为它们不会在符号列表中出现。我对这种感觉的是,相关的职能正在自动内联。

When I try nm my_module.ko, I get the list of symbols included by my module. All is allright except that some symbols are kind of missing as they do not appear in the symbol list. My feeling about this is that the related functions are being automatically inlined.

总之,与运行的qemu-的kgdb / GDB内核的时候,我能够看到失踪函数被调用。这意味着编译器并没有消灭它,因为它从来没有任何code路径(因此我的情)使用。

Anyway, when running the kernel with qemu-kgdb/gdb, I am able to see that the "missing" function is called. This means the compiler did not wipe it out because it was never used in any code path (hence my "feeling").

由于符号没有出现,我不能设置上有一个断点和gdb不会解开它,这样我可以看到正在运行的code路径 - 明白的我不知道该怎么告诉GDB解开它的。结果
不幸的是,我希望看到的code路径的这一部分......我该怎么办呢?

Since the symbol does not appear, I can't set a breakpoint on it and gdb won't unroll it so that I can see the running code path - understand I don't know how to tell gdb to unroll it.
Unfortunately, I want to see this part of the code path ... How can I do so ?

修改:由于汤姆的回答表明,我尝试使用文件:如下行语法:

EDIT : As suggested in Tom's answer, I tried using the file:line syntax as below :

我的code文件看起来是这样的:

My code file looks like this :

int foo(int arg) // The function that I suspect to be inlined - here is line 1
{
    /* Blabla */
    return 42;
}

void foo2(void)
{
    foo(0); // Line 9
}

我试过 B file.c中:1 ,并且断点被击中,但富()功能尚未解开。
当然,我生产调试符号,因为我还设置了断点 foo2的来看看发生了什么(这行之有效)。

I tried b file.c:1, and the breakpoint was hit but the foo() function is not unrolled. Of course, I am producing debug symbols, since I also set a breakpoint to foo2 to check what happened (which worked well).

推荐答案

您不说你使用的是什么版本的GDB的。

You don't say what version of gdb you are using.

很老的gdb的版本没有为内联函数提供任何支持。这对于6.8,甚至7.0是真的 - 我不记得。你可以看一下新闻文件为您的GDB看到的。

Very old versions of gdb don't have any support for inline functions. This was true for 6.8 and maybe even 7.0 -- I don't recall. You can look at the NEWS file for your gdb to see.

然后有一个支持的内联函数断点GDB的一些版本,但只有使用文件:行语法。所以,你会做什么是查找功能,在编辑器中,并找到它的行号,并输入,例如:

Then there were some versions of gdb that supported breakpoints on inline functions, but only using the "file:line" syntax. So what you would do is look up the function in your editor, and find its line number and enter, e.g.:

(gdb) break myfile.c:777

更近的gdb的版本,从7.4或7.5(我忘了)会处理破发功能就好了,如果功能被内联。

Even more recent versions of gdb, starting with 7.4 or 7.5 (I forget) will handle "break function" just fine if "function" was inlined.

所有如果你已经debuginfo软可这只是作品。所以,如果你尝试这样做,它失败了,要么你有一个旧的gdb,或者你忘了使用-g。

All of this only works if you have debuginfo available. So if you tried this, and it failed, either you have an older gdb, or you forgot to use -g.

里面有GDB没有什么好办法看到编译对象是什么人失踪-g。你可以看到它从外壳上.o文件轻松pretty,不过,通过运行readelf -WS,并寻找没有一个.debug_info部分文件。

There's no good way inside gdb to see what objects in a compilation were missing -g. You can see it pretty easily from the shell, though, by running "readelf -WS" on the .o files, and looking for files that don't have a .debug_info section.

这篇关于为什么某些调试符号丢失,如何跟踪他们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆