目录
- Chisel 简介
- Chisel 命令详解
- alamborder
- alamunborder
- bdisable
- benable
- binside
- bmessage
- border
- caflush
- copy
- dcomponents
- dismiss
- fa11y
- findinstances
- flicker
- fv
- fvc
- heapfrom
- hide
- mask
- mwarning
- pa11y
- pa11yi
- pactions
- paltrace
- panim
- pbcopy
- pblock
- pbundlepath
- pcells
- pclass
- pcomponents
- pcurl
- pdata
- pdocspath
- pinternals
- pinvocation
- pivar
- pjson
- pkp
- pmethods
- poobjc
- pproperties
- present
- presponder
- psjson
- ptv
- pvc
- pviews
- rcomponents
- sequence
- setinput
- settext
- show
- slowanim
- taplog
- uikit
- unborder
- unmask
- unslowanim
- visualize
- vs
- wivar
- xdebug
- xnoid
- xobject
- xtree
- zzz
Chisel 简介
-
什么是 Chisel?
Chisel 是 Facebook 开源的一组 LLDB 命令合集,用于协助开发者调试 iOS 应用程序。Chisel 里面的命令正是基于 LLDB 支持的 Python 脚本解释器来运行的。也就是说:Chisel 其实就是一个 Python 脚本的集合,这些 Python 脚本拼接命令字符串 ,然后让 LLDB 执行。Chisel 每条命令对应的 Python 脚本保存在
/usr/local/Cellar/chisel/2.0.1/libexec
路径下,熟悉 Python 的开发者可以试着读一下这些脚本文件的内容 -
Chisel 的安装
brew update brew install chisel
~ > brew install chisel ==> Downloading https://ghcr.io/v2/homebrew/core/chisel/manifests/2.0.1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/chisel/blobs/sha256:7ef6b79ffa9 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Pouring chisel--2.0.1.catalina.bottle.tar.gz ==> Caveats Add the following line to ~/.lldbinit to load chisel when Xcode launches: command script import /usr/local/opt/chisel/libexec/fbchisellldb.py ==> Summary 🍺 /usr/local/Cellar/chisel/2.0.1: 33 files, 313.3KB
如果
~/.lldbinit
文件不存在,则开发者可以通过终端来创建并打开它touch ~/.lldbinit open ~/.lldbinit
根据 Homebrew 安装 Chisel 时输出的提示,将以下命令添加到
~/.lldbinit
文件中command script import /usr/local/opt/chisel/libexec/fbchisellldb.py
或者,手动下载 Chisel,并将以下命令添加到
~/.lldbinit
文件中command script import /path/to/fbchisellldb.py
Chisel 中的命令,将在下次 Xcode 启动时可用
Chisel 命令详解
alamborder
(lldb) help alamborder
# 在约束冲突的视图的周围放置边框
# 期望使用原始输入(请参阅 'help raw-input')
Options:
--color/-c <color>
# 类型: string
# 边框的颜色,例如: red、green、magenta
--width/-w <width>
# 类型: CGFloat
# 边框的宽度
Syntax: alamborder [--color=color] [--width=width]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAutoLayoutCommands.py 中被实现为 FBAutolayoutBorderAmbiguous
alamunborder
(lldb) help alamunborder
# 移除约束冲突的视图周围的边框
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: alamunborder
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAutoLayoutCommands.py 中被实现为 FBAutolayoutUnborderAmbiguous
bdisable
(lldb) help bdisable
# 禁用指定的表达式 <expression> 所标识的一组断点
# 期望使用原始输入(请参阅 'help raw-input')
# 示例如下:
# 使用 bdisable address 将指定的内存地址的断点切换为 disable
bdisable 0x0000000104514dfc
bdisable 0x183e23564
# 使用 bdisable filename 将指定的文件中的所有断点切换为 disable
bdisable SUNNetService.m
# 使用 bdisable module 将指定的模块中的所有断点切换为 disable
bdisable UIKit
bdisable Foundation
Arguments:
<expression>
# 类型: string
# 用于禁用断点的表达式
Syntax: bdisable <expression>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBMethodBreakpointDisableCommand
benable
(lldb) help benable
# 启用指定的表达式 <expression> 所标识的一组断点
# 期望使用原始输入(请参阅 'help raw-input')
# 示例如下:
# 使用 benable address 将指定的内存地址的断点切换为 enable
benable 0x0000000104514dfc
benable 0x183e23564
# 使用 benable filename 将指定的文件中的所有断点切换为 enable
benable SUNNetService.m
# 使用 benable module 将指定的模块中的所有断点切换为 enable
benable UIKit
benable Foundation
Arguments:
<expression>
# 类型: string
# 用于启用断点的表达式
Syntax: benable <expression>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBMethodBreakpointEnableCommand
binside
(lldb) help binside
# 为当前正在运行的 framework/library 中的相对地址设置断点
# 此命令可以找到 framework/library 的偏移量,并相应地滑动到指定的相对地址处
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<address>
# 类型: string
# 在当前正在运行的 framework/library 中,要设置断点的地址
Syntax: binside <address>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBFrameworkAddressBreakpointCommand
bmessage
(lldb) help bmessage
# 为指定的类中指定的方法选择器设置断点,即使该类本身没有重写该方法选择器所指定的方法
# 此命令会遍历类的层级结构,直到找到一个实现指定的方法选择器的类,并在那里设置条件断点
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<expression>
# 类型: string
# 用于设置断点的表达式,例如: "-[MyView setFrame:]"、"+[MyView awesomeClassMethod]"、"-[0xabcd1234 setFrame:]"
Syntax: bmessage <expression>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBMethodBreakpointCommand
bmessage
命令的实现原理(非重写方法的符号断点):
假设你想知道 -[MyViewController viewDidAppear:]
什么时候被调用。如果这个方法并没有在 MyViewController
中实现,而是在其父类 UIViewController
中实现的,那么该怎么办呢?试着在 MyViewController
中设置一个符号断点,会出现以下结果:
(lldb) b -[MyViewController viewDidAppear:]
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
因为 LLDB 会在 MyViewController
类中查找一个 viewDidAppear:
的符号,但是实际在 MyViewController
这个类中却找不到,所以断点永远不会得到解析。此时,你需要做的是把断点放在 UIViewController
上,并为该断点设置一个条件 [self isKindOfClass:[MyViewController class]]
。正常情况下这样设置一个断点条件是可以正常工作的。但是这里不会,因为我们没有父类 UIViewController
的实现。因为 -[UIViewController viewDidAppear:]
是苹果实现的方法,所以我们没有它的符号,因此在方法内没有 self
。如果想在该符号断点的条件上使用 self
,则你必须知道 self
在哪里 (self
可能在寄存器上,也可能在栈上;在 x86 中,你可以在 $esp+4
找到 self
)。但是这是很痛苦的,因为现在你必须至少要知道四种体系结构(x86,x86-64,armv7,armv64)。想象你需要花多少时间去学习指令集以及它们每一个的调用约定,然后写一个在你的超类上设置断点并且条件正确的命令。幸运的是,这个在 Chisel 中被解决了。这被称为 bmessage
:
(lldb) bmessage -[MyViewController viewDidAppear:]
Setting a breakpoint at -[UIViewController viewDidAppear:] with condition (void*)object_getClass((id)$rdi) == 0x0000000105154570
Breakpoint 2: where = UIKitCore`-[UIViewController viewDidAppear:], address = 0x00007fff23f6968e
border
(lldb) help border
# 在指定的 view/layer 的周围绘制边框
# 可以选择提供边框的颜色和宽度
# 此外,可以提供深度以递归地绘制指定的 view/layer 的子视图的边框
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView* / CALayer*
# 要绘制边框的 view/layer,NSView 必须是 layer-backed 的
Options:
--color/-c <color>
# 类型: string
# 边框的颜色,例如: red、green、magenta
--width/-w <width>
# 类型: CGFloat
# 边框的宽度
--depth/-d <depth>
# 类型: int
# 要绘制边框的子视图的层级深度
# 从提供的或默认的颜色开始,每一个层级都有不同的颜色
Syntax: border [--color=color] [--width=width] [--depth=depth] <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBDrawBorderCommand
caflush
(lldb) help caflush
# 强制 Core Animation 进行刷新
# 此命令会导致 UI 重新绘制,但也可能会干扰正在进行的动画
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: caflush
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBCoreAnimationFlushCommand
copy
(lldb) help copy
# 将指定的数据复制到你的 Mac 上
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<target>
# 类型: (id)
# 要复制的对象
Options:
--filename/-f <filename>
# Type: string
# 数据要输出的文件的名称
--no-open/-n
# 不要打开该文件
Syntax: copy [--filename=filename] [--no-open] <target>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBCopyCommands.py 中被实现为 FBCopyCommand
dcomponents
(lldb) help dcomponents
# 设置组件(components)的调试选项(debugging options)
# 期望使用原始输入(请参阅 'help raw-input')
Options:
--set/-s
# 启用组件(components)的调试模式
--unset/-u
# 禁用组件(components)的调试模式
Syntax: dcomponents [--set] [--unset]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBComponentCommands.py 中被实现为 FBComponentsDebugCommand
dismiss
(lldb) help dismiss
# dismiss 指定的控制器 <viewController>
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewController>
# 类型: UIViewController*
# 要 dismiss 的控制器
Syntax: dismiss <viewController>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBDismissViewControllerCommand
fa11y
(lldb) help fa11y
# 查找可访问性标签与指定的正则表达式 <labelRegex> 匹配的视图,并将找到的第一个结果的地址放在剪贴板上
# 什么是可访问性标签 ? 例如: UILabel、UIButton 的 title
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<labelRegex>
# 类型: string
# 用于搜索视图层级结构的可访问性标签的正则表达式
Syntax: fa11y <labelRegex>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAccessibilityCommands.py 中被实现为 FBFindViewByAccessibilityLabelCommand
findinstances
(lldb) help findinstances
# 查找指定的 Objective-C 类的实例
# 期望使用原始输入(请参阅 'help raw-input')
# 此命令会扫描内存并使用探索式方法来识别 Objective-C 类的实例
# 包括继承自 NSObject 的 Swift 类
# 基本示例:
# 下面的基本搜索会查找指定的类或协议的实例
# 默认情况下,指定的类或协议的子类会包含在搜索结果中
# 如果只需要查找确切的类的实例,则请添加星号(*)前缀,例如:*UIScrollView
findinstances UIScrollView
findinstances *UIScrollView
findinstances UIScrollViewDelegate
# 高级示例:
# 查找符合以下条件的所有视图: 隐藏的,不可见的,不在窗口(window)中的
findinstances UIView hidden == true || alpha == 0 || window == nil
# 查找宽度为零或高度为零的视图
findinstances UIView layer.bounds.#size.width == 0 || layer.bounds.#size.height == 0
# 查找没有子视图的叶子视图
findinstances UIView subviews.@count == 0
# 查找具有(可能是密码或密码短语的)键的字典
findinstances NSDictionary any @allKeys beginswith 'pass'
# 上面的高级示例使用了过滤器
# 该过滤器是使用 NSPredicate 实现的,有关过滤器的更多详细信息,请参阅 NSPredicate 的相关文档
# 基本的 NSPredicate 表达式具有相对可预测的语法
# 有一些例外情况,请参阅 https://github.com/facebook/chisel/wiki/findinstances
Arguments:
<type>
# 类型: string
# 类或协议的名称
<query>
# 类型: string
# 用于查询的表达式,使用 NSPredicate 的语法
Syntax: findinstances <type> <query>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBFindInstancesCommand
flicker
(lldb) help flicker
# 快速地显示和隐藏指定的视图(即,快速地闪烁指定的视图),以帮助开发者在界面中快速可视化地定位到指定的视图的位置
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView*
# 要进行闪烁的视图
Syntax: flicker <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBFlickerCommands.py 中被实现为 FBFlickerViewCommand
fv
(lldb) help fv
# 查找类名与指定的正则表达式 <classNameRegex> 匹配的视图,并将找到的第一个实例的地址放在剪贴板上
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<classNameRegex>
# 类型: string
# 用于搜索视图层级结构中视图类的正则表达式
Syntax: fv <classNameRegex>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBFindCommands.py 中被实现为 FBFindViewCommand
fvc
(lldb) help fvc
# 查找类名与指定的正则表达式 <classNameRegex> 匹配的控制器,并将找到的第一个实例的地址放在剪贴板上
# 期望使用原始输入(请参阅 'help raw-input')
Options:
--name/-n <classNameRegex>
# 类型: string
# 用于搜索控制器层级结构中控制器类的正则表达式
--view/-v <view>
# 类型: UIView
# 此选项将打印拥有指定的视图 <view> 的控制器
Syntax: fvc [--name=classNameRegex] [--view=view]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBFindCommands.py 中被实现为 FBFindViewControllerCommand
heapfrom
(lldb) help heapfrom
# 显示在指定变量中包含的所有嵌套的堆指针
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: heapfrom
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBHeapFromCommand
hide
(lldb) help hide
# 隐藏指定的 view/layer
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView* /CALayer*
# 要隐藏的 view/layer
Syntax: hide <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBHideViewCommand
mask
(lldb) help mask
# 向当前窗口(window)添加一个半透明的矩形以显示可能被遮挡或隐藏的 view/layer 的边界
# 即,向指定的 view/layer 添加一个蒙版
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView* / CALayer*
# 要添加蒙版的 view/layer
Options:
--color/-c <color>
# 类型: string
# 蒙版的颜色,例如: red、green、magenta
--alpha/-a <alpha>
# Type: CGFloat
# 蒙版的透明度
Syntax: mask [--color=color] [--alpha=alpha] <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBMaskViewCommand
mwarning
(lldb) help mwarning
# 模拟内存警告
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: mwarning
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBMemoryWarningCommand
pa11y
(lldb) help pa11y
# 打印指定的视图 <aView> 的层级结构中,所有视图的可访问性标签
# 什么是可访问性标签 ? 例如: UILabel、UIButton 的 title
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<aView>
# 类型: UIView*
# 要打印层级结构中所有视图的可访问性标签的视图
Syntax: pa11y <aView>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAccessibilityCommands.py 中被实现为 FBPrintAccessibilityLabels
pa11yi
(lldb) help pa11yi
# 打印指定的视图 <aView> 的层级结构中,所有视图的可访问性标识符
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<aView>
# 类型: UIView*
# 要打印层级结构中所有视图的可访问性标识符的视图
Syntax: pa11yi <aView>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAccessibilityCommands.py 中被实现为 FBPrintAccessibilityIdentifiers
pactions
(lldb) help pactions
# 打印指定的控件(control)的行为(actions)和目标(targets)
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<control>
# 类型: UIControl*
# 要检视其行为(actions)和目标(targets)的控件(control)
Syntax: pactions <control>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintTargetActions
paltrace
(lldb) help paltrace
# 打印指定的视图 <view> 的自动布局跟踪(Auto Layout Trace),默认为主窗口(key window)
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<view>
# 类型: UIView*
# 要打印自动布局跟踪(Auto Layout Trace)的视图
Syntax: paltrace <view>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBAutoLayoutCommands.py 中被实现为 FBPrintAutolayoutTrace
panim
(lldb) help panim
# 如果代码当前正在使用 UIView Animation Block 执行,则进行打印
Syntax: panim
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintIsExecutingInAnimationBlockCommand
pbcopy
(lldb) help pbcopy
# 打印指定的对象 <object>,并将输出复制到剪贴板
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要打印的对象
Syntax: pbcopy <object>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintToClipboard
pblock
(lldb) help pblock
# 打印指定的代码块 <block> 的实现地址与签名
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<block>
# 要打印实现地址与签名的代码块对象
Syntax: pblock <block>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBClassDump.py 中被实现为 FBPrintBlock
pbundlepath
(lldb) help pbundlepath
# 打印当前应用程序的 Bundle 目录的路径
# 期望使用原始输入(请参阅 'help raw-input')
Options:
--open/-o
# 在 Finder 中打开当前应用程序的 Bundle 目录
Syntax: pbundlepath [--open]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintApplicationBundlePath
pcells
(lldb) help pcells
# 打印视图层级结构中最前面的 table view 的可见单元格(cell)
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: pcells
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintOnscreenTableViewCells
pclass
(lldb) help pclass
# 打印从指定的对象 <object> 所属的类开始的继承层级结构
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要检视继承层级结构的实例对象
Syntax: pclass <object>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintInheritanceHierarchy
pcomponents
(lldb) help pcomponents
# 打印从指定视图 <aView> 开始找到的组件(components)的递归描述(recursive description)
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<aView>
# 类型: UIView* / CKComponent*
# 要开始搜索组件(components)的视图
Options:
--up/-u
# 仅打印在具有它们的第一个 superview 上找到的组件(components)层级结构,并将搜索带到其窗口(window)
--show-views/-v <showViews>
# 类型: BOOL
# 如果提供的参数为 NO,则打印组件(components)层级结构并且不打印视图
# 默认会打印视图(即,默认为 YES)
Syntax: pcomponents [--up] [--show-views=showViews] <aView>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBComponentCommands.py 中被实现为 FBComponentsPrintCommand
pcurl
(lldb) help pcurl
# 将指定的请求 <request> 作为 curl 命令打印
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<request>
# 类型: NSURLRequest* / NSMutableURLRequest*
# 要转换为 curl 命令的请求
Options:
--embed-data/-e
# 将请求数据内嵌为 base64 编码
Syntax: pcurl [--embed-data] <request>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintAsCurl
pdata
(lldb) help pdata
# 将指定的 NSData 对象的内容打印为字符串
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<data>
# 类型: NSData*
# 要打印的 NSData 对象
Options:
--encoding/-e <encoding>
# 类型: string
# 使用的编码类型 (默认为 utf-8)
# 支持的编码类型:
- ascii,
- utf8,
- utf16, unicode,
- utf16l (Little endian),
- utf16b (Big endian),
- utf32,
- utf32l (Little endian),
- utf32b (Big endian),
- latin1, iso88591 (88591),
- latin2, iso88592 (88592),
- cp1251 (1251),
- cp1252 (1252),
- cp1253 (1253),
- cp1254 (1254),
- cp1250 (1250),
Syntax: pdata [--encoding=encoding] <data>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintData
pdocspath
(lldb) help pdocspath
# 打印当前应用程序的 Documents 目录的路径
# 期望使用原始输入(请参阅 'help raw-input')
Options:
--open/-o
# 在 Finder 中打开应用程序的 Documents 目录
Syntax: pdocspath [--open]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintApplicationDocumentsPath
pinternals
(lldb) help pinternals
# 通过将指定的对象 <object> 非关联化为指针,来显示对象的内部结构
# 即,用于查看对象的成员变量
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要执行的对象表达式
Options:
--apple/-a
# 以苹果的方式打印 ivar
Syntax: pinternals [--apple] <object>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintInternals
pinvocation
(lldb) help pinvocation
# 打印当前方法调用的栈帧(stack frame),接收者(receiver),参数(arguments)
# 如果有任何参数是可变参数,则将无法打印所有参数
# 期望使用原始输入(请参阅 'help raw-input')
# 注意: 遗憾的是,此命令目前仅在 x86 架构上实现
Options:
--all/-a
# 用于指定要打印整个方法调用栈,而不仅仅是当前的栈帧
Syntax: pinvocation [--all]
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBInvocationCommands.py 中被实现为 FBPrintInvocation
pivar
(lldb) help pivar
# 打印指定的实例对象 <object> 中指定的名称 <ivarName> 所标识的成员变量的值
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要执行的对象表达式
<ivarName>
# 类型: string
# 要打印的成员变量的名称
Syntax: pivar <object> <ivarName>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintInstanceVariable
pjson
(lldb) help pjson
# 打印 NSDictionary 或 NSArray 对象的 JSON 表示
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要打印的 NSDictionary 或 NSArray 对象
Options:
--plain/-p
# 纯 JSON (Plain JSON)
Syntax: pjson [--plain] <object>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintJSON
pkp
(lldb) help pkp
# 使用 -valueForKeyPath: 打印出关键路径(keypath)表达式的值
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<keypath>
# 类型: NSString*
# 要打印值的关键路径(keypath)
Syntax: pkp <keypath>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintKeyPath
pmethods
(lldb) help pmethods
# 打印指定的类对象或实例对象 <instance or class> 所标识的类的类方法和对象方法
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<instance or class>
# 类型: instance/Class
# 一个 Objective-C 的类对象或实例对象
Options:
--address/-a # 打印方法的实现地址
--instance/-i # 打印对象方法
--class/-c # 打印类方法
--name/-n # 将参数作为类名
Syntax: pmethods [--address] [--instance] [--class] [--name] <instance or class>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBClassDump.py 中被实现为 FBPrintMethods
poobjc
(lldb) help poobjc
# 打印指定的表达式 <expression> 的执行结果,该表达式将在 ObjC++ 的上下文中执行
# 此命令是 "expression -O -l ObjC++ -- " 命令的速记格式
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<expression>
# 用于执行和打印的 ObjC 表达式
Syntax: poobjc <expression>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintObjectInObjc
pproperties
(lldb) help pproperties
# 打印指定的类对象或实例对象 <instance or class> 所标识的类的属性
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<instance or class>
# 类型: instance/Class
# 一个 Objective-C 的类对象或实例对象
Options:
--name/-n
# 将参数作为类名
Syntax: pproperties [--name] <instance or class>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBClassDump.py 中被实现为 FBPrintProperties
present
(lldb) help present
# present 指定的控制器 <viewController>
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewController>
# 类型: UIViewController*
# 要 present 的控制器
Syntax: present <viewController>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBPresentViewControllerCommand
presponder
(lldb) help presponder
# 从指定的响应者 <startResponder> 开始打印响应者链条(responder chain)
# 即,查看指定控件 <startResponder> 的响应者链条(responder chain)
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<startResponder>
# 类型: UIResponder*
# 用于开始遍历响应者链条的初始响应者
Syntax: presponder <startResponder>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintUpwardResponderChain
psjson
(lldb) help psjson
# 打印 Swift Dictionary 或 Swift Array 对象的 JSON 表示
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: NSObject*
# 要打印的 Swift Dictionary 或 Swift Array 对象
Options:
--plain/-p
# 纯 JSON (Plain JSON)
Syntax: psjson [--plain] <object>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintSwiftJSON
ptv
(lldb) help ptv
# 打印视图层级结构中最前面的 table view
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: ptv
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintOnscreenTableView
pvc
(lldb) help pvc
# 打印指定的控制器 <aViewController> 的递归描述(recursion description)
# 即,打印指定的控制器 <aViewController> 的层级关系
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<aViewController>
# 类型: UIViewController*
# 要打印递归描述的控制器
Syntax: pvc <aViewController>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintViewControllerHierarchyCommand
pviews
(lldb) help pviews
# 打印指定的视图 <aView> 的递归描述(recursion description)
# 即,打印指定的视图 <aView> 的层级关系
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<aView>
# 类型: UIView* / NSView*
# 要打印递归描述的视图
Options:
--up/-u
# 仅打印指定的视图的正上方的层级结构,直到其所属的窗口(window)
--depth/-d <depth>
# 类型: int
# 仅打印到指定的层级深度,0 表示无限深度
--window/-w <window>
# 类型: int
# 指定要打印递归描述的窗口(window)
# 使用 "po (id)[[UIApplication sharedApplication] windows]" 命令检查当前都存在哪些窗口
--short/-s
# 打印视图的简短描述(short description)
--medium/-m
# 打印视图的中等描述(medium description)
Syntax: pviews [--up] [--depth=depth] [--window=window] [--short] [--medium] <aView>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBPrintCommands.py 中被实现为 FBPrintViewHierarchyCommand
rcomponents
(lldb) help rcomponents
# 同步重排(reflow)和更新(update)所有组件(components)
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: rcomponents
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBComponentCommands.py 中被实现为 FBComponentsReflowCommand
sequence
(lldb) help sequence
# 按顺序运行命令,在出现任何错误时停止
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: sequence
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBSequenceCommand
setinput
(lldb) help setinput
# 将指定的文本 <inputText> 输入到作为第一响应者的 text field 或 text view
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<inputText>
# 类型: string
# 要输入的文本
Syntax: setinput <inputText>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBTextInputCommands.py 中被实现为 FBInputTexToFirstResponderCommand
settext
(lldb) help settext
# 为指定的可访问性标识符 <accessibilityId> 所标识的视图设置指定的文本 <replacementText>
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<accessibilityId>
# 类型: string
# 要设置文本的视图的可访问性标识符
<replacementText>
# 类型: string
# 要设置的文本
Syntax: settext <accessibilityId> <replacementText>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBTextInputCommands.py 中被实现为 FBInputTexByAccessibilityIdCommand
show
(lldb) help show
# 显示指定的 view/layer
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView* / CALayer*
# 要显示的 view/layer
Syntax: show <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBShowViewCommand
slowanim
(lldb) help slowanim
# 减慢动画速度
# 适用于 iOS 模拟器和设备
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<speed>
# 类型: float
# 动画速度 (默认为 0.1)
Syntax: slowanim <speed>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBSlowAnimationCommand
taplog
(lldb) help taplog
# 将点击到的视图输出到控制台 (该控件要能响应点击事件)
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: taplog
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBFindCommands.py 中被实现为 FBTapLoggerCommand
uikit
(lldb) help uikit
# 导入 UIKit 模块,以在 LLDB 中访问 UIKit 中的类型
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: uikit
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBImportCommands.py 中被实现为 ImportUIKitModule
unborder
(lldb) help unborder
# 移除指定的 view/layer 周围的边框
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / NSView* / CALayer*
# 要移除边框的 view/layer
Options:
--depth/-d <depth>
# 类型: int
# 要移除边框的子视图的层级深度
Syntax: unborder [--depth=depth] <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBRemoveBorderCommand
unmask
(lldb) help unmask
# 移除指定的 view/layer 上面的蒙版
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<viewOrLayer>
# 类型: UIView* / CALayer*
# 要移除蒙版的 view/layer
Syntax: unmask <viewOrLayer>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBUnmaskViewCommand
unslowanim
(lldb) help unslowanim
# 禁用动画缓速 slowanim
# 期望使用原始输入(请参阅 'help raw-input')
Syntax: unslowanim
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDisplayCommands.py 中被实现为 FBUnslowAnimationCommand
visualize
(lldb) help visualize
# 在 Mac 上的 Preview.app 中打开 UIImage、CGImageRef、UIView、CALayer、CVPixelBuffer 类型的对象
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<target>
# 类型: (id)
# 要可视化的对象
Syntax: visualize <target>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBVisualizationCommands.py 中被实现为 FBVisualizeCommand
vs
(lldb) help vs
# 通过遍历视图的层级结构,用交互的方式动态地搜索视图
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<view>
# 类型: UIView*
# 当前要定位到的视图(交互式搜索的出发点)
Syntax: vs <view>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBFlickerCommands.py 中被实现为 FBViewSearchCommand
wivar
(lldb) help wivar
# 为指定的对象 <object> 中指定的名称 <ivarName> 所标识的成员变量设置内存断点
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<object>
# 类型: id
# 要执行的对象表达式
<ivarName>
# 类型: string
# 要监视的成员变量的名称
Syntax: wivar <object> <ivarName>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDebugCommands.py 中被实现为 FBWatchInstanceVariableCommand
xdebug
(lldb) help xdebug
# 以人类可读的格式打印指定的 XCUIElement 类型的 <element> 元素的调试描述
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<element>
# 类型: XCUIElement*
# 要打印调试描述的 XCUIElement 元素
Syntax: xdebug <element>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBXCTestCommands.py 中被实现为 FBXCPrintDebugDescription
xnoid
(lldb) help xnoid
# 打印带标签(label)但不带标识符(identifier)的 XCUIElement 对象
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<element>
# 类型: XCUIElement*
# 要开始打印的 XCUIElement 元素
Options:
--status-bar/-s # 打印 status bar 的 item
--pointer/-p # 打印 pointer
--traits/-t # 打印 trait
--frame/-f # 打印 frame
Syntax: xnoid [--status-bar] [--pointer] [--traits] [--frame] <element>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBXCTestCommands.py 中被实现为 FBXCNoId
xobject
(lldb) help xobject
# 打印指定的 XCUIElement 类型的 <element> 元素的详细信息
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<element>
# 类型: XCUIElement*
# 要打印详细信息的 XCUIElement 元素
Syntax: xobject <element>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBXCTestCommands.py 中被实现为 FBXCPrintObject
xtree
(lldb) help xtree
# 打印指定的 XCUIElement 类型的 <element> 元素的子树(subtree)
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<element>
# 类型: XCUIElement*
# 要打印子树的 XCUIElement 元素
Options:
--pointer/-p # 打印 pointer
--traits/-t # 打印 trait
--frame/-f # 打印 frame
Syntax: xtree [--pointer] [--traits] [--frame] <element>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBXCTestCommands.py 中被实现为 FBXCPrintTree
zzz
(lldb) help zzz
# 在指定的延迟 <delay in seconds> 之后,执行指定的 LLDB 命令 <lldb command>
# 期望使用原始输入(请参阅 'help raw-input')
Arguments:
<delay in seconds>
# 类型: float
# 执行指定的命令前的等待时间
<lldb command>
# 类型: string
# 在指定的延迟之后,要执行的 LLDB 命令
Syntax: zzz <delay in seconds> <lldb command>
# 此命令在 /usr/local/Cellar/chisel/2.0.1/libexec/commands/FBDelay.py 中被实现为 FBDelay