1、指令的格式
<command> [<subcommand> [<subcommand>...]] <action> [-options [option- value]] [argument [argument...]]
正則表達式
<command>
命令
[<subcommand> [<subcommand>...]]
子命令
<action>
命令操做
[-options [option- value]]
命令選項
[argument [argument...]]
命令參數
好比給 test 函數設置斷點 breakpoint set -n test
express
2、指令
1. help (查看指令的用法)
好比 help breakpoint
、help breakpoint set
bash
2. expression -- (執行一個表達式)
- --: 命令選項結束符,表示全部的命令選項已經設置完畢,若是沒有命令選項,--能夠省略
好比 expression self.view.backgroundColor = [UIColor redColor]
markdown
- expression、expression -- 和指令 print、p、call 的效果同樣
- expression -O -- 和指令 po 的效果同樣
3. thread backtrace (打印線程的堆棧信息)
- thread backtrace 和指令 bt 的效果同樣
4. thread return [] (讓函數直接返回某個值,不會執行斷點後面的代碼)
好比 thread return [self test]
函數
5. frame variable (打印當前棧幀的變量)
好比 frame variable self->_age
spa
6. thread continue、continue、c (程序繼續運行)
7. thread step-out、finish (直接執行完當前函數的全部代碼,返回到上一個函數)
8. thread step-over、next、n (單步運行,把子函數當作總體一步執行)
9. thread step-in、step、s (單步運行,遇到子函數會進入子函數)
10. thread step-inst-over、nexti、ni (單步運行,把子函數當作總體一步執行)
11. thread step-inst、stepi、si (單步運行,遇到子函數會進入子函數)
si、ni 和 s、n 相似
s、n 是源碼級別
si、ni 是彙編指令級別
複製代碼
12. breakpoint set (設置斷點)
- breakpoint set -a 函數地址
- breakpoint set -n 函數名
- breakpoint set -r 正則表達式
- breakpoint set -s 動態庫 -n 函數名
13. breakpoint list (列出全部的斷點,每一個斷點都有本身的編號)
14. breakpoint disable 斷點編號 (禁用斷點)
15. breakpoint enable 斷點編號 (啓用斷點)
16. breakpoint delete 斷點編號 (刪除斷點)
17. breakpoint command add 斷點編號
- 給斷點預先設置須要執行的命令,到觸發斷點時,就會按順序執行
18. breakpoint command list 斷點編號
19. breakpoint command delete 斷點編號
20. 內存斷點, 在內存數據發生改變的時候觸發(與代碼斷點差很少)
- watchpoint set variable 變量
好比 watchpoint set variable self->age
線程
- watchpoint set variable 地址
好比 watchpoint set expression &(self->_age)
code
- watchpoint list
- watchpoint disable 斷點編號
- watchpoint enable 斷點編號
- watchpoint delete 斷點編號
- watchpoint command add 斷點編號
- watchpoint command list 斷點編號
- watchpoint command delete 斷點編號
21. image lookup
- image lookup -t 類型 : 查找某個類型的信息
- image lookup -a 地址 : 根據內存地址查找在模塊中的位置
- image lookup -n 符號或者函數名 : 查找某個符號或者函數的位置
22. image list (列出所加載的模塊信息)
- image list -o -f : 打印出模塊的偏移地址、全路徑
小技巧
- 敲 Enter, 會自動執行上次的命令
- 絕大部分指令均可以使用縮寫
好比 breakpoint list
能夠縮寫成 br l
orm