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
Control Planeで育てるBtoB SaaSの認証基盤 - SRE NEXT 2026
pokohide
1
2.6k
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
330
Kaggleで成長するために意識したこと
prgckwb
2
420
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
160
kaonavi Tech Night#1
kaonavi
0
110
“それは自分の仕事じゃない"を越えて行け
yuukiyo
1
480
AI x 開発生産性を取り巻く予算戦略と投資対効果
i35_267
1
130
2年前に削除したPHPクラスが、 ある日突然決済をエラーにした
ykagano
1
390
「AIに依存している」と 「AIを使いこなしている」の違い
k8yasuma
0
120
ヘルスケア領域における AI 活用と その安全性担保のための取り組み (Leveraging AI in Healthcare and Our Efforts to Ensure Its Safety) - Google I/O Extended Tokyo 2026, July 11, 2026
zettaittenani
0
430
企業でAWS Organizationsを動かすための組織設計の考え方
nrinetcom
PRO
1
110
大量データに対しても、生成AIを用いてリーズナブルにデータ加工をしたい!Databricksのai_queryについて調べてみた
kamoshika
1
220
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1370
210k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
410
The Spectacular Lies of Maps
axbom
PRO
1
860
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
390
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Paper Plane
katiecoart
PRO
2
52k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
400
Practical Orchestrator
shlominoach
191
11k
Code Review Best Practice
trishagee
74
20k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
The Limits of Empathy - UXLibs8
cassininazir
1
500
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 ͳ ग़ྗͰσόοάΛ͠·ͤΜ͔ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠