Slide 1

Slide 1 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 2

Slide 2 text

• ( ) • " •

Slide 3

Slide 3 text

? • Build • Build ! • ઁ؀۽ উؽ ݻ઴ Ҋஜ ࠽٘೧ࠆ !

Slide 4

Slide 4 text

LLVM? LLDB?

Slide 5

Slide 5 text

LLVM? • Low Level Virtual Machine , • Compiler Toolchain • Chris Lattner • Apple Compiler • , • LLVM Core, Clang, LLDB, libc++, compiler-rt ..

Slide 6

Slide 6 text

LLVM? Front-end Optimizer Code Generator IR: Intermediate Representation Source Code Machine Code IR Objective-C: Clang Swift: Swiftc

Slide 7

Slide 7 text

LLDB? • LLVM Debugger Component • C, C++, Objective-C, Swift • Xcode Debugger • LLVM • Clang Expression Parser, LLVM Disassembler

Slide 8

Slide 8 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Beyond “PO” LLDB

Slide 9

Slide 9 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 10

Slide 10 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab

Slide 11

Slide 11 text

watchpoint po breakpoint command apropo alias ivars type lookup sys frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 12

Slide 12 text

watchpoint po breakpoint command apropo alias ivars type lookup sys frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab ? (lldb) help breakpoint (lldb) help breakpoint read

Slide 13

Slide 13 text

watchpoint po breakpoint command apropo alias ivars type lookup sys frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab ? (lldb) apropo “reference count” The following commands may relate to 'reference count': refcount -- Inspect the reference count data for a Swift object

Slide 14

Slide 14 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 15

Slide 15 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Xcode IDE

Slide 16

Slide 16 text

Breakpoint Custom Action ?

Slide 17

Slide 17 text

Breakpoint Option Condition ݅઒ೡ ٸ݅ Break ౠ੿ പࣻ݅ఀ ޖद Action ࣻ೯ റ ೐۽Ӓ۔ ҅ࣘ प೯

Slide 18

Slide 18 text

Custom Action

Slide 19

Slide 19 text

Sharing git

Slide 20

Slide 20 text

Swift Error Breakpoint

Slide 21

Slide 21 text

Swift Error Breakpoint Swift Error Throw - Error Type

Slide 22

Slide 22 text

Exception Breakpoint

Slide 23

Slide 23 text

Exception Breakpoint Exception - Action po $arg1

Slide 24

Slide 24 text

Symbolic Breakpoint

Slide 25

Slide 25 text

Symbolic Breakpoint Break Symbol, Module

Slide 26

Slide 26 text

Symbolic Breakpoint Constraint Conflict : UIViewAlertForUnsatisfiableConstraints 


Slide 27

Slide 27 text

Symbolic Breakpoint Collection View Flow Layout Issue: UICollectionViewFlowLayoutBreakForInvalidSizes

Slide 28

Slide 28 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 29

Slide 29 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Breakpoint , Memory Read/Write Break Code

Slide 30

Slide 30 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Set (lldb) watchpoint set variable -w write user (lldb) w s v self Watchpoint created: Watchpoint 1: addr = 0x7 ee400b168 size = 8 state = enabled type = w declare @ ‘/Users/gaeun/ /ViewController.swift:25’ watchpoint spec = ‘user' new value: 0x00007 ba1506390 - ੌ߈੸ਵ۽ ୭؀ 4ѐө૑ ࢤࢿоמ - 8byteࠁ׮ ੘ইঠ Watch оמ

Slide 31

Slide 31 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Current watchpoints: Watchpoint 1: addr = 0x7 ee400b168 size = 8 state = enabled type = w declare @ ‘/Users/gaeun/ /DebuggingTest/ViewController.swift:25' watchpoint spec = 'self' new value: 0x00007 ba1506390 List (lldb) watchpoint list (lldb) w l

Slide 32

Slide 32 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) watchpoint command add 1 Delete (lldb) watchpoint delete 1 1 watchpoints deleted Command प೯ೡ Command ୶оೞӝ

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Break Command • Backtrace • “bactrace ended”

Slide 35

Slide 35 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 36

Slide 36 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) language swift refcount self (lldb) la s refcount self 
 refcount data: (strong = 1, unowned = 0, weak = 0) Swiftীࢲ݅ ࢎਊоמೠ ݺ۸য

Slide 37

Slide 37 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab

Slide 38

Slide 38 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Module • Module : 
 Code / Plugin / Framework Dynamic Library Image Commandח “target modules”੄ SubCommand۽

Slide 39

Slide 39 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab • Module Symbol 
 • Private 
 Framework 
 Class, Method • Crash Report 
 Backtrace Symbolicating

Slide 40

Slide 40 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Dependency Module • UUID • Memory Address • Path

Slide 41

Slide 41 text

. . .

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Module Symbol (lldb) image dump symtab Alamo re -s adress • Alamo re Symbol

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Symbol Filtering • UINavigationBar “set ” Method 
 (lldb) image lookup -rn ‘\[UINavigationBar\ set\’ 


Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Crash Log Backtrace Symbolicating Last Exception Backtrace: 0 CoreFoundation 0x000000018708b100 0x186f80000 + 1093888 1 libobjc.A.dylib 0x00000001939441fc 0x19393c000 + 33276 2 CoreFoundation 0x000000018708b040 0x186f80000 + 1093696 3 ExampleApp 0x000000010003acc4 0x10002c000 + 60612 StackAddress LoadAddress Offset SlideValue : 32-bitח 0x4000, 64-bitח 0x100000000 FileAddress = StackAddress - LoadAddress + Slide = O set + Slide

Slide 50

Slide 50 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Crash Log Backtrace Symbolicating (lldb) target create --arch arm64 ExampleApp.dSYM Current executable set to ExampleApp.dSYM' (arm64). (lldb) image lookup --address 0x10000ECC4 Address: ExampleApp.dSYM[0x000000010000ecc4] (ExampleApp.dSYM.__TEXT.__text + 29916) Summary: ExampleApp.dSYM`-[ExampleClass buggyFunction] + 68 at ExampleClass.m:181

Slide 51

Slide 51 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab UI Debugging

Slide 52

Slide 52 text

View Hierarchy AutoLayout Trace (lldb) po [[UIWindow keyWindow] _autolayoutTrace]

Slide 53

Slide 53 text

ViewController Hierarchy (lldb) po [UIViewController _printHierarchy]

Slide 54

Slide 54 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab

Slide 55

Slide 55 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) command alias pojc expr -l objc++ -O -- (lldb) command alias “ ”

Slide 56

Slide 56 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab

Slide 57

Slide 57 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab Command , ~/.lldbinit • Custom Command Alias • LLDB Script • Chisel (Facebook)
 https://github.com/facebook/chisel • DerekSelander
 https://github.com/DerekSelander/LLDB

Slide 58

Slide 58 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab Derek Selander https://github.com/DerekSelander/LLDB

Slide 59

Slide 59 text

watchpoint breakpoint help command alias ivars apropo type lookup sbt frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab

Slide 60

Slide 60 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab Protocol Required/Optional Method (Objective-C Only)

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

watchpoint breakpoint help command alias ivars apropo type lookup sbt frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Backtrace Symbolicating (Objective-C Symbol only)

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Keychain DataBase

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab View isHidden Toggle

Slide 67

Slide 67 text

watchpoint po breakpoint help command alias ivars apropo type lookup sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab

Slide 68

Slide 68 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Reference

Slide 69

Slide 69 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab #WWDC16 Debugging Tips and Tricks #WWDC18 Advanced Debugging with Xcode and LLDB Advanced Apple Debugging & Reverse Engineering https://llvm.org/ https://github.com/DerekSelander/LLDB

Slide 70

Slide 70 text

watchpoint po breakpoint help command alias ivars apropo type lookup sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab