Guest User

Untitled

a guest
Feb 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. ### lldb command
  2.  
  3. #### lldb
  4. * attach to an app in a new LLDB terminal window
  5. `lldb -n SpringBoard`
  6.  
  7. #### breakpoint
  8. * 在指定的代码文件`ViewController.swift`中的所有包含有`if let`的代码处添加断点:
  9. `breakpoint set -p "if let" -f ViewController.swift -f`
  10.  
  11. * 轻松查看所有断点,使用`-b`参数,`brief flag`:
  12. `breakpoint list 1 -b`
  13.  
  14. #### image
  15.  
  16. * 用于精确的搜索方法或者是标志在framework中的位置
  17. `image lookup -n "-[UIViewController viewDidLoad]"`
  18.  
  19. * 正则搜索
  20. `image lookup -rn App.ClassName.property.setter`
  21.  
  22. * `rlook test` 等价于 `image lookup -rn abc`
  23.  
  24. * 当某个模块已经被加载入当前的进程中,可用`image list`找到当前模块所在的路径
  25. `image list SomeModule`
  26.  
  27.  
  28. #### expression
  29. * 使用`po`打印对象输出的是它`debugDescripation`的内容
  30. * `po`所在的语言环境是取决于当前所在的上下文
  31. * `expression -l objc -O -- test`
  32. * `expression -l swift -O -- test`
  33. * 在`lldb`中创建属性,使用`$`:
  34.  
  35. ```
  36. (lldb) po id $test = [NSObject new];
  37. (lldb) po $test
  38. <NSObject: 0x60000001d190>
  39. ```
  40.  
  41. #### command regex
  42. 格式:`command regex -- test s/<regex>/<subst>/`
  43. 例子:
  44.  
  45. ```
  46. (lldb) command regex -- tv 's/(.+)/expression -l objc -O -- @import QuartzCore; [%1 setHidden:!(BOOL)[%1 isHidden]]; (void)[CATransaction flush];/”
  47.  
  48. “Advanced Apple Debugging”
  49. ```
Add Comment
Please, Sign In to add comment