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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
140
千葉での単身赴任からAWSをやり続け、千葉に戻ってきた話
yama3133
1
120
元・セキュリティ学習経験0大学生による業務紹介 / An Introduction to the Job by a Former College Student with Zero Security Training Experience
nttcom
0
150
AIチャット検索改善の3週間
kworkdev
PRO
2
170
WebGIS AI Agentの紹介
_shimizu
0
560
現場のトークンマネジメント
dak2
1
190
元銀行員がAIだけでアプリを量産!「バイブコーディング実演セミナー 」
tatsuya1970
0
110
4人目のSREはAgent
tanimuyk
0
170
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
0
810
When Platform Engineering Meets GenAI
sucitw
0
170
スタートアップにAmazon EKSは早すぎる? マルチプロダクト戦略を加速する Platform Engineeringの実践 / Is Amazon EKS Too Soon for Startups? Practical Platform Engineering to Accelerate a Multi-Product Strategy
elmodev09
1
1.8k
AIAU_UMEMOGU_ninomiya_slide
ninomiya_ii
0
260
Featured
See All Featured
Test your architecture with Archunit
thirion
1
2.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
370
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
170
Tell your own story through comics
letsgokoyo
1
960
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
210
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
220
Mobile First: as difficult as doing things right
swwweet
225
10k
Automating Front-end Workflow
addyosmani
1370
210k
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 ͳ ग़ྗͰσόοάΛ͠·ͤΜ͔ʁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠