开发者

What is the recommended way to perform source-level debugging of system library calls?

I have a need to debug into some calls in system libraries, to understand how the calls differ, and why one or another would be failing.

It is now common for Linux distros to provide stripped system libraries and separate debug symbol files. For example, /lib/libc-2.8.so is stripped of symbols, leaving behind a section named .gnu_debuglink that contains info to find a separate debug file. The separate debug files are installable through a debug package, and contain symbolic info needed by gdb. It's well described here http://www.technovelty.org/code/debug-info-symbols.html and http://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

After in开发者_如何学Gostalling the debug package and the sources, I was expecting that GDB would find the symbols and sources and I would be able to view listings and step into the calls. Instead, gdb tells me "no line number known for xyz"

I've verified that debug-file-location is correct, and directories is set to the source directories.

Is it even possible to do what I want? Am I going about this the wrong way? Is there a simpler way?


Did you try to set the debug-file-directory parameter in GDB? As per the documentation you pointed out, it should do what you want:

set debug-file-directory directories Set the directories which gdb searches for separate debugging information files to directory. Multiple directory components can be set concatenating them by a directory separator.

show debug-file-directory Show the directories gdb searches for separate debugging information files.

For instance in my Fedora distribution, the directory is /usr/lib/debug.

You can also define it at compile time with

configure --with-separate-debug-dir=/usr/lib/debug ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜