Debug

Sep 19, 2018


Debug

  • Create dependent breakpoints using breakpoint set --one-shot true --name "funcName"

  • po $arg1 ($arg2, etc) in assembly frames to print function arguments

  • Skip lines of code by dragging Instruction Pointer or thread jump --by 1

  • Pause when variables are modified by using watchpoints

  • Evaluate Obj-C code in Swift frames with expression -l objc -O -- <expr>

  • In swift module, use expression -objc -O -- [`self.view` recursiveDescription] get the view recursive description.

  • Flush view changes to the screen using expression CATransaction.flush()

  • Add custom LLDB commands using aliases and scripts. Alias examples: command alias poc expression -l objc -O -- command alias caflush expression -l objc -- (void)[CATransaction flush]

  • use func unsafeBitCast<T, U>(_ x: T, to type: U.Type) -> U to make address to objc.

添加自定义的command

Add to ~/.lldbinit:

command script import ~/path/to/nudge.py
command alias poc expression -l objc -O --
command alias caflush expression -l objc -- (void)[CATransaction flush]