同样常用的expression简写命令还有po和call 。其中po表示print object,用来打印对象,call用来调用某个方法 。示例如下:
文章插图
- (lldb) expression -- self.view
- (UIView *) $4 = 0x00007f8ca8401690
- (lldb) e self.view
- (UIView *) $5 = 0x00007f8ca8401690
- (lldb) p self.view
- (UIView *) $6 = 0x00007f8ca8401690
- (lldb) po self.view
- <UIView: 0x7f8ca8401690; frame = (0 0; 375 812); autoresize = W+H; layer = <CALayer: 0x6000008a1dc0>>
- (lldb) call self.view
- (UIView *) $8 = 0x00007f8ca8401690
- p/x //!< 以十六进制打印整数
- p/d //!< 以带符号的十进制打印整数
- p/u //!< 以无符号的十进制打印整数
- p/o //!< 以八进制打印整数
- p/t //!< 以二进制打印整数
- p/a //!< 以十六进制打印地址
- p/c //!< 打印字符常量
- p/f //!< 打印浮点数
- p/s //!< 打印字符串
- p/r //!< 格式化打印
示例如下:
文章插图
- (lldb) p count
- (NSUInteger) $0 = 10
- (lldb) p/t count
- (NSUInteger) $1 = 0b0000000000000000000000000000000000000000000000000000000000001010
- (lldb) p/o count
- (NSUInteger) $2 = 012
- (lldb) p/x count
- (NSUInteger) $3 = 0x000000000000000a
- (lldb) p/x string
- (__NSCFConstantString *) $4 = 0x000000010416a0b8 @"QiShare"
- (lldb) p/c string
- (__NSCFConstantString *) $5 = xb8xa0x16x04x01 @"QiShare"
- (lldb) p/s string
- (__NSCFConstantString *) $6 = @"QiShare"
- (lldb) p/a string
- (__NSCFConstantString *) $7 = 0x000000010416a0b8 @"QiShare" @"QiShare"
thread是线程相关的命令,语法为thread [],它可以接受不同的可选参数,以实现丰富的功能 。其中thread list、thread backtrace和thread return较为常用 。
开发者可以使用thread list命令查看当前的所有线程,示例如下:
- (lldb) thread list
- Process 4031 stopped
- * thread #1: tid = 0x25cac, 0x0000000104167e23 QiDebugDemo`-[QiConsoleViewController testLLDBCommands](self=0x00007f850df0bbf0, _cmd="testLLDBCommands") at QiConsoleViewController.m:34, queue = 'com.apple.main-thread', stop reason = breakpoint 4.1
- thread #2: tid = 0x25d2f, 0x00000001079ff28a libsystem_kernel.dylib`__workq_kernreturn + 10
- thread #3: tid = 0x25d30, 0x00000001079ff28a libsystem_kernel.dylib`__workq_kernreturn + 10
- thread #4: tid = 0x25d31, 0x00000001079ff28a libsystem_kernel.dylib`__workq_kernreturn + 10
- thread #5: tid = 0x25d32, 0x00000001079ff28a libsystem_kernel.dylib`__workq_kernreturn + 10
- thread #6: tid = 0x25d33, 0x00000001079ff28a libsystem_kernel.dylib`__workq_kernreturn + 10
- thread #7: tid = 0x25d3e, 0x00000001079f520a libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.uikit.eventfetch-thread'
推荐阅读
- iOS系统的底层通知框架库
- 手机信号栏常用“符号”大揭秘!
- WordPress常用的函数、方法汇总
- 5种最常用的黑客工具,以及如何防御
- iOS13新增重磅功能!不止续航改善,这两个功能才是王炸
- HTML5网页录音和上传到服务器,支持PC、Android,支持IOS微信
- python中全部关于字符串常用操作的总结
- ios13闪退怎么解决
- 常用架构模式
- 苹果手机微信表情特效怎么弄的 ios微信新表情