Chapter 17. gdb Files
145
show solib-search-path
Display the current shared library search path.
17.2. Debugging Information in Separate Files
gdb allows you to put a program’s debugging information in a file separate from the executable itself,
in a way that allows gdb to find and load the debugging information automatically. Since debugging
information can be very large -- sometimes larger than the executable code itself -- some systems
distribute debugging information for their executables in separate files, which users can install only
when they need to debug a problem.
If an executable’s debugging information has been extracted to a separate file, the executable should
contain a
debug link
giving the name of the debugging information file (with no directory compo-
nents), and a checksum of its contents. (The exact form of a debug link is described below.) If the full
name of the directory containing the executable is
execdir
, and the executable has a debug link that
specifies the name
debugfile
, then gdb will automatically search for the debugging information file
in three places:
•
the directory containing the executable file (that is, it will look for a file named
execdir
/
debugfile
,
•
a subdirectory of that directory named
.debug
(that is, the file
execdir
/.debug/
debugfile
, and
•
a subdirectory of the global debug file directory that includes the executable’s full path,
and the name from the link (that is, the file
globaldebugdir
/
execdir
/
debugfile
, where
globaldebugdir
is the global debug file directory, and
execdir
has been turned into a relative
path).
gdb checks under each of these names for a debugging information file whose checksum matches that
given in the link, and reads the debugging information from the first one it finds.
So, for example, if you ask gdb to debug
/usr/bin/ls
, which has a link containing the
name
ls.debug
, and the global debug directory is
/usr/lib/debug
, then gdb will look
for debug
information
in
/usr/bin/ls.debug
,
/usr/bin/.debug/ls.debug
, and
/usr/lib/debug/usr/bin/ls.debug
.
You can set the global debugging info directory’s name, and view the name gdb is currently using.
set debug-file-directory
directory
Set the directory which gdb searches for separate debugging information files to
directory
.
show debug-file-directory
Show the directory gdb searches for separate debugging information files.
A debug link is a special section of the executable file named
.gnu_debuglink
. The section must
contain:
•
A filename, with any leading directory components removed, followed by a zero byte,
•
zero to three bytes of padding, as needed to reach the next four-byte boundary within the section,
and
•
a four-byte CRC checksum, stored in the same endianness used for the executable file itself. The
checksum is computed on the debugging information file’s full contents by the function given be-
low, passing zero as the
crc
argument.
Any executable file format can carry a debug link, as long as it can contain a section named
.gnu_debuglink
with the contents described above.
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......