Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
984 views
in Technique[技术] by (71.8m points)

linux - 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 installing 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 ...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...