Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Fancy debug tips with LLDB
Search
Pofat
January 20, 2018
Programming
260
0
Share
Fancy debug tips with LLDB
An introduction about how to use LLDB like a boss.
Pofat
January 20, 2018
More Decks by Pofat
See All by Pofat
從 UIKit 到 SwiftUI 的思維轉移
pofat
1
280
Sequence, Collection and Array in Swift
pofat
0
3.2k
掀起 SWIFT 的面紗
pofat
0
76
Other Decks in Programming
See All in Programming
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.1k
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
280
Kingdom of the Machine
yui_knk
2
1.2k
PHPer、Cloudflare に引っ越す
suguruooki
1
120
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
120
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
160
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.4k
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
410
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
18
7.5k
第3木曜LT会 #28
tinykitten
PRO
0
120
Back to the roots of date
jinroq
0
590
The Less-Told Story of Socket Timeouts
coe401_
3
850
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.2k
Facilitating Awesome Meetings
lara
57
6.8k
Faster Mobile Websites
deanohume
310
31k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Embracing the Ebb and Flow
colly
88
5k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
360
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
200
Un-Boring Meetings
codingconduct
0
280
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Music & Morning Musume
bryan
47
7.2k
Transcript
DEBUG 蕕䌷瞲ܖ ᮎ犚፡蚏㬵ṛ羷ጱLLDBಋ玊 Pofat
LLDB膏౯ҁጱ獮獋ଙ҂
None
None
None
Compiling was like…
矦کSwift 盅…
Print Commands • p , print, call : expression —
• po: expression -O —
Not Only ‘Print Commands’
婘䌃کࠔӞ蟴䌘ܨݢ • 犥ӥ獋ᘏ缛㰷
ݢਯޞ虋碍 $樄毣ԏ虋碍ݢਂࣁෝ lldb ጱ绚樌
ݢਯޞ虋碍
襑ᥝ瞲ਧࣳ獨
襑ᥝ瞲ਧࣳ獨 ObjC Swift
窕纷矒ګ
窕纷矒ګ
thread backtrace
瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html
瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html
Frame
Breakpoints • -n : func or symbol name
• li : list all breakpoints
help & apropos
Who did this?
Print? Think again!
Print? Think again! 暱࿆硲Ԫ֦碁מ牫 กॠᥝӤ娄牧merge盅ጱcode 犋Ꭳ螇ெ讕ԧ 薟䌃ԧ礓㮆 customs view ጱ
_layer
None
Print? Think again! Watchpoint
Better way to log
Better way to log maybe • Breakpoints will minimize the
affect to flow • Need a way to import/export breakpoints
UI 砺֢ - present VC
UI 砺֢ - view hierarchy
Viva la Python
.lldbinit ~/command.py ~/.lldbinit
Chisel
Chisel • border
Chisel • visualize
Chisel • bmessage
Chisel in Swift context • error: error: use of undeclared
identifier ‘CGFloat' • CGFloat is defined by macro in objc. In Swift, it’s not.
Target ~/.lldbinit
瑽 by David Lin
Image lookup
None
None
Image lookup • ݢತᐺ磪 API • 犖ݢࣁ lldb 愊狶 method
swizzling
Image lookup • ݢತᐺ磪 API • 犖ݢࣁ lldb 愊狶 method
swizzling
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
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
Registers • $rsp : head of current frame ( head
is smaller than bottom) • $rbp: bottom of current frame • $rax: Return register
Registers 瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html
瑽ᛔ http://condor.depaul.edu/slytinen/406s16/ch3.html
Witness “Witness Table”
Witness “Witness Table” legs: 8 heads: 2 Metadata Witness Table
Witness “Witness Table” legs: 8 heads: 2 Metadata Witness Table
walk()
Output all current state
薹硯֦ጱᨗᚣ毣
獊ᶎcommand line ࠩ
None
None
Which one is better?
Reference • Dancing in the Debugger - A waltz with
LLDB • ဤ䋊ҁ盄羊䋿ጱӾ㾴硽䋊翕ᒊ҂ • WWDC 2014 Session 410 : Advanced Debugging in LLDB
眤蘛ݱ֖