Chapter 4. Getting In and Out of gdb
13
-c
number
-pid
number
-p
number
Connect to process ID
number
, as with the
attach
command. If there is no such process, gdb
will attempt to open a core file named
number
.
-command
file
-x
file
Execute gdb commands from file
file
. Refer to Section 22.3
Command files
.
-directory
directory
-d
directory
Add
directory
to the path to search for source files.
-m
-mapped
Warning: this option depends on operating system facilities that are not supported on all systems.
If memory-mapped files are available on your system through the
mmap
system call, you can
use this option to have gdb write the symbols from your program into a reusable file in the
current directory. If the program you are debugging is called
/tmp/fred
, the mapped symbol
file is
/tmp/fred.syms
. Future gdb debugging sessions notice the presence of this file, and
can quickly map in symbol information from it, rather than reading the symbol table from the
executable program.
The
.syms
file is specific to the host machine where gdb is run. It holds an exact image of the
internal gdb symbol table. It cannot be shared across multiple host platforms.
-r
-readnow
Read each symbol file’s entire symbol table immediately, rather than the default, which is to read
it incrementally as it is needed. This makes startup slower, but makes future operations faster.
You typically combine the
-mapped
and
-readnow
options in order to build a
.syms
file that contains
complete symbol information. (Refer to Section 17.1
Commands to specify files
for information on
.syms
files.) A simple gdb invocation to do nothing but build a
.syms
file for future use is:
gdb -batch -nx -mapped -readnow programname
4.1.2. Choosing modes
You can run gdb in various alternative modes--for example, in batch mode or quiet mode.
-nx
-n
Do not execute commands found in any initialization files. Normally, gdb executes the commands
in these files after all the command options and arguments have been processed. Refer to Section
22.3
Command files
.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......