Skip to content

Instantly share code, notes, and snippets.

@Gruppio
Last active November 2, 2018 09:24
Show Gist options
  • Save Gruppio/bbdc4b499523a1dd4d7cea2bc734dd3d to your computer and use it in GitHub Desktop.
Save Gruppio/bbdc4b499523a1dd4d7cea2bc734dd3d to your computer and use it in GitHub Desktop.
Advanced debugging with xcode and LLDB - WWDC 2018 - 412 Video Notes

Advanced Debugging Tips And Tricks

  • Configure behaviors to dedicate a tab for debugging
  • LLDB expressions can modify program state
  • Use auto-continuing breakpoints with debugger commands to inject code live Create dependent breakpoints using breakpoint set * --one-shot true
  • 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>
  • 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 🚽 expression -l objc -- (void)[CATransaction flush]
    • The nudge LLDB script will be available from the session website
 https://developer.apple.com/wwdc18/412
Command Alias for Steps to evaluate
po <expression> expression --object-description -- <expression> 1) Expression: evaluate <expression>
2) Expression: debug description
p <expression> expression -- <expression> 1) Expression: evaluate <expression>
2) Outputs LLDB-formatted description
frame variable <name> 1) Reads value of <name> from memory
2) Outputs LLDB-formatted description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment