Chisel is a collection of LLDB commands to assist debugging iOS apps.
在我查閱如何定位視圖約束沖突相關博客資料的時候,了解到了Facebook開源的這款LLDB調試工具,通過Chisel可以輕松的找到約束有沖突的視圖,自己以前只接觸過Xcode自帶LLDB工具,用的也不算太多,通過閱讀相關文檔,發現Chisel有很多實用的功能,比如說打印視圖層級關系,通過命令添加斷點,打印對象繼承關系,預覽打開UIImage、CGImageRef圖片,顯示隱藏視圖或layer等等。
目錄
- GitHub地址
- 安裝
- 常用常用Commands
- 推薦博客
一、GitHub地址
二、安裝
- 未安裝Homrebrew,先安裝Homrebrew
參考MAC上Homebrew常用命令 - 安裝Chisel
brew install chisel
- 如果沒有創建.lldbinit文件,則在終端創建文件
touch .lldbinit
//open .lldbinit
- 編輯.lldbinit文件,并添加以下內容
command script import /usr/local/opt/chisel/libexec/fblldb.py
vim .lldbinit
//添加以下內容
# ~/.lldbinit
...
command script import /path/to/fblldb.py
最后wq保存,重啟Xcode,就可以使用Chisel了。
三、常用Commands
命令 | 命令描述 | iOS | OS X |
---|---|---|---|
pviews | Print the recursive view description for the key window. | YES | YES |
pvc | Print the recursive view controller description for the key window. | YES | NO |
visualize | Open a UIImage, CGImageRef, UIView, CALayer, NSData (of an image), UIColor, CIColor, or CGColorRef in Preview.app on your Mac. | YES | NO |
fv | Find a view in the hierarchy whose class name matches the provided regex. | YES | NO |
fvc | Find a view controller in the hierarchy whose class name matches the provided regex. | YES | NO |
show/hide | Show or hide the given view or layer. You don't even have to continue the process to see the changes! | YES | YES |
mask/unmask | Overlay a view or layer with a transparent rectangle to visualize where it is. | YES | NO |
border/unborder | Add a border to a view or layer to visualize where it is. | YES | YES |
caflush | Flush the render server (equivalent to a "repaint" if no animations are in-flight). | YES | YES |
bmessage | Set a symbolic breakpoint on the method of a class or the method of an instance without worrying which class in the hierarchy actually implements the method. | YES | YES |
wivar | Set a watchpoint on an instance variable of an object. | YES | YES |
presponder | Print the responder chain starting from the given object. | YES | YES |
... | ... | ... | ... |
就介紹這么多了,現在自己用到的也并不算太多,做下記錄,方便自己以后查閱,有興趣的朋友可以自行了解其用法吧。
推薦博客
1、LLdb篇2教你使用faceBook的chisel來提高調試效率
2、Chisel-LLDB命令插件,讓調試更Easy