Xcode的lldb指令

1. help

help breakpoint :查看指令的用法

2. breakpoint

設(shè)置斷點(diǎn)
breakpoint set -r 函數(shù)名字:模糊匹配方法名字(可能會(huì)打很多斷點(diǎn))
breakpoint set -s 動(dòng)態(tài)庫(kù) -n 函數(shù)名:給指定動(dòng)態(tài)庫(kù)的函數(shù)打斷點(diǎn)
breakpoint list :列出所有的斷點(diǎn)(每個(gè)斷點(diǎn)都有自己的編號(hào))
breakpoint disable 斷點(diǎn)編號(hào) :禁用編號(hào)
breakpoint enable 斷點(diǎn)編號(hào) :?jiǎn)⒂镁幪?hào)
breakpoint delete 斷點(diǎn)編號(hào) :刪除編號(hào)
breakpoint command add 斷點(diǎn)編號(hào):給斷點(diǎn)預(yù)先設(shè)置需要執(zhí)行的的命令,觸發(fā)斷點(diǎn),就會(huì)按順序執(zhí)行
breakpoint command list 斷點(diǎn)編號(hào):查看斷點(diǎn)設(shè)置的命令
breakpoint command delete 斷點(diǎn)編號(hào):刪除斷點(diǎn)設(shè)置的命令

breakpoint set --name 函數(shù)名字
breakpoint set -n 簡(jiǎn)寫(xiě)
breakpoint set -n touchesBegan:withEvent://會(huì)給所有touchesBegan打斷點(diǎn)
breakpoint set -n "-[ViewController touchesBegan:withEvent:]"http://給指定類(lèi)打斷點(diǎn)

3. expression

執(zhí)行一個(gè)表達(dá)式
expression, expression --和 print ,p,call一樣
eexpression -O -- 和 po一樣

expression UILabel *l = [[UILabel alloc]init];l.frame = CGRectMake(100, 100, 100, 100);[self.view addSubview:l];l.text = @"123131";

4. thread backtrace

打印函數(shù)棧
和指令bt同效

5. thread return

叫函數(shù)直接返回某個(gè)值,不執(zhí)行斷點(diǎn)后面的代碼

6. frame variable

打印當(dāng)前斷點(diǎn)函數(shù)的參數(shù),變量

7. thread continue, continue, c

程序繼續(xù)運(yùn)行

8. thread step-over, next, n

單步運(yùn)行,遇到子函數(shù) 當(dāng)作整體一步執(zhí)行

9. thread step-in, step, s

單步運(yùn)行,遇到子函數(shù)會(huì)進(jìn)入子函數(shù)

10. thread step-out, finish

直接執(zhí)行完當(dāng)前函數(shù)的所有代碼,返回上一級(jí)函數(shù)

xcode按鈕對(duì)應(yīng)指令

11. si,ni和s, n類(lèi)似

s,n 是代碼級(jí)別
si,ni 是匯編級(jí)別

help n //thread step-over
help s  //thread step-in
help ni  //thread step-inst-over
help si  //thread step-inst

12 內(nèi)存斷點(diǎn)

watchpoint set variable self->_age :給self的age屬性打斷點(diǎn),有修時(shí),bt查看調(diào)研修改
watchpoint set variable 內(nèi)存地址
watchpoint set variable &self->_age

p &self->_age //打印self的age的內(nèi)存地址

watchpoint list
watchpoint disable 斷點(diǎn)編號(hào)
watchpoint enable 斷點(diǎn)編號(hào)
watchpoint delete 斷點(diǎn)編號(hào)
watchpoint command add 斷點(diǎn)編號(hào)
watchpoint command list 斷點(diǎn)編號(hào)
watchpoint command delete 斷點(diǎn)編號(hào)

13 image lookup

image lookup -t 類(lèi)型:查找類(lèi)型信息
image lookup -a 地址:根據(jù)內(nèi)存地址查找在模塊中的位置,崩潰查找
image lookup -n 符號(hào)或者函數(shù)名:查找符號(hào)或者函數(shù)的位置
image list 列出所加載模塊的信息

查找類(lèi)型信息

查找崩潰信息

image list -o -f //打印模塊的便宜地址,全路徑

總結(jié)

1.敲enter鍵,默認(rèn)執(zhí)行上次的命令
2.絕大部分指令可以縮寫(xiě)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 斷點(diǎn) breakpoint 幫助$help$help breakpoint 簡(jiǎn)寫(xiě):break/b 設(shè)置斷點(diǎn)$bre...
    farawei閱讀 1,250評(píng)論 0 51
  • 一、指令的格式 [ [ ...]] [-options [option- value]] [argument...
    Charlin丶閱讀 660評(píng)論 0 2
  • lldb指令的格式: [ [ ...]] [-options [option?value]] [argume...
    伶俐ll閱讀 543評(píng)論 0 1
  • 平時(shí)開(kāi)發(fā)的過(guò)程中使用Xcode都是圖形化操作習(xí)慣了,要是脫離了xcode你還能調(diào)試代碼嗎,恩,Xcode已經(jīng)把我們...
    fanglaoda閱讀 1,098評(píng)論 0 2
  • LLDB指令的基本格式 對(duì)應(yīng)著 例如給函數(shù)test設(shè)置斷點(diǎn): help指令 help指令可以幫助我們快速查找LLD...
    浪的出名閱讀 1,081評(píng)論 0 0

友情鏈接更多精彩內(nèi)容