# 得到命令的幫助信息
## 技巧
使用`help`命令可以得到gdb的命令幫助信息:
(1)`help`命令不加任何參數會得到命令的分類:
(gdb) help
List of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands
Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(2)當輸入`help class`命令時,可以得到這個類別下所有命令的列表和命令功能:
(gdb) help data
Examining data.
List of commands:
append -- Append target code/data to a local file
append binary -- Append target code/data to a raw binary file
append binary memory -- Append contents of memory to a raw binary file
append binary value -- Append the value of an expression to a raw binary file
append memory -- Append contents of memory to a raw binary file
append value -- Append the value of an expression to a raw binary file
call -- Call a function in the program
disassemble -- Disassemble a specified section of memory
display -- Print value of expression EXP each time the program stops
dump -- Dump target code/data to a local file
dump binary -- Write target code/data to a raw binary file
dump binary memory -- Write contents of memory to a raw binary file
dump binary value -- Write the value of an expression to a raw binary file
......
(3)也可以用`help command`命令得到某一個具體命令的用法:
(gdb) help mem
Define attributes for memory region or reset memory region handling totarget-based.
Usage: mem auto
mem <lo addr> <hi addr> [<mode> <width> <cache>],
where <mode> may be rw (read/write), ro (read-only) or wo (write-only),
<width> may be 8, 16, 32, or 64, and
<cache> may be cache or nocache
(4)用`apropos regexp`命令查找所有符合`regexp`正則表達式的命令信息:
(gdb) apropos set
awatch -- Set a watchpoint for an expression
b -- Set breakpoint at specified line or function
br -- Set breakpoint at specified line or function
bre -- Set breakpoint at specified line or function
brea -- Set breakpoint at specified line or function
......
詳情參見[gdb手冊](https://sourceware.org/gdb/onlinedocs/gdb/Help.html)
## 貢獻者
nanxiao
- 版權
- 內容
- 調整窗口大小
- 一個gdb會話中同時調試多個程序
- 調試已經運行的進程
- 在匿名空間設置斷點
- 在程序地址上打斷點
- 在程序入口處打斷點
- 在函數的第一條匯編指令打斷點
- 在文件行號上打斷點
- 使用斷點命令改變程序的執行
- 直接執行函數
- 為exec調用設置catchpoint
- 為fork調用設置catchpoint
- 為ptrace調用設置catchpoint
- 為系統調用設置catchpoint
- 為vfork調用設置catchpoint
- 改變字符串的值
- 配置gdb init文件
- 設置源文件查找路徑
- 自動反匯編后面要執行的代碼
- 顯示程序原始機器碼
- 顯示將要執行的匯編指令
- 打印內存的值
- 退出正在調試的函數
- 為調試進程產生core dump文件
- 得到命令的幫助信息
- 忽略斷點
- 信息顯示
- 打印函數堆棧幀信息
- 列出函數的名字
- 查看信號處理信息
- 顯示共享鏈接庫信息
- 跳轉到指定位置執行
- 顯示匯編代碼窗口
- 顯示寄存器窗口
- 加載可執行程序和core dump文件
- 打印程序進程空間信息
- 在Solaris上使用maintenance命令查看線程信息
- 將源程序和匯編指令映射起來
- 修改PC寄存器的值
- 命令行選項的格式
- 信號發生時是否把信號丟給程序處理
- 修改被調試程序的二進制文件
- 支持預處理器宏信息
- 打印STL容器中的內容
- 打印數組的索引下標
- 打印ASCII和寬字符字符串
- 打印數組中任意連續元素值
- 按照派生類型打印對象
- 打印調用棧幀中變量的值
- 打印大數組中的內容
- 打印函數局部變量的值
- 打印程序動態分配內存的信息
- 打印進程內存信息
- 打印寄存器的值
- 信號發生時是否打印信號信息
- 打印源代碼行
- 打印靜態變量的值
- 查看線程信息
- 打印變量的類型和所在文件
- gdb退出時不顯示提示信息
- 在gdb中執行cd和pwd命令
- 在gdb中執行shell命令和make
- 保存已經設置的斷點
- 保存歷史命令
- 選擇函數堆棧幀
- 給程序發送信號
- 設置條件斷點
- 打印尾調用堆棧幀信息
- 同時調試父進程和子進程
- 設置匯編指令格式
- 調試子進程
- 指定程序的輸入輸出設備
- 記錄執行gdb的過程
- 輸出信息多時不會暫停輸出
- 每行打印一個結構體成員
- 設置被調試程序的參數
- 設置命令提示符
- 設置命令提示符
- 設置讀觀察點
- 設置讀寫觀察點
- 只允許一個線程運行
- 按何種方式解析腳本文件
- 進入不帶調試信息的函數
- 設置臨時斷點
- 設置變量的值
- 設置觀察點只針對特定線程生效
- 設置觀察點
- 顯示gdb版權相關信息
- 不顯示線程啟動和退出信息
- 顯示gdb版本信息
- 啟動時不顯示提示信息
- 是否進入帶調試信息的函數
- 信號發生時是否暫停程序
- 替換查找源文件的目錄
- 讓catchpoint只觸發一次
- 進入和退出圖形化調試界面
- 向上或向下切換函數堆棧幀
- 使用“$_”和“$__”變量
- 使用“$_exitcode”變量
- 使用“$_siginfo”變量
- 使用“$_thread”變量
- 使用命令的縮寫形式