Slide 1

Slide 1 text

LLDB Khoa Pham - 2359 Media

Slide 2

Slide 2 text

LLDB Home page http://lldb.llvm.org/ LLDB is an open-source debugger that features a REPL, along with C++ and Python plugins

Slide 3

Slide 3 text

Menu - Command - Use cases - Python - Chisel - Standalone

Slide 4

Slide 4 text

Command

Slide 5

Slide 5 text

Command - help Information on any command help print help thread continue help help

Slide 6

Slide 6 text

Command - print Print value print a print self

Slide 7

Slide 7 text

Command Prefix matching print, prin, pri, p expression, e Can’t use pr (print or process?)

Slide 8

Slide 8 text

Command $ variable Anything starting with a dollar sign is in LLDB’ s namespace and exists to help you print $0 + 7

Slide 9

Slide 9 text

Command - expression Evaluate an expression (ObjC++ or Swift) in the current program context, Modify values in the program expression $0 = 10 e $0 = 10

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Command - print object See the description method of an object e -O -- aString po aString

Slide 12

Slide 12 text

Command - variable The variable must start with a dollar sign e NSInteger $b = 10; p $b + a

Slide 13

Slide 13 text

Command - flow Continue process continue, continue, c Step over thread step-over, next, n

Slide 14

Slide 14 text

Command - flow Step into thread step-in, step, s Step out thread step-out, finish

Slide 15

Slide 15 text

Command - thread return Executes the return command, jumping out of the current stack frame thread return YES

Slide 16

Slide 16 text

Breakpoint List breakpoints br li Create breakpoints br set -f ViewController.m 39

Slide 17

Slide 17 text

Use cases Find targets of a button po [self.myButton allTargets]

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

Use cases Change background color without continue e self.view.backgroundColor = [UIColor greenColor] e (void)[CATransaction flush]

Slide 20

Slide 20 text

Use cases Watch variable wivar self _number

Slide 21

Slide 21 text

Python LLDB has full, built-in Python support. If you type script in LLDB, it will open a Python REPL

Slide 22

Slide 22 text

.lldbinit Executed every time LLDB starts command script import /path/to/fblldb.py

Slide 23

Slide 23 text

Chisel brew update brew install chisel # ~/.lldbinit command script import /path/to/fblldb.py

Slide 24

Slide 24 text

Standalone Using LLDB as a Standalone Debugger

Slide 25

Slide 25 text

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