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
0
260
Fancy debug tips with LLDB
An introduction about how to use LLDB like a boss.
Pofat
January 20, 2018
Tweet
Share
More Decks by Pofat
See All by Pofat
從 UIKit 到 SwiftUI 的思維轉移
pofat
1
230
Sequence, Collection and Array in Swift
pofat
0
3.1k
掀起 SWIFT 的面紗
pofat
0
72
Other Decks in Programming
See All in Programming
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
640
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
5つのアンチパターンから学ぶLT設計
narihara
1
160
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
200
CursorはMCPを使った方が良いぞ
taigakono
1
240
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
690
RailsGirls IZUMO スポンサーLT
16bitidol
0
170
PipeCDのプラグイン化で目指すところ
warashi
1
260
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
160
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
70
22k
技術同人誌をMCP Serverにしてみた
74th
1
630
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
39
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
730
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Documentation Writing (for coders)
carmenintech
72
4.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Making Projects Easy
brettharned
116
6.3k
How STYLIGHT went responsive
nonsquared
100
5.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
A better future with KSS
kneath
239
17k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
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
眤蘛ݱ֖