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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
270
Sequence, Collection and Array in Swift
pofat
0
3.2k
掀起 SWIFT 的面紗
pofat
0
74
Other Decks in Programming
See All in Programming
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
480
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
880
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
180
AI Assistants for YourAngular Solutions @Angular Graz, March 2026
manfredsteyer
PRO
0
130
Ruby and LLM Ecosystem 2nd
koic
1
1.4k
Tamach-sre-3_ANDPAD-shimaison93
mane12yurks38
0
210
Rethinking API Platform Filters
vinceamstoutz
0
4.2k
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
150
ロボットのための工場に灯りは要らない
watany
12
3.2k
モダンOBSプラグイン開発
umireon
0
190
The free-lunch guide to idea circularity
hollycummins
0
390
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
330
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.6k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
420
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
190
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
350
How to build a perfect <img>
jonoalderson
1
5.3k
Music & Morning Musume
bryan
47
7.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Cult of Friendly URLs
andyhume
79
6.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
96
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
250
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
眤蘛ݱ֖