目录
- 用gdb调试
- GDB摘要
- 自由软件
- 自由软件需要自由文档
- GDB的贡献者
- 1 一个GDB会话示例
- 2 启动和退出GDB
- 2.1 调用GDB
- 2.1.1 选择文件
- 2.1.2 选择模式
- 2.1.3 GDB启动期间的操作
- 2.2 退出GDB
- 2.3 SHELL命令
- 2.4 登录输出
- 2.1 调用GDB
- 3 GDB命令
- 3.1 命令语法
- 3.2 命令补全
- 3.3 获取帮助
- 4
在GDB中运行程序
- 4.1 编译以便调试
- 4.2 启动程序
- 4.3 程序参数
- 4.4 程序环境
- 4.5 程序工作目录
- 4.6 程序的输入输出
- 4.7 调试已在运行的进程
- 4.8 杀死子进程
- 4.9 调试多进程
- 4.10 调试多线程
- 4.11 调试 Forks
- 4.12 设置书签
- 4.12.1 使用检查点的便利
- 5
停止和继续
- 5.1 断点、观察点和捕获点
- 5.1.1 设置断点
- 5.1.2 设置观察点
- 5.1.3 设置捕获点
- 5.1.4 删除断点
- 5.1.5 断点失效
- 5.1.6 断点条件
- 5.1.7 断点命令清单
- 5.1.8 保存断点到文件中
- 5.1.9 “无法插入断点”
- 5.1.10 “断点地址已调整到......”
- 5.2 继续执行和单部执行
- 5.3 信号
- 5.4 停止和启动多线程程序
- 5.4.1 All-Stop 模式
- 5.4.2 Non-Stop 模式
- 5.4.3 后台执行
- 5.4.4 线程特有的断点
- 5.4.5 系统调用中断
- 5.4.6 observer 模式
- 5.1 断点、观察点和捕获点
- 6 反向执行程序
- 7 记录执行和重新执行
- 8
查看堆栈
- 8.1 堆栈框架
- 8.2 回溯
- 8.3 选择框架
- 8.4 框架信息
- 9
查看源代码
- 9.1 打印源代码行
- 9.2 定位
- 9.3 编辑源代码文件
- 9.3.1 选择编辑器
- 9.4 查找源代码文件
- 9.5 指定源代码目录
- 9.6 源代码和机器代码
- 10
查看数据
- 10.1 表达式
- 10.2 模糊表达式
- 10.3 程序变量
- 10.4 人工数组
- 10.5 输出格式
- 10.6 查看内存
- 10.7 自动显示
- 10.8 显示设置
- 10.9 美化显示
- 10.9.1 美化显示简介
- 10.9.2 美化显示示例
- 10.9.3 美化显示命令
- 10.10 历史变量
- 10.11 内置变量
- 10.12 寄存器
- 10.13 浮点硬件Floating Point Hardware
- 10.14 向量单元Vector Unit
- 10.15 操作系统辅助信息
- 10.16 内存区域属性
- 10.16.1 属性
- 10.16.1.1 内存访问模式
- 10.16.1.2 内存访问大小
- 10.16.1.3 数据缓存
- 10.16.2 内存访问阻止
- 10.16.1 属性
- 10.17 内存和文件复制
- 10.18 产生核心转储文件
- 10.19 字符集设置
- 10.20 缓存数据和远程目标
- 10.21 查找内存
- 11
调试优化过的代码
- 11.1 内联函数
- 12 C 预处理宏
- 13
追踪
- 13.1 设置追踪的命令Commands to Set Tracepoints
- 13.1.1 创建和删除检查点Create and Delete Tracepoints
- 13.1.2 检查点的使能和失效Enable and Disable Tracepoints
- 13.1.3 检查点遍历Tracepoint Passcounts
- 13.1.4 检查点条件Tracepoint Conditions
- 13.1.5 追踪变量状态Trace State Variables
- 13.1.6 检查点行为列表Tracepoint Action Lists
- 13.1.7 列出检查点Listing Tracepoints
- 13.1.8 列出静态跟踪标记Listing Static Tracepoint Markers
- 13.1.9 开始和停止跟踪Starting and Stopping Trace Experiments
- 13.1.10 跟踪限制Tracepoint Restrictions
- 13.2 使用已收集的数据Using the Collected Data
- 13.2.1
tfind
n - 13.2.2
tdump
- 13.2.3
save tracepoints
filename
- 13.2.1
- 13.3 跟踪的内置变量
- 13.4 使用跟踪文件
- 13.1 设置追踪的命令Commands to Set Tracepoints
- 14
使用覆盖技术调试程序
- 14.1 覆盖技术如何工作How Overlays Work
- 14.2 覆盖技术命令Overlay Commands
- 14.3 自动覆盖调试Automatic Overlay Debugging
- 14.4 覆盖示例Overlay Sample Program
- 15
使用GDB调试不同的语言
- 15.1 切换源代码语言
- 15.1.1 文件名扩展和语言清单List of Filename Extensions and Languages
- 15.1.2 设置语言
- 15.1.3 暗示GDB源代码语言 Having gdb Infer the Source Language
- 15.2 显示语言
- 15.3 类型和边界检查
- 15.3.1 类型检查概况
- 15.3.2 边界检查概况
- 15.4 支持的语言
- 15.4.1 C 和 C++
- 15.4.1.1 C 和 C++ 操作符
- 15.4.1.2 C and C++ 常量
- 15.4.1.3 C++ 表达式
- 15.4.1.4 C 和 C++ 缺省值
- 15.4.1.5 C 和 C++ 类型和边界检查
- 15.4.1.6 gdb 和 C
- 15.4.1.7 gdb 的C++特性
- 15.4.1.8 十进制浮点数格式
- 15.4.2 D
- 15.4.3 Objective-C
- 15.4.3.1 Method Names in Commands
- 15.4.3.2 The Print Command With Objective-C
- 15.4.4 OpenCL C
- 15.4.4.1 OpenCL C 数据类型
- 15.4.4.2 OpenCL C 表达式
- 15.4.4.3 OpenCL C 操作符
- 15.4.5 Fortran
- 15.4.5.1 Fortran 操作符和表达式
- 15.4.5.2 Fortran 缺省值
- 15.4.5.3 Fortran 特有的命令
- 15.4.6 Pascal
- 15.4.7 Modula-2
- 15.4.7.1 操作符
- 15.4.7.2 Built-in Functions and Procedures
- 15.4.7.3 常量
- 15.4.7.4 Modula-2 类型
- 15.4.7.5 Modula-2 Defaults
- 15.4.7.6 Deviations from Standard Modula-2
- 15.4.7.7 Modula-2 类型和边界检查
- 15.4.7.8 The Scope Operators
::
and.
- 15.4.7.9 gdb and Modula-2
- 15.4.8 Ada
- 15.4.8.1 简介
- 15.4.8.2 Omissions from Ada
- 15.4.8.3 Additions to Ada
- 15.4.8.4 Stopping at the Very Beginning
- 15.4.8.5 Extensions for Ada Tasks
- 15.4.8.6 Tasking Support when Debugging Core Files
- 15.4.8.7 Tasking Support when using the Ravenscar Profile
- 15.4.8.8 Known Peculiarities of Ada Mode
- 15.4.1 C 和 C++
- 15.5 不支持的语言
- 15.1 切换源代码语言
- 16 查看符号表
- 17
更改执行
- 17.1 变量赋值
- 17.2 跳到别的地址继续执行
- 17.3 发送信号给程序
- 17.4 函数返回
- 17.5 调用程序的函数
- 17.6 给程序打补丁
- 18
GDB文件
- 18.1 Commands to Specify Files
- 18.2 Debugging Information in Separate Files
- 18.3 Index Files Speed Up gdb
- 18.4 Errors Reading Symbol Files
- 18.5 GDB Data Files
- 19
阐述调试目标
- 19.1 激活目标
- 19.2 Commands for Managing Targets
- 19.3 选择目标字节序
- 20
调试远程目标
- 20.1 连接到远程目标
- 20.2 发送文件到远程系统
- 20.3 使用
gdbserver
- 20.3.1 运行
gdbserver
- 20.3.1.1 Attaching to a Running Program
- 20.3.1.2
gdbserver的多进程模式
- 20.3.1.3
gdbserver其它命令行参数
- 20.3.2 连接到
gdbserver
- 20.3.3
gdbserver的监视命令
- 20.3.4 Tracepoints support in
gdbserver
- 20.3.1 运行
- 20.4 远程配置
- 20.5 Implementing a Remote Stub
- 20.5.1 What the Stub Can Do for You
- 20.5.2 What You Must Do for the Stub
- 20.5.3 Putting it All Together
- 21
详细的配置信息
- 21.1 本地化
- 21.1.1 HP-UX
- 21.1.2 BSD libkvm Interface
- 21.1.3 SVR4 Process Information
- 21.1.4 Features for Debugging djgpp Programs
- 21.1.5 Features for Debugging MS Windows PE Executables
- 21.1.5.1 Support for DLLs without Debugging Symbols
- 21.1.5.2 DLL Name Prefixes
- 21.1.5.3 Working with Minimal Symbols
- 21.1.6 Commands Specific to gnu Hurd Systems
- 21.1.7 QNX Neutrino
- 21.1.8 Darwin
- 21.2 嵌入式操作系统
- 21.2.1 在VxWorks中使用gdb
- 21.2.1.1 Connecting to VxWorks
- 21.2.1.2 VxWorks Download
- 21.2.1.3 Running Tasks
- 21.2.1 在VxWorks中使用gdb
- 21.3 嵌入式处理器
- 21.3.1 ARM
- 21.3.2 Renesas M32R/D 和 M32R/SDI
- 21.3.3 M68k
- 21.3.4 MicroBlaze
- 21.3.5 MIPS Embedded
- 21.3.6 OpenRISC 1000
- 21.3.7 PowerPC Embedded
- 21.3.8 HP PA Embedded
- 21.3.9 Tsqware Sparclet
- 21.3.9.1 Setting File to Debug
- 21.3.9.2 Connecting to Sparclet
- 21.3.9.3 Sparclet Download
- 21.3.9.4 Running and Debugging
- 21.3.10 Fujitsu Sparclite
- 21.3.11 Zilog Z8000
- 21.3.12 Atmel AVR
- 21.3.13 CRIS
- 21.3.14 Renesas Super-H
- 21.4 处理器架构
- 21.4.1 x86 Architecture-specific Issues
- 21.4.2 A29K
- 21.4.3 Alpha
- 21.4.4 MIPS
- 21.4.5 HPPA
- 21.4.6 Cell Broadband Engine SPU architecture
- 21.4.7 PowerPC
- 21.1 本地化
- 22
控制GDB
- 22.1 提示
- 22.2 命令编辑
- 22.3 命令历史
- 22.4 屏幕尺寸
- 22.5 数值
- 22.6 配置当前的ABI
- 22.7 可选的警告和信息
- 22.8 Optional Messages about Internal Happenings
- 22.9 其它杂项设置
- 23
GDB扩展
- 23.1 Canned Sequences of Commands
- 23.1.1 用户自定已命令
- 23.1.2 用户自定义宏命令
- 23.1.3 命令文件
- 23.1.4 控制输出的命令
- 23.2 Scripting gdb
using Python
- 23.2.1 Python Commands
- 23.2.2 Python API
- 23.2.2.1 Basic Python
- 23.2.2.2 Exception Handling
- 23.2.2.3 Values From Inferior
- 23.2.2.4 Types In Python
- 23.2.2.5 Pretty Printing API
- 23.2.2.6 Selecting Pretty-Printers
- 23.2.2.7 Writing a Pretty-Printer
- 23.2.2.8 Inferiors In Python
- 23.2.2.9 Events In Python
- 23.2.2.10 Threads In Python
- 23.2.2.11 Commands In Python
- 23.2.2.12 Parameters In Python
- 23.2.2.13 Writing new convenience functions
- 23.2.2.14 Program Spaces In Python
- 23.2.2.15 Objfiles In Python
- 23.2.2.16 Accessing inferior stack frames from Python.
- 23.2.2.17 Accessing frame blocks from Python.
- 23.2.2.18 Python representation of Symbols.
- 23.2.2.19 Symbol table representation in Python.
- 23.2.2.20 Manipulating breakpoints using Python
- 23.2.2.21 Python representation of lazy strings.
- 23.2.3 Auto-loading
- 23.2.3.1 The objfile -gdb.py file
- 23.2.3.2 The
.debug_gdb_scripts
section - 23.2.3.3 Which flavor to choose?
- 23.2.4 Python modules
- 23.2.4.1 gdb.printing
- 23.2.4.2 gdb.types
- 23.1 Canned Sequences of Commands
- 24 命令注释
- 25
GDB文本用户界面
- 25.1 TUI 简介
- 25.2 TUI 快捷键
- 25.3 TUI 单健模式
- 25.4 TUI-特有的命令
- 25.5 TUI 配置变量
- 26 在GNU Emacs中使用GDB
- 27 GDB/mi
接口
- Function and Purpose
- Notation and Terminology
- 27.1 gdb/mi
General Design
- 27.1.1 Context management
- 27.1.2 Asynchronous command execution and non-stop mode
- 27.1.3 Thread groups
- 27.2 gdb/mi
Command Syntax
- 27.2.1 gdb/mi Input Syntax
- 27.2.2 gdb/mi Output Syntax
- 27.3 gdb/mi Compatibility with CLI
- 27.4 gdb/mi Development and Front Ends
- 27.5 gdb/mi
Output Records
- 27.5.1 gdb/mi Result Records
- 27.5.2 gdb/mi Stream Records
- 27.5.3 gdb/mi Async Records
- 27.5.4 gdb/mi Frame Information
- 27.5.5 gdb/mi Thread Information
- 27.6 Simple Examples of gdb/mi Interaction
- 27.7 gdb/mi Command Description Format
- 27.8 gdb/mi Breakpoint Commands
- 27.9 gdb/mi Program Context
- 27.10 gdb/mi Thread Commands
- 27.11 gdb/mi Program Execution
- 27.12 gdb/mi Stack Manipulation Commands
- 27.13 gdb/mi Variable Objects
- 27.14 gdb/mi Data Manipulation
- 27.15 gdb/mi Tracepoint Commands
- 27.16 gdb/mi Symbol Query Commands
- 27.17 gdb/mi File Commands
- 27.18 gdb/mi Target Manipulation Commands
- 27.19 gdb/mi File Transfer Commands
- 27.20 Miscellaneous gdb/mi Commands
- 28
GDB注解
- 28.1 What is an Annotation?
- 28.2 The Server Prefix
- 28.3 Annotation for gdb Input
- 28.4 Errors
- 28.5 Invalidation Notices
- 28.6 Running the Program
- 28.7 Displaying Source
- 29 JIT编译接口
- 29.1 JIT Declarations
- 29.2 Registering Code
- 29.3 Unregistering Code
- 30
报告GDB漏洞
- 30.1 Have You Found a Bug?
- 30.2 How to Report Bugs
- 31
命令行编辑
- 31.1 行编辑介绍
- 31.2 Readline Interaction
- 31.2.1 Readline Bare Essentials
- 31.2.2 Readline Movement Commands
- 31.2.3 Readline Killing Commands
- 31.2.4 Readline Arguments
- 31.2.5 Searching for Commands in the History
- 31.3 Readline Init File
- 31.3.1 Readline Init File Syntax
- 31.3.2 Conditional Init Constructs
- 31.3.3 Sample Init File
- 31.4 Bindable Readline Commands
- 31.4.1 Commands For Moving
- 31.4.2 Commands For Manipulating The History
- 31.4.3 Commands For Changing Text
- 31.4.4 Killing And Yanking
- 31.4.5 Specifying Numeric Arguments
- 31.4.6 Letting Readline Type For You
- 31.4.7 Keyboard Macros
- 31.4.8 Some Miscellaneous Commands
- 31.5 Readline vi Mode
- 32
使用交互历史
- 32.1 历史展现
- 32.1.1 指定事件
- 32.1.2 指定单词
- 32.1.3 修改
- 32.1 历史展现
- 附录 A 格式化文档
- 附录
B 安装GDB
- B.1 要求
- B.2 调用GDB配置脚本
- B.3 在别的目录编译gdb
- B.4 指定宿主机和目标机的名字
- B.5 配置选项
- B.6 系统范围的配置和设置
- 附录 C 维护命令
- 附录
D gdb
Remote Serial Protocol
- D.1 简介
- D.2 Packets
- D.3 Stop Reply Packets
- D.4 General Query Packets
- D.5 Architecture-Specific Protocol Details
- D.5.1 ARM
- D.5.1.1 Breakpoint Kinds
- D.5.2 MIPS
- D.5.2.1 Register Packet Format
- D.5.1 ARM
- D.6 Tracepoint Packets
- D.6.1 Relocate instruction reply packet
- D.7 Host I/O Packets
- D.8 Interrupts
- D.9 Notification Packets
- D.10 Remote Protocol Support for Non-Stop Mode
- D.11 Packet Acknowledgment
- D.12 Examples
- D.13 File-I/O Remote Protocol Extension
- D.13.1 File-I/O Overview
- D.13.2 Protocol Basics
- D.13.3 The
F
Request Packet - D.13.4 The
F
Reply Packet - D.13.5 The `Ctrl-C ' Message
- D.13.6 Console I/O
- D.13.7 List of Supported Calls
- open
- close
- read
- write
- lseek
- rename
- unlink
- stat/fstat
- gettimeofday
- isatty
- system
- D.13.8 Protocol-specific Representation of Datatypes
- Integral Datatypes
- Pointer Values
- Memory Transfer
- struct stat
- struct timeval
- D.13.9 Constants
- Open Flags
- mode_t Values
- Errno Values
- Lseek Flags
- Limits
- D.13.10 File-I/O Examples
- D.14 Library List Format
- D.15 Memory Map Format
- D.16 Thread List Format
- 附录
E The GDB Agent Expression Mechanism
- E.1 通用字节序设计
- E.2 字节序描述
- E.3 使用代理表达式
- E.4 Varying Target Capabilities
- E.5 基本原理
- 附录 F Trace File Format
- 附录
G 目标说明
- G.1 Retrieving Descriptions
- G.2 Target Description Format
- G.2.1 Inclusion
- G.2.2 架构
- G.2.3 OS ABI
- G.2.4 兼容架构
- G.2.5 特性
- G.2.6 类型
- G.2.7 寄存器
- G.3 预定义目标类型
- G.4 常见的目标特性
- G.4.1 ARM 特性
- G.4.2 i386 特性
- G.4.3 MIPS 特性
- G.4.4 M68K 特性
- G.4.5 PowerPC 特性
- 附录
H 操作系统信息
- H.1 Process list
- 附录 I GNU GENERAL PUBLIC LICENSE
- 附录 J GNU Free Documentation License
- 索引