2019独角兽企业重金招聘Python工程师标准>>>

Xcode's debugging console window is a full-featured LLDB debugging console. When your app is paused(at a breakpoint), the debugging console shows the LLDB command prompt. You can type any LLDB debugger common into the console to help you with debugging, including loading external python script.

The most frequently used command is po, which stands for print object. When your application is paused in debugger, you can print any variable that is in the current scope. This includes any stack variables, class variables, properties, ivars, and global variables. In short, any variable that is accessible by your application at the breakpoint can be accessed via the debugging console.

Printing scalar variables

when you're dealing with scalars like integers or structs(CGRect, CGPoint, etc..), instead of using po, you use p, followed by the type of struct.

p (int) self.myAge

p (CGPoint) self.view.center

Printing Registers

Registers in your CPU are used for storing variables that have to be accessed frequently. Compilers optimize frequently used variables like the loop variable, method arguments, and return variables in the registers. When your app crashes for no apparent reason, probing the register for the method name or the selector name that crashed your app will be very useful.

(lldb) register read

General Purpose Registers:

r0 = 0x37c9cb21  libobjc.A.dylib`objc_msgSend + 1

r1 = 0x37c9cb21  libobjc.A.dylib`objc_msgSend + 1

r2 = 0x01b5c214  "idKey"

r3 = 0x01b5eb28  "checkCurrentContactBean"

r4 = 0x00000000

r5 = 0x37c9cb21  libobjc.A.dylib`objc_msgSend + 1

r6 = 0x27d09bd0

r7 = 0x27d09bc8

r8 = 0x01b5bbc4  "view"

r9 = 0x00000000

r10 = 0x01b5e3f8  "masterViewController"

r11 = 0x00000000

r12 = 0x3a11c1d0  (void *)0x382c3959: _os_lock_handoff_unlock$VARIANT$mp + 1

sp = 0x27d09358

lr = 0x37cacabb  libobjc.A.dylib`objc_object::sidetable_release(bool) + 95

pc = 0x002cce40  iPoS_IOS`-[PersonMainForm viewWillAppear:] + 232 at PersonMainForm.m:59

cpsr = 0x60000030

Your output may vary, butt pay close attention to the wax, dcx, and esi on the simulator or r0-r4 registers when running on a device. These registers store some of the values that you're interested in. In the Simulator, the dcx register holds the name of the selector that is called when your app crashed. You print an individual register to console by specifying the register name as shown below

register read ecx.

You can also specify multiple registers like

register  read eax ecx.

The dcx register on Intel architecture and the r15 register on ARM architecture hold the program counter. Printing the address of the program counter will show the last executed instruction. Similarly, wax(r0 on ARM) holds the receiver address, ecx (r4 on ARM) and holds the selector that was called last. The arguments to the methods are stored in registers r1-r3. If your selector has more than three arguments, they are stored on stack, accessible via the stack pointer(r13). sp, lr, and pc are actually aliases to the r13,r14 and r15 register, respectively. Hence, register read r13 is equivalent to register read sp.

转载于:https://my.oschina.net/u/566401/blog/174337

iOS LLDB console debug总结相关推荐

  1. iOS子构建Debug运行正常Release运行失败,提示证书问题

    iOS子构建Debug运行正常Release运行失败,提示证书问题 在老版本的Xcode上创建子构建时会自动创建对应的证书和描述文件,但是在Xcode12上不会自动创建Release对应的证书和描述文 ...

  2. js console.log和console.info与console.debug的区别

    1: console.log和console.info与console.debug的区别 console.log().console.info()与console.debug()都是在控制台中打印信息 ...

  3. iOS LLDB调试命令(Low Lever Debug)

    断点 设置断点 $breakpoint set -n XXX set 是子命令 -n 是选项 是--name 的缩写! 查看断点列表 $breakpoint list 删除 $breakpoint d ...

  4. 我在CSDN的第一篇博客-iOS开发-关于Debug的一些技巧(NSLog方面)

    唠叨几句 本来想写点感言的,不过想了想觉得有点儿矫情,还是算了.开博客原因很简单,就是想锻炼一下自己表达能力,并且总结一些需要积累的东西. 第一篇博客,还是写点有用的东西吧. 刚刚看到的一篇关于Deb ...

  5. android lldb断点,iOS lldb断点调试

    Xcode的使用中总是离不开调试这个环境,在一年多的iOS开发时间中,我更多地依赖于XCode本身提供的GUI工具来进行调试,而对LLDB敬而远之,这段时间好好学习了LLDB的使用,发觉我错过了太多东 ...

  6. iOS lldb调试

    LLDB 初始 LLDB 是一个有着 REPL 的特性和 C++ ,Python 插件的开源调试器.LLDB 绑定在 Xcode 内部,存在于主窗口底部的控制台中.调试器允许你在程序运行的特定时暂停它 ...

  7. IOS开发-如何debug及处理闪退

    我只写些相对来说,比较有用的信息,想完整阅读的,可以自行去原文.. 原文来自:http://www.raywenderlich.com/10209/my-app-crashed-now-what-pa ...

  8. iOS LLDB调试精解

    小笨狼与LLDB: http://jiangliancheng.gitcafe.io/2015/12/13/%E5%B0%8F%E7%AC%A8%E7%8B%BC%E4%B8%8ELLDB%E7%9A ...

  9. iOS debug神器

    推荐两款iOS 在手机端debug 工具, 可以查看日志,抓包(https你懂的!),UI控件查看,调试等.DoraemonKit , 啄木鸟(阿里巴巴开源),Flex(开源),iOSer debug ...

最新文章

  1. 小程序 navigator 无法跳转 tabBar上的页面
  2. Linux内核--网络栈实现分析(三)--驱动程序层+链路层(上)
  3. Apache Kafka-事务消息的支持与实现(本地事务)
  4. Intellij Idea/Webstorm/Phpstorm 的高效快捷键
  5. 1.1.1 从简单的数据类型开始
  6. java中文乱码解决之道(五)—–java是如何编码解码的
  7. ast.literal_eval(转)
  8. [转载] 列表、元组及通用序列操作
  9. centos php fpm 停止_如何关闭php-fpm进程?
  10. 橡皮擦的英语_从填字涂鸦到英语启蒙,家长口中的儿童版“秘密花园”涂色游戏测评【玩具测评】...
  11. TensorFlow tf.keras.layers.conv2D
  12. pytorch教程:save and load
  13. 2020牛客多校训练1 I 1or2(拆点拆边带花树一般图最大匹配)
  14. matlab的矩阵运算,MATLAB的矩阵运算
  15. C语言 线程 进程 优先级,C++线程优先级SetThreadPriority的使用实例
  16. springboot毕业设计题目课题参考
  17. 命名空间“System”中不存在类型或命名空间名“Data”
  18. lizard的基本使用
  19. 30分钟理解关键链--《突破项目的瓶颈--关键链 》读书笔记
  20. elasticSearch Analysis Token Filters作用及相关样例

热门文章

  1. python爬取淘宝数据魔方_淘宝数据魔方技术架构解析
  2. python项目开发案例集锦_在线分享 | 在 VS Code 中一站式完成 Python 项目开发
  3. Golang——数据类型使用细节详解
  4. or函数 java_Java OptionalInt orElseGet()用法及代码示例
  5. c语言opengles程序,OpenGL ES _ 着色器_程序
  6. n个骰子的点数 java_n个骰子的点数和为s的概率集合输出(Java)
  7. php实现购物车 redis,redis 哈希数据类型简单操作(实现购物车案例)
  8. java mock server_java – 使用MockRestServiceServer模拟REST调用
  9. 方法论:如何从0到1搭建一套完整的邀请体系
  10. 面试中这样自我介绍更能抓住面试官的耳朵