Chisel-LLDB调试助手

Chisel is a collection of LLDB commands to assist debugging iOS apps.

在我查阅如何定位视图约束冲突相关博客资料的时候,了解到了Facebook开源的这款LLDB调试工具,通过Chisel可以轻松的找到约束有冲突的视图,自己以前只接触过Xcode自带LLDB工具,用的也不算太多,通过阅读相关文档,发现Chisel有很多实用的功能,比如说打印视图层级关系,通过命令添加断点,打印对象继承关系,预览打开UIImage、CGImageRef图片,显示隐藏视图或layer等等。

目录

  • GitHub地址
  • 安装
  • 常用常用Commands
  • 推荐博客

一、GitHub地址

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 用到的组件 1、通过CocoaPods安装 2、第三方类库安装 3、第三方服务 友盟社会化分享组件 友盟用户反馈 ...
    SunnyLeong阅读 14,714评论 1 180
  • 1、通过CocoaPods安装项目名称项目信息 AFNetworking网络请求组件 FMDB本地数据库组件 SD...
    阳明AGI阅读 16,019评论 3 119
  • 你是否曾经苦恼于理解你的代码,而去尝试打印一个变量的值? NSLog(@"%@", whatIsInsideThi...
    F麦子阅读 1,261评论 1 2
  • 你是否曾经苦恼于理解你的代码,而去尝试打印一个变量的值? NSLog(@"%@", whatIsInsideThi...
    paraneaeee阅读 1,225评论 0 7
  • 风 吹啊吹 云 躲啊躲 一把抓住 你的 小羊角辫子 像红鼻子的 长长的 两只兔耳朵 你轻轻地走进花园里 蜜蜂就飞上...
    雷玉玲Lyndi阅读 93评论 0 0