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
260
Sequence, Collection and Array in Swift
pofat
0
3.2k
掀起 SWIFT 的面紗
pofat
0
73
Other Decks in Programming
See All in Programming
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
460
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
160
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
150
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
140
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
200
これならできる!個人開発のすゝめ
tinykitten
PRO
0
140
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
310
Cell-Based Architecture
larchanjo
0
160
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
130
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
240
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
210
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
180
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Unsuck your backbone
ammeep
671
58k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
180
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Darren the Foodie - Storyboard
khoart
PRO
0
2.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
250
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Technical Leadership for Architectural Decision Making
baasie
0
200
Designing Experiences People Love
moore
143
24k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
110
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
眤蘛ݱ֖