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
New Feature & Tips in LLDB
Search
Toshihiro Morimoto
July 07, 2015
Technology
19k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
New Feature & Tips in LLDB
WWDC2015 情報共有会
Toshihiro Morimoto
July 07, 2015
More Decks by Toshihiro Morimoto
See All by Toshihiro Morimoto
Xcode8 で開発はどうかわったのか
dealforest
10
6.5k
魅せるデバッグ技術
dealforest
4
1.6k
LLDB の世界からみた Swift
dealforest
4
5.5k
Xcode で快適なデバッグライフを追い求める
dealforest
29
25k
Intrducing debug in WWDC2016
dealforest
3
830
swift build と Xcode での Build の違い
dealforest
3
2.2k
RIP Xcode Plugin 🙏
dealforest
0
4.9k
Introducing Xcode Editor Extension
dealforest
2
4.7k
Introducing Anglerfish
dealforest
2
3.6k
Other Decks in Technology
See All in Technology
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
2
650
[しろおび夏祭り2026] チャットするAIから、作業するAIへ - 使われ方の変化と、その裏側で起きていること
kk0n
0
1.7k
AIは実装を速くする。では、私たちは何を今作るべきか?-立場を越えてリリースに向き合ったチーム開発の実践 / 20260801 Hiromi Nakaya and Naoki Takahashi
shift_evolve
PRO
3
450
SO-101×VLAによる3色キューブのピック&プレース
abeja
0
160
Data Hubグループ 紹介資料
sansan33
PRO
0
3.1k
JavaScript 研修 (2026)
recruitengineers
PRO
1
460
もう一度考える SRE チームの作り方・育て方 / Rethinking SRE #1: Building and Growing SRE Teams
rrreeeyyy
6
1k
AI時代の強いチームの作り方
yuukiyo
26
16k
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.4k
Digitization部 紹介資料
sansan33
PRO
2
7.7k
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
670
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
120
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
360
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Unsuck your backbone
ammeep
672
58k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
Amusing Abliteration
ianozsvald
1
240
Ruling the World: When Life Gets Gamed
codingconduct
0
290
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Accessibility Awareness
sabderemane
1
170
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
530
Transcript
New Feature & Tips in LLDB 2015/07/07 WWDC2015 ใڞ༗ձ @dealforest
Toshihiro Morimoto
ࣗݾհ
Crying DFTDebugScreenshot cocoapods-browser Tuna
͓ئ͍
LLDB ͷΛ͢Δͱ λΠϜϥΠϯ͕͓ͱͳ͘͠ͳΓ ޙͰ͜Ή͜ͱʹͳΔͷͰ ͳΜͰ͍͍ͷͰͭͿ͍͍ͯͩ͘͞
402 Whats's new in LLDB Έ·͔ͨ͠ʁʁ
ຖ LLVM ͷ࠷దԽͷ͕ ͍͍ͬͯͨɻɻɻ (ڈͩͱ PGO)
ͱ͜Ζ͕ɺࠓ ηογϣϯͱ͓ͯ͠ LLDB ͷ
ૉΒ͍͠ʂʂʂ
·͓ͣ͑ͯ͘ϙΠϯτʂ p, po alias Έ͍ͨͳͷ
breakpoint breakpoint set -E swift -N allThrows • ݴޠαϙʔτ •
lldbinit ͰॳظઃఆͰ͖ΔΑ͏ʹͳͬͨ
breakpoint ~/.lldbinit breakpoint set -n malloc -N memory breakpoint set
-n free -N memory breakpoint disable memory (lldb) breakpoint enable memory
formatter i = 10 (lldb) p/x i (lldb) expression -format
hex -- i (lldb) frame variable --format hex i (Int) $R2 = 0x000000000000000a
formatting models
formatting models • `frame variable` pure LLDB ͷใΛग़ྗ •
`p` eval ͨ݁͠ՌΛ LLDB format Ͱग़ྗ • `po` eval ͨ݁͠ՌΛݴޠຖʹΑͬͯ ࠷దͳͷΛग़ྗ (objc Ͱ͍͏ description)
runtime (lldb) po for i in 1...3 { print(i) }
1 2 3
It’s All Automatic!!
It’s All Automatic!! in Swift…
҆৺͍ͯͩ͘͠͞
None
Xcode 6.x :PVS$PEF OBNFT .Z'VOD .Z7JFX ✔ 4%,'VODUJPOT /4-PH /4.BLF3FDU
✘ 4%,$MBTTFT /47JFX /4"QQMJDBUJPO ✔ 4%,$POTUBOUT /4"4$**4USJOH&ODPEJOH ✔ .BDSPT */5@."9 ."9 ✘
Xcode 7.x :PVS$PEF OBNFT .Z'VOD .Z7JFX ✔ 4%,'VODUJPOT /4-PH /4.BLF3FDU
✔ 4%,$MBTTFT /47JFX /4"QQMJDBUJPO ✔ 4%,$POTUBOUT /4"4$**4USJOH&ODPEJOH ✔ .BDSPT */5@."9 ."9 ✔
only Swift
type lookup protocol HogeProtocol { func hoge() -> String }
struct Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } }
type lookup protocol HogeProtocol { func hoge() -> String }
struct Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } } (lldb) type lookup Hoge struct Hoge : HogeProtocol { let a: Swift.String let b: Swift.String let c: Swift.String func aa() func ab() func ac() func hoge() -> Swift.String init(a: Swift.String, b: Swift.String, c: Swift.String) } (lldb) type lookup HogeProtocol protocol HogeProtocol { func hoge() -> Swift.String } protocol extension ͋ΕͰ·͢
protocol 4XJGU 4XJGU 1SJOUBCMF $VTUPN4USJOH$POWFSUJCMF %FCVH1SJOUBCMF $VTUPN%FCVH4USJOH$POWFSUJCMF $VTUPN3FqFDUBCMF
protocol 4XJGU 4XJGU 1SJOUBCMF $VTUPN4USJOH$POWFSUJCMF QSJOU %FCVH1SJOUBCMF $VTUPN%FCVH4USJOH$POWFSUJCMF EFCVH1SJOU
$VTUPN3FqFDUBCMF --%# QP
protocol 4XJGU 4XJGU 1SJOUBCMF $VTUPN4USJOH$POWFSUJCMF QSJOU %FCVH1SJOUBCMF $VTUPN%FCVH4USJOH$POWFSUJCMF EFCVH1SJOU
$VTUPN3FqFDUBCMF --%# QP
ͦΕͧΕݟ͍͖ͯ·͠ΐ͏
print protocol HogeProtocol { func hoge() -> String } struct
Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } }
print protocol HogeProtocol { func hoge() -> String } struct
Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } } let hoge = Hoge( a: “aaaaa", b: “bbbbb", c: “ccccccccc" ) print(hoge) —————————————————————————————— > Sample.Hoge(a: "aaaaa", b: "bbbbb", c: “ccccccccc")
debugPrint protocol HogeProtocol { func hoge() -> String } struct
Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } }
debugPrint protocol HogeProtocol { func hoge() -> String } struct
Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } } let hoge = Hoge( a: “aaaaa", b: “bbbbb", c: “ccccccccc" ) debugPrint(hoge) —————————————————————————————— > Sample.Hoge(a: "aaaaa", b: "bbbbb", c: “ccccccccc") ΧελϚΠζ͠ͳ͍ݶΓجຊಉ͡
(lldb) po protocol HogeProtocol { func hoge() -> String }
struct Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } }
(lldb) po protocol HogeProtocol { func hoge() -> String }
struct Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } } let hoge = Hoge( a: “aaaaa", b: “bbbbb", c: “ccccccccc" ) —————————————————————————————— (lldb) po hoge ▿ Sample.Hoge - a : "aaaaa" - b : "bbbbb" - c : "ccccccccc"
(lldb) po protocol HogeProtocol { func hoge() -> String }
struct Hoge: HogeProtocol { let a: String internal let b: String private let c: String func aa() { } internal func ab() { } private func ac() { } func hoge() -> String { return "hoge" } } let hoge = Hoge( a: “aaaaa", b: “bbbbb", c: “ccccccccc" ) —————————————————————————————— (lldb) po hoge ▿ Sample.Hoge - a : "aaaaa" - b : "bbbbb" - c : "ccccccccc" human readable!!!!
ͱ͍͑ LLDB ্Ͱ͔͑͠ͳ͍
ͱ͍͏͜ͱ…
break ͠ͳ͍ͱ͑ͳ͍ͱ͔…(ry
https://github.com/dealforest/Tuna
break ͠ͳ͍ breakpoint Λ ؆୯ʹઃఆͰ͖·͢
None
Swift 2 Λར༻͢Δࡍɹɹɹɹɹɹ ͔ͳΓͤʹͳΕΔΑ
Objective-C ͰͤʹͳΕ·͢
Tips • ηογϣϯຖͷ hisotry ͩͬͨͷ͕ stop / start ͯ͠ΔΑ͏ʹͳͬͨ •
~/.lldbinit-Xcode ΛΈͳ͘ͳͬͨ • all exception breakpoint Debugger command `po $arg1`Λ͠ͱ͚ fatal error message ͕ΈΕΔΑ http://natashatherobot.com/xcode-debugging-trick/
·ͱΊ LLDB ৭ʑਐԽͯ͠ΔͷͰ ৮ͬͯΈΔͱͨͷ͍͠Α
·ͱΊ Tuna Λͬͯ human readable ͳ ग़ྗͰσόοάΛ͠·ͤΜ͔ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠