Debugging with GDB
The GNU Source-Level Debugger
Edition 4.12, for GDB version 4.14
January 1994
Richard M. Stallman and Roland H. Pesch
Summary of GDB
Free software
Contributors to GDB
New Features since GDB Version 3.5
A Sample GDB Session
Getting In and Out of GDB
Invoking GDB
Choosing files
Choosing modes
Quitting GDB
Shell commands
GDB Commands
Command syntax
Command completion
Getting help
Running Programs Under GDB
Compiling for debugging
Starting your program
Your program's arguments
Your program's environment
Your program's working directory
Your program's input and output
Debugging an already-running process
Killing the child process
Additional process information
Debugging programs with multiple threads
Debugging programs with multiple processes
Stopping and Continuing
Breakpoints, watchpoints, and exceptions
Setting breakpoints
Setting watchpoints
Breakpoints and exceptions
Deleting breakpoints
Disabling breakpoints
Break conditions
Breakpoint command lists
Breakpoint menus
"Cannot insert breakpoints"
Continuing and stepping
Signals
Stopping and starting multi-thread programs
Examining the Stack
Stack frames
Backtraces
Selecting a frame
Information about a frame
MIPS machines and the function stack
Examining Source Files
Printing source lines
Searching source files
Specifying source directories
Source and machine code
Examining Data
Expressions
Program variables
Artificial arrays
Output formats
Examining memory
Automatic display
Print settings
Value history
Convenience variables
Registers
Floating point hardware
Using GDB with Different Languages
Switching between source languages
Setting the working language
Having GDB infer the source language
Displaying the language
Type and range checking
An overview of type checking
An overview of range checking
Supported languages
C and C++
C and C++ operators
C and C++ constants
C++ expressions
C and C++ defaults
C and C++ type and range checks
GDB and C
GDB features for C++
Modula-2
Operators
Built-in functions and procedures
Constants
Modula-2 defaults
Deviations from standard Modula-2
Modula-2 type and range checks
The scope operators
::
and
.
GDB and Modula-2
Examining the Symbol Table
Altering Execution
Assignment to variables
Continuing at a different address
Giving your program a signal
Returning from a function
Calling program functions
Patching programs
GDB Files
Commands to specify files
Errors reading symbol files
Specifying a Debugging Target
Active targets
Commands for managing targets
Remote debugging
The GDB remote serial protocol
What the stub can do for you
What you must do for the stub
Putting it all together
Communication protocol
Using the
gdbserver
program
GDB with a remote i960 (Nindy)
Startup with Nindy
Options for Nindy
Nindy reset command
The UDI protocol for AMD29K
The EBMON protocol for AMD29K
Communications setup
EB29K cross-debugging
Remote log
GDB with a Tandem ST2000
GDB and VxWorks
Connecting to VxWorks
VxWorks download
Running tasks
GDB and Hitachi microprocessors
Connecting to Hitachi boards
Using the E7000 in-circuit emulator
Special GDB commands for Hitachi micros
GDB and remote MIPS boards
Simulated CPU target
Controlling GDB
Prompt
Command editing
Command history
Screen size
Numbers
Optional warnings and messages
Canned Sequences of Commands
User-defined commands
User-defined command hooks
Command files
Commands for controlled output
Using GDB under GNU Emacs
Reporting Bugs in GDB
Have you found a bug?
How to report bugs
Command Line Editing
Introduction to Line Editing
Readline Interaction
Readline Bare Essentials
Readline Movement Commands
Readline Killing Commands
Readline Arguments
Readline Init File
Readline Init Syntax
Commands For Moving
Commands For Manipulating The History
Commands For Changing Text
Killing And Yanking
Specifying Numeric Arguments
Letting Readline Type For You
Some Miscellaneous Commands
Readline Vi Mode
Using History Interactively
History Interaction
Event Designators
Word Designators
Modifiers
Renamed Commands
Formatting Documentation
Installing GDB
Compiling GDB in another directory
Specifying names for hosts and targets
configure
options
Index