Slide 1

Slide 1 text

DEBUG 蕕䌷瞲ܖ ᮎ犚፡蚏㬵ṛ羷ጱLLDBಋ玊 Pofat

Slide 2

Slide 2 text

LLDB膏౯ҁጱ獮獋ଙ҂

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Compiling was like…

Slide 7

Slide 7 text

矦کSwift 盅…

Slide 8

Slide 8 text

Print Commands • p , print, call : expression —
 
 • po: expression -O —
 
 


Slide 9

Slide 9 text

Not Only ‘Print Commands’

Slide 10

Slide 10 text

婘䌃کࠔӞ蟴䌘ܨݢ • 犥ӥ獋ᘏ缛㰷
 
 
 


Slide 11

Slide 11 text

ݢਯޞ虋碍 $樄毣ԏ虋碍ݢਂࣁෝ lldb ጱ绚樌

Slide 12

Slide 12 text

ݢਯޞ虋碍

Slide 13

Slide 13 text

襑ᥝ瞲ਧࣳ獨

Slide 14

Slide 14 text

襑ᥝ瞲ਧࣳ獨 ObjC Swift

Slide 15

Slide 15 text

窕纷矒ګ

Slide 16

Slide 16 text

窕纷矒ګ

Slide 17

Slide 17 text

thread backtrace

Slide 18

Slide 18 text

瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html

Slide 19

Slide 19 text

瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html

Slide 20

Slide 20 text

Frame

Slide 21

Slide 21 text

Breakpoints • -n : func or symbol name
 
 
 
 • li : list all breakpoints
 
 


Slide 22

Slide 22 text

help & apropos

Slide 23

Slide 23 text

Who did this?

Slide 24

Slide 24 text

Print? Think again!

Slide 25

Slide 25 text

Print? Think again! 暱࿆硲Ԫ֦碁מ牫
 กॠᥝӤ娄牧merge盅ጱcode 犋Ꭳ螇ெ讕ԧ
 薟䌃ԧ礓㮆 customs view ጱ _layer

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Print? Think again! Watchpoint

Slide 28

Slide 28 text

Better way to log

Slide 29

Slide 29 text

Better way to log maybe • Breakpoints will minimize the affect to flow • Need a way to import/export breakpoints
 
 


Slide 30

Slide 30 text

UI 砺֢ - present VC

Slide 31

Slide 31 text

UI 砺֢ - view hierarchy

Slide 32

Slide 32 text

Viva la Python

Slide 33

Slide 33 text

.lldbinit ~/command.py ~/.lldbinit

Slide 34

Slide 34 text

Chisel

Slide 35

Slide 35 text

Chisel • border
 
 
 
 
 
 
 
 
 


Slide 36

Slide 36 text

Chisel • visualize
 
 
 
 
 
 
 
 
 


Slide 37

Slide 37 text

Chisel • bmessage
 
 
 
 
 
 
 
 
 


Slide 38

Slide 38 text

Chisel in Swift context • error: error: use of undeclared identifier ‘CGFloat' • CGFloat is defined by macro in objc. In Swift, it’s not.


Slide 39

Slide 39 text

Target ~/.lldbinit

Slide 40

Slide 40 text

瑽 by David Lin

Slide 41

Slide 41 text

Image lookup

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Image lookup • ݢತᐺ磪 API • 犖ݢࣁ lldb 愊狶 method swizzling
 
 
 


Slide 45

Slide 45 text

Image lookup • ݢತᐺ磪 API • 犖ݢࣁ lldb 愊狶 method swizzling
 
 
 


Slide 46

Slide 46 text

Registers • $rip : Current instruct pointer • $rdi: First argument • $rsi, $rdx, $rcx, $R8, $R9: Second, third, forth, fifth and sixth arguments • Others will be on stack

Slide 47

Slide 47 text

Registers • $rip : Current instruct pointer • $rdi: First argument • $rsi, $rdx, $rcx, $R8, $R9: Second, third, forth, fifth and sixth arguments • Others will be on stack

Slide 48

Slide 48 text

Registers • $rsp : head of current frame ( head is smaller than bottom) • $rbp: bottom of current frame • $rax: Return register

Slide 49

Slide 49 text

Registers 瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html

Slide 50

Slide 50 text

瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html

Slide 51

Slide 51 text

Witness “Witness Table”

Slide 52

Slide 52 text

Witness “Witness Table” legs: 8 heads: 2 Metadata Witness Table

Slide 53

Slide 53 text

Witness “Witness Table” legs: 8 heads: 2 Metadata Witness Table walk()

Slide 54

Slide 54 text

Output all current state

Slide 55

Slide 55 text

薹硯֦ጱᨗᚣ毣

Slide 56

Slide 56 text

獊ᶎcommand line ࠩ

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Which one is better?

Slide 60

Slide 60 text

Reference • Dancing in the Debugger - A waltz with LLDB • ဤ䋊ҁ盄羊䋿ጱӾ㾴硽䋊翕ᒊ҂ • WWDC 2014 Session 410 : Advanced Debugging in LLDB

Slide 61

Slide 61 text

眤蘛ݱ֖