iOS.Debug.LLDB-1
0. lldb的帮助
(lldb) help
显示lldb的命令
(lldb) help command
显示某个命令的帮助
(lldb) help command subcommand
显示命令的子命令的帮助
1. 使用lldb的断点(breakpoint)
1.1 通过在IDE中在每行代码前点击进行添加断点
1.2 在Console中使用breakpoint命令来设置断点
在App Run之后,"Debug"->"Pause" 菜单项使App暂停,此时Console出现 "(lldb)" 提示符(如下):
(lldb) breakpoint set -r "didSelectRow"
以上语句添加了一个正则表达式断点,为每个含有"didSelectRow"的方法添加一个断点。Ref[3]
(lldb) help breakpoint set
该语句可以查看"breakpoint set"的帮助。
(lldb) breakpoint set -o -r "didSelectRow"
flag -o:
-o ( --one-shot )
The breakpoint is deleted the first time it causes a stop.
1.3 为属性添加断点
查看某个属性什么时候被使用,可以直接在下面的这行设置断点。
@property (assign, nonatomic) CGPoint center;
2. watchpoint
A set of commands for operating on watchpoints.
Ref[9] Ref[1.3]
watchpoint:观察某个变量的值,当发生对该变量的写操作时,就会停下来。
(lldb) watchpoint set variable cityId
3. Debug UI
3.1 方法recursiveDescription的使用
Ref[7]
3.2 lldb
Ref[6]
Reference
1. lldb和GDB命令对照
1.1 http://lldb.llvm.org/lldb-gdb.html
1.2 http://lldb.llvm.org/docs.html
1.3 http://lldb.llvm.org/tutorial.html (ToRead)
2. WWDC 2012 Session 415 Debugging with LLDB
3. Navigating and discovering an iOS codebase using lldb
https://medium.com/ios-os-x-development/navigating-and-discovering-a-code-base-using-lldb-bca7c10115cf
4. Technical Note TN2239: iOS Debugging Magic (ToRead)
https://developer.apple.com/library/ios/technotes/tn2239/_index.html#//apple_ref/doc/uid/DTS40010638-CH1-SECTION39%23Intel%2032-Bit
5. iOS ABI Function Call Guide (ToRead)
https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Introduction/Introduction.html
6. Dancing in the Debugger — A Waltz with LLDB (ReadAgain)
7. Output view hierarchy in LLDB
http://shaunseo.com/output-view-hierarchy/
http://jeffreysambells.com/2013/01/24/debugging-layouts-with-recursive-view-descriptions-in-xcode
http://stackoverflow.com/questions/5150186/how-do-i-inspect-the-view-hierarchy-in-ios
Debug Area Help
https://developer.apple.com/library/ios/recipes/xcode_help-debugger/using_view_debugger/using_view_debugger.html
8. Debugging: A Case Study (AAAAA) (ToRead)
http://www.objc.io/issue-19/debugging-case-study.html
9. How do I have a breakpoint get triggered if an instance variable in the class has its value changed?
(未完待续)
10.
https://www.slideshare.net/micheletitolo/more-than-po-debugging-in-lldb-78570000