Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 4

Debugging with gdb

Legal Notice
Table of Contents
1. Debugging with gdb
2. Summary of gdb
2.1. Free software
2.2. Free Software Needs Free Documentation
2.3. Contributors to gdb
3. A Sample gdb Session
4. Getting In and Out of gdb
4.1. Invoking gdb
4.1.1. Choosing files
4.1.2. Choosing modes
4.2. Quitting gdb
4.3. Shell commands
4.4. Logging output
5. gdb Commands
5.1. Command syntax
5.2. Command completion
5.3. Getting help
6. Running Programs Under gdb
6.1. Compiling for debugging
6.2. Starting your program
6.3. Your program's arguments
6.4. Your program's environment
6.5. Your program's working directory
6.6. Your program's input and output
6.7. Debugging an already-running process
6.8. Killing the child process
6.9. Debugging programs with multiple threads
6.10. Debugging programs with multiple processes
7. Stopping and Continuing
7.1. Breakpoints, watchpoints, and catchpoints
7.1.1. Setting breakpoints
7.1.2. Setting watchpoints
7.1.3. Setting catchpoints
7.1.4. Deleting breakpoints
7.1.5. Disabling breakpoints
7.1.6. Break conditions
7.1.7. Breakpoint command lists
7.1.8. Breakpoint menus
7.1.9. "Cannot insert breakpoints"
7.2. Continuing and stepping
7.3. Signals
7.4. Stopping and starting multi-thread programs
8. Examining the Stack
8.1. Stack frames
8.2. Backtraces
8.3. Selecting a frame
8.4. Information about a frame
9. Examining Source Files
9.1. Printing source lines
9.2. Editing source files
9.2.1. Choosing your editor
9.3. Searching source files
9.4. Specifying source directories
9.5. Source and machine code
10. Examining Data
10.1. Expressions
10.2. Program variables
10.3. Artificial arrays
10.4. Output formats
10.5. Examining memory
10.6. Automatic display
10.7. Print settings
10.8. Value history
10.9. Convenience variables
10.10. Registers
10.11. Floating point hardware
10.12. Vector Unit
10.13. Memory region attributes
10.13.1. Attributes
10.14. Copy between memory and a file
10.15. Character Sets
11. C Preprocessor Macros
12. Tracepoints
12.1. Commands to Set Tracepoints
12.1.1. Create and Delete Tracepoints
12.1.2. Enable and Disable Tracepoints
12.1.3. Tracepoint Passcounts
12.1.4. Tracepoint Action Lists
12.1.5. Listing Tracepoints
12.1.6. Starting and Stopping Trace Experiment
12.2. Using the collected data
12.2.1. tfind n
12.2.2. tdump
12.2.3. save-tracepoints filename
12.3. Convenience Variables for Tracepoints
13. Debugging Programs That Use Overlays
13.1. How Overlays Work
13.2. Overlay Commands
13.3. Automatic Overlay Debugging
13.4. Overlay Sample Program
14. Using gdb with Different Languages
14.1. Switching between source languages
14.1.1. List of filename extensions and languages
14.1.2. Setting the working language
14.1.3. Having gdb infer the source language
14.2. Displaying the language
14.3. Type and range checking
14.3.1. An overview of type checking
14.3.2. An overview of range checking
14.4. Supported languages
14.4.1. C and C++
14.4.2. Objective-C
14.4.3. Modula-2
14.5. Unsupported languages
15. Examining the Symbol Table
16. Altering Execution
16.1. Assignment to variables
16.2. Continuing at a different address
16.3. Giving your program a signal
16.4. Returning from a function
16.5. Calling program functions
16.6. Patching programs
17. gdb Files
17.1. Commands to specify files
17.2. Debugging Information in Separate Files
17.3. Errors reading symbol files
18. Specifying a Debugging Target
18.1. Active targets
18.2. Commands for managing targets
18.3. Choosing target byte order
18.4. Remote debugging
18.5. Kernel Object Display
19. Debugging remote programs
19.1. Connecting to a remote target
19.2. Using the gdbserverprogram
19.3. Using the gdbserve.nlmprogram
19.4. Remote configuration
19.5. Implementing a remote stub
19.5.1. What the stub can do for you
19.5.2. What you must do for the stub
19.5.3. Putting it all together
20. Configuration-Specific Information
20.1. Native
20.1.1. HP-UX
20.1.2. SVR4 process information
20.1.3. Features for Debugging djgpp Programs
20.1.4. Features for Debugging MS Windows PE executables
20.2. Embedded Operating Systems
20.2.1. Using gdb with VxWorks
20.3. Embedded Processors
20.3.1. ARM
20.3.2. Hitachi H8/300
20.3.3. H8/500
20.3.4. Mitsubishi M32R/D
20.3.5. M68k
20.3.6. MIPS Embedded
20.3.7. OpenRISC 1000
20.3.8. PowerPC
20.3.9. HP PA Embedded
20.3.10. Hitachi SH
20.3.11. Tsqware Sparclet
20.3.12. Fujitsu Sparclite
20.3.13. Tandem ST2000
20.3.14. Zilog Z8000
20.4. Architectures
20.4.1. A29K
20.4.2. Alpha
20.4.3. MIPS
21. Controlling gdb
21.1. Prompt
21.2. Command editing
21.3. Command history
21.4. Screen size
21.5. Numbers
21.6. Configuring the current ABI
21.7. Optional warnings and messages
21.8. Optional messages about internal happenings
22. Canned Sequences of Commands
22.1. User-defined commands
22.2. User-defined command hooks
22.3. Command files
22.4. Commands for controlled output
23. Command Interpreters
24. gdb Text User Interface
24.1. TUI overview
24.2. TUI Key Bindings
24.3. TUI Single Key Mode
24.4. TUI specific commands
24.5. TUI configuration variables
25. Using gdb under gnu Emacs
26. The gdb/mi Interface
26.1. Function and Purpose
26.2. Notation and Terminology
26.3. Acknowledgments
26.4. gdb/mi Command Syntax
26.4.1. gdb/mi Input Syntax
26.4.2. gdb/mi Output Syntax
26.4.3. Simple Examples of gdb/mi Interaction
26.5. gdb/mi Compatibility with CLI
26.6. gdb/mi Output Records
26.6.1. gdb/mi Result Records
26.6.2. gdb/mi Stream Records
26.6.3. gdb/mi Out-of-band Records
26.7. gdb/mi Command Description Format
26.7.1. Motivation
26.7.2. Introduction
26.7.3. Commands
26.8. gdb/mi Breakpoint table commands
26.8.1. The -break-afterCommand
26.8.2. The -break-conditionCommand
26.8.3. The -break-deleteCommand
26.8.4. The -break-disableCommand
26.8.5. The -break-enableCommand
26.8.6. The -break-infoCommand
26.8.7. The -break-insertCommand
26.8.8. The -break-listCommand
26.8.9. The -break-watchCommand
26.9. gdb/mi Data Manipulation
26.9.1. The -data-disassembleCommand
26.9.2. The -data-evaluate-expressionCommand
26.9.3. The -data-list-changed-registersCommand
26.9.4. The -data-list-register-namesCommand
26.9.5. The -data-list-register-valuesCommand
26.9.6. The -data-read-memoryCommand
26.9.7. The -display-deleteCommand
26.9.8. The -display-disableCommand
26.9.9. The -display-enableCommand
26.9.10. The -display-insertCommand
26.9.11. The -display-listCommand
26.9.12. The -environment-cdCommand
26.9.13. The -environment-directoryCommand
26.9.14. The -environment-pathCommand
26.9.15. The -environment-pwdCommand
26.10. gdb/mi Program control
26.10.1. Program termination
26.10.2. Examples
26.11. Command Descriptions
26.11.1. The -exec-abortCommand
26.11.2. The -exec-argumentsCommand
26.11.3. The -exec-continueCommand
26.11.4. The -exec-finishCommand
26.11.5. The -exec-interruptCommand
26.11.6. The -exec-nextCommand
26.11.7. The -exec-next-instructionCommand
26.11.8. The -exec-returnCommand
26.11.9. The -exec-runCommand
26.11.10. The -exec-show-argumentsCommand
26.11.11. The -exec-stepCommand
26.11.12. The -exec-step-instructionCommand
26.11.13. The -exec-untilCommand
26.11.14. The -file-exec-and-symbolsCommand
26.11.15. The -file-exec-fileCommand
26.11.16. The -file-list-exec-sectionsCommand
26.11.17. The -file-list-exec-source-fileCommand
26.11.18. The -file-list-exec-source-filesCommand
26.11.19. The -file-list-shared-librariesCommand
26.11.20. The -file-list-symbol-filesCommand
26.11.21. The -file-symbol-fileCommand
26.12. Miscellaneous gdb commands in gdb/mi
26.12.1. The -gdb-exitCommand
26.12.2. The -gdb-setCommand
26.12.3. The -gdb-showCommand
26.12.4. The -gdb-versionCommand
26.12.5. The -interpreter-execCommand
26.12.6. Synopsis
26.12.7. gdb Command
26.12.8. Example
26.13. gdb/mi Stack Manipulation Commands
26.13.1. The -stack-info-frameCommand
26.13.2. The -stack-info-depthCommand
26.13.3. The -stack-list-argumentsCommand
26.13.4. The -stack-list-framesCommand
26.13.5. The -stack-list-localsCommand
26.13.6. The -stack-select-frameCommand
26.14. gdb/mi Symbol Query Commands
26.14.1. The -symbol-info-addressCommand
26.14.2. The -symbol-info-fileCommand
26.14.3. The -symbol-info-functionCommand
26.14.4. The -symbol-info-lineCommand
26.14.5. The -symbol-info-symbolCommand
26.14.6. The -symbol-list-functionsCommand
26.14.7. The -symbol-list-linesCommand
26.14.8. The -symbol-list-typesCommand
26.14.9. The -symbol-list-variablesCommand
26.14.10. The -symbol-locateCommand
26.14.11. The -symbol-typeCommand
26.15. gdb/mi Target Manipulation Commands
26.15.1. The -target-attachCommand
26.15.2. The -target-compare-sectionsCommand
26.15.3. The -target-detachCommand
26.15.4. The -target-disconnectCommand
26.15.5. The -target-downloadCommand
26.15.6. The -target-exec-statusCommand
26.15.7. The -target-list-available-targetsCommand
26.15.8. The -target-list-current-targetsCommand
26.15.9. The -target-list-parametersCommand
26.15.10. The -target-selectCommand
26.16. gdb/mi Thread Commands
26.16.1. The -thread-infoCommand
26.16.2. The -thread-list-all-threadsCommand
26.16.3. The -thread-list-idsCommand
26.16.4. The -thread-selectCommand
26.17. gdb/mi Tracepoint Commands
26.18. gdb/mi Variable Objects
26.18.1. Motivation for Variable Objects in gdb/mi
26.18.2. Introduction to Variable Objects in gdb/mi
26.18.3. Description And Use of Operations on Variable Objects
26.18.4. The -var-createCommand
26.18.5. The -var-deleteCommand
26.18.6. The -var-set-formatCommand
26.18.7. The -var-show-formatCommand
26.18.8. The -var-info-num-childrenCommand
26.18.9. The -var-list-childrenCommand
26.18.10. The -var-info-typeCommand
26.18.11. The -var-info-expressionCommand
26.18.12. The -var-show-attributes Command
26.18.13. The -var-evaluate-expression Command
26.18.14. The -var-assignCommand
26.18.15. The -var-updateCommand
27. gdb Annotations
27.1. What is an Annotation?
27.2. The Server Prefix
27.3. Values
27.4. Frames
27.5. Displays
27.6. Annotation for gdb Input
27.7. Errors
27.8. Information on Breakpoints
27.9. Invalidation Notices
27.10. Running the Program
27.11. Displaying Source
27.12. Annotations We Might Want in the Future
28. Reporting Bugs in gdb
28.1. Have you found a bug?
28.2. How to report bugs
29. Command Line Editing
29.1. Introduction to Line Editing
29.2. Readline Interaction
29.2.1. Readline Bare Essentials
29.2.2. Readline Movement Commands
29.2.3. Readline Killing Commands
29.2.4. Readline Arguments
29.2.5. Searching for Commands in the History
29.3. Readline Init File
29.3.1. Readline Init File Syntax
29.3.2. Conditional Init Constructs
29.3.3. Sample Init File
29.4. Bindable Readline Commands
29.4.1. Commands For Moving
29.4.2. Commands For Manipulating The History
29.4.3. Commands For Changing Text
29.4.4. Killing And Yanking
29.4.5. Specifying Numeric Arguments
29.4.6. Letting Readline Type For You
29.4.7. Keyboard Macros
29.4.8. Some Miscellaneous Commands
29.5. Readline vi Mode
30. Using History Interactively
30.1. History Expansion
30.1.1. Event Designators
30.1.2. Word Designators
30.1.3. Modifiers
A. Formatting Documentation
B. Installing gdb
B.1. Compiling gdb in another directory
B.2. Specifying names for hosts and targets
B.3. configure options
C. Maintenance Commands
D. gdb Remote Serial Protocol
D.1. Overview
D.2. Packets
D.3. Stop Reply Packets
D.4. General Query Packets
D.5. Register Packet Format
D.6. Examples
D.7. File-I/O remote protocol extension
D.7.1. File-I/O Overview
D.7.2. Protocol basics
D.7.3. The Frequest packet
D.7.4. The Freply packet
D.7.5. Memory transfer
D.7.6. The Ctrl-C message
D.7.7. Console I/O
D.7.8. The isatty(3) call
D.7.9. The system(3) call
D.7.10. List of supported calls
D.7.11. Protocol specific representation of datatypes
D.7.12. Constants
D.7.13. File-I/O Examples
E. The GDB Agent Expression Mechanism
E.1. General Bytecode Design
E.2. Bytecode Descriptions
E.3. Using Agent Expressions
E.4. Varying Target Capabilities
E.5. Tracing on Symmetrix
E.6. Rationale
F. GNU GENERAL PUBLIC LICENSE
F.1. Preamble
F.2. How to Apply These Terms to Your New Programs
G. GNU Free Documentation License
G.1. ADDENDUM: How to use this License for your documents
Index

 
 
  Published under the terms of the GNU General Public License Design by Interspire