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
820
swift build と Xcode での Build の違い
dealforest
3
2.1k
RIP Xcode Plugin 🙏
dealforest
0
4.9k
Introducing Xcode Editor Extension
dealforest
2
4.7k
Introducing Anglerfish
dealforest
2
3.5k
Other Decks in Technology
See All in Technology
BPaaSで進むAIオペレーションの現在地 AI実装が効く領域とスケーラビリティの選定と実装
kentarofujii
0
180
クラウドファンディング版StackChan 3体(4体)をインタラクティブな体験型作品にして展示もした話 / スタックチャンお誕生日会2026
you
PRO
0
180
【FinOps】データドリブンな意思決定を目指して
z63d
0
330
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
120
コミットの「なぜ」を読む
ota1022
0
120
AI-DLCを “そのまま導入しなかった”話 ~組織に合わせてアジャストした 私たちの実践共有~
hiroramos4
PRO
1
430
2026 AI Memory Architecture
nagatsu
0
190
【セミナー資料】Claude Code をセキュアに使うための考え方と設定の勘どころ / Claude Code Webinar 20260616
masahirokawahara
2
470
WebGIS AI Agentの紹介
_shimizu
0
560
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
120
螺旋型キャリアの生存戦略 / kinoko-conf2026
rakus_dev
1
970
MUSUBI 田中裕一『AIと共に行う「しごとのリデザイン」- スモールバックオフィス編』AI Ops Lab #4
musubi
0
310
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
490
Test your architecture with Archunit
thirion
1
2.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
590
For a Future-Friendly Web
brad_frost
183
10k
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 ͳ ग़ྗͰσόοάΛ͠·ͤΜ͔ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠