QQ20180511-120456.png
1. 常用命令
四個(gè)按鈕分別是:continue爷贫,step over羊苟,step into缝彬,step out
- (lldb) thread step-over // The same as "next" or "n" in GDB.
- (lldb) thread step-in // The same as "step" or "s" in GDB.
- (lldb) thread step-out // The same as "finish" or "f" in GDB.
- (lldb) thread step-inst // The same as "stepi" / "si" in GDB. 沒什么用
- (lldb) thread step-over-inst // The same as "nexti" / "ni" in GDB. 沒什么用
thread return 1000或者@"一個(gè)億"
- thread return @"xxxxx" :很重要,可以直接return想要的東西
在當(dāng)前界面, 可以直接設(shè)置運(yùn)行到第幾行停止
在輸出結(jié)果中我們還能看到類似于$0, $1這樣的符號(hào)桑孩,我們可以將其看作是指向?qū)ο蟮囊粋€(gè)引用芽唇,我們?cè)趌ldb中可以直接使用$1, $1來操作對(duì)應(yīng)的對(duì)象,這些東西存在于LLDB的命名空間中
- po: 輸出對(duì)象類型的, 實(shí)際上是調(diào)用了OC的description方法
- p = print : 輸出基本數(shù)據(jù)類型
這個(gè)命令可以創(chuàng)建或獲取內(nèi)存中的一個(gè)對(duì)象, 我們可以操作這個(gè)對(duì)象, 創(chuàng)建是注意名字一定帶$$$$$, 對(duì)象類型我們統(tǒng)一用id, 如果是基本數(shù)據(jù), int, float無所謂
根據(jù)崩潰信息地址, 可以查看
查看一個(gè)類的成員變量和屬性信息, 其實(shí)image就是一個(gè)lldb中的一個(gè)別名
起個(gè)別名
2. 用控制臺(tái)來改變窗口的顏色
先用這個(gè)方法找到控制器View的地址
用expression命令將view記錄下來
找了就賦值, 但是只有程序繼續(xù)運(yùn)行之后才會(huì)看到界面的變化咱台。因?yàn)楦淖兊膬?nèi)容必須被發(fā)送到渲染服務(wù)中蛤奢,然后顯示才會(huì)被更新它褪。渲染服務(wù)實(shí)際上是一個(gè)另外的進(jìn)程 (被稱作 backboard)饵骨。這就是說即使我們正在調(diào)試的內(nèi)容所在的進(jìn)程被打斷了,backboardd 也還是繼續(xù)運(yùn)行著的茫打。這意味著你可以用CATransaction繼續(xù)運(yùn)行程序
3 線程的狀態(tài)
- 當(dāng)進(jìn)程停止后, lldb會(huì)停留在當(dāng)前線程的當(dāng)前幀(frame)上面
獲取所有線程狀態(tài)
查看當(dāng)前線程的調(diào)用棧: 會(huì)把當(dāng)前當(dāng)前當(dāng)前線程所有調(diào)用的方法全部展示出來 注: 星號(hào)(*)表示為當(dāng)前線程
查看所有線程的調(diào)用棧信息, 如圖, 當(dāng)前有3個(gè)線程
查看當(dāng)前幀的所有信息 注: 比線程小一級(jí), 是線程中的一個(gè)frame
切換, 或者查看調(diào)用棧里面的信息
variable并沒有什么卵用event是個(gè)變量哈, info還行
3 給lldb安裝個(gè)facebook出品的chisel插件
brew update
brew install chise
if .lldbinit
file doesn't exist you can create it & open it by tapping on the terminal
touch .lldbinit
open .lldbinit
Then add the following line to your ~/.lldbinit
file.
# ~/.lldbinit
command script import /usr/local/opt/chisel/libexec/fblldb.py
The commands will be available the next time Xcode
starts.