$30 off During Our Annual Pro Sale. View Details »

LLDB

Khoa Pham
August 27, 2015

 LLDB

Tips on using LLDB

Khoa Pham

August 27, 2015
Tweet

More Decks by Khoa Pham

Other Decks in Programming

Transcript

  1. LLDB Khoa Pham - 2359 Media

  2. LLDB Home page http://lldb.llvm.org/ LLDB is an open-source debugger that

    features a REPL, along with C++ and Python plugins
  3. Menu - Command - Use cases - Python - Chisel

    - Standalone
  4. Command

  5. Command - help Information on any command help print help

    thread continue help help
  6. Command - print Print value print a print self

  7. Command Prefix matching print, prin, pri, p expression, e Can’t

    use pr (print or process?)
  8. Command $ variable Anything starting with a dollar sign is

    in LLDB’ s namespace and exists to help you print $0 + 7
  9. Command - expression Evaluate an expression (ObjC++ or Swift) in

    the current program context, Modify values in the program expression $0 = 10 e $0 = 10
  10. Command - print 'print' is an abbreviation for 'expression --'.

    Use -- to signify the end of the flags and the beginning of the input e --location -- -count
  11. Command - print object See the description method of an

    object e -O -- aString po aString
  12. Command - variable The variable must start with a dollar

    sign e NSInteger $b = 10; p $b + a
  13. Command - flow Continue process continue, continue, c Step over

    thread step-over, next, n
  14. Command - flow Step into thread step-in, step, s Step

    out thread step-out, finish
  15. Command - thread return Executes the return command, jumping out

    of the current stack frame thread return YES
  16. Breakpoint List breakpoints br li Create breakpoints br set -f

    ViewController.m 39
  17. Use cases Find targets of a button po [self.myButton allTargets]

  18. Use cases See the frame po self.view.frame e @import UIKit

    po self.view.frame
  19. Use cases Change background color without continue e self.view.backgroundColor =

    [UIColor greenColor] e (void)[CATransaction flush]
  20. Use cases Watch variable wivar self _number

  21. Python LLDB has full, built-in Python support. If you type

    script in LLDB, it will open a Python REPL
  22. .lldbinit Executed every time LLDB starts command script import /path/to/fblldb.py

  23. Chisel brew update brew install chisel # ~/.lldbinit command script

    import /path/to/fblldb.py
  24. Standalone Using LLDB as a Standalone Debugger

  25. References - Getting Started with LLDB - Dancing in the

    Debugger — A Waltz with LLDB - Video Tutorial: Using LLDB in iOS - Navigating and discovering an iOS codebase using lldb - chisel