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
タスクの複雑さでモデルを選ぶ ── Thompson Samplingで動かす“トークン/コスト最適化
satohy0323
0
570
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
280
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
430
LLMやAIエージェントをソフトウェアに組み込むプラクティス
shibuiwilliam
2
420
公式ドキュメントの歩き方etc
coco_se
1
120
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
330
AI Driven AI Governance
pict3
0
490
Amazon EVS で VCF 9.0 / 9.1 のサポート開始まとめ
mtoyoda
0
310
AIレビューはどこまで任せられるのか?自動化と人が背負うレビューの境界
sansantech
PRO
3
1.1k
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
5.1k
Terraform共通モジュールをチーム横断で“変えられる”運用へ ― リリースと適用の分離
kekke_n
1
3.4k
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
250
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
How GitHub (no longer) Works
holman
316
150k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Mind Mapping
helmedeiros
PRO
1
280
Raft: Consensus for Rubyists
vanstee
141
7.6k
The Curious Case for Waylosing
cassininazir
1
430
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 ͳ ग़ྗͰσόοάΛ͠·ͤΜ͔ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠