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
Debugging in Swift
Search
Carola Nitz
March 22, 2015
Technology
19
23k
Debugging in Swift
This talk will give you some helpful tips and tricks when you struggle with Debugging
Carola Nitz
March 22, 2015
Tweet
Share
More Decks by Carola Nitz
See All by Carola Nitz
Beware of the legacy! The one you inherit and the one you create
carola
0
210
Debugging - Things your senior hasn't told you about
carola
6
1.9k
Code Snippets for Debugging
carola
1
260
Other Decks in Technology
See All in Technology
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
670
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
12
3.5k
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
250
UI State設計とテスト方針
rmakiyama
2
390
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
ハイテク休憩
sat
PRO
2
140
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Become a Pro
speakerdeck
PRO
26
5k
We Have a Design System, Now What?
morganepeng
51
7.3k
Designing for Performance
lara
604
68k
How to Ace a Technical Interview
jacobian
276
23k
Building an army of robots
kneath
302
44k
Thoughts on Productivity
jonyablonski
67
4.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Unsuck your backbone
ammeep
669
57k
Transcript
Debugging in Swift how hard can it be @_Caro _N,
22/3/2015
Why do we struggle with debugging? @_Caro _N, 22/3/2015
Output is not helpful (lldb) po objectiveCString 0x00007fbaa1f24910 (ObjectiveC.NSObject =
{}) @_Caro _N, 22/3/2015
Error messages make no sense @_Caro _N, 22/3/2015
What?! That tool exists? @_Caro _N, 22/3/2015
How debugging should be like • Get to the content
of interest @_Caro _N, 22/3/2015
How debugging should be like • Get to the content
of interest • Get helpful error messages @_Caro _N, 22/3/2015
How debugging should be like • Get to the content
of interest • Get helpful error messages • Display additional information where needed @_Caro _N, 22/3/2015
How debugging should be like • Get to the content
of interest • Get helpful error messages • Display additional information where needed • Know about debugging tools @_Caro _N, 22/3/2015
LLDB @_Caro _N, 22/3/2015
Expression (lldb) po objectiveCString 0x00007fbaa1f24910 (ObjectiveC.NSObject = {}) @_Caro _N,
22/3/2015
Expression (lldb) expression -O -- objectiveCString 0x00007fbaa1f24910 (ObjectiveC.NSObject = {})
@_Caro _N, 22/3/2015
Magic command (lldb) expression -l objc -O -- (id) 0x00007fbaa1f24910
@_Caro _N, 22/3/2015
Magic command (lldb) expression -l objc -O -- (id) 0x00007fbaa1f24910
I'm a fancy Objective-C String @_Caro _N, 22/3/2015
Breakpoints @_Caro _N, 22/3/2015
Editing Breakpoints @_Caro _N, 22/3/2015
Editing Breakpoints @_Caro _N, 22/3/2015
Editing Breakpoints @_Caro _N, 22/3/2015
Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw
or catch @_Caro _N, 22/3/2015
Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw
or catch @_Caro _N, 22/3/2015
Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw
or catch • Catch OpenGL ES errors @_Caro _N, 22/3/2015
Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw
or catch • Catch OpenGL ES errors • Stop when executing a specific function or method @_Caro _N, 22/3/2015
Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw
or catch • Catch OpenGL ES errors • Stop when executing a specific function or method • Stop when test Assertions fail @_Caro _N, 22/3/2015
Symbolic Breakpoints @_Caro _N, 22/3/2015
Symbolic Breakpoints @_Caro _N, 22/3/2015
Compiler errors @_Caro _N, 22/3/2015
Approach? @_Caro _N, 22/3/2015
1. Remove variables @_Caro _N, 22/3/2015
2. Split instructions @_Caro _N, 22/3/2015
Add return type @_Caro _N, 22/3/2015
Launch arguments @_Caro _N, 22/3/2015
Adding arguments in the scheme editor @_Caro _N, 22/3/2015
Concurrency -com.apple.CoreData.ConcurrencyDebug 1 @_Caro _N, 22/3/2015
SQL Statements -com.apple.CoreData.SQLDebug 3 @_Caro _N, 22/3/2015
Many more -com.apple.CoreData.MigrationDebug -com.apple.CoreData.SQLiteDebugSynchronous [0,1,2] -com.apple.CoreData.SQLiteIntegrityCheck 1 -com.apple.CoreData.ThreadingDebug [1,2,3] http://matthewmorey.com/tools-for-core-data/
@_Caro _N, 22/3/2015
Localization • -NSDoubleLocalizedStrings 1 @_Caro _N, 22/3/2015
Localization • -NSDoubleLocalizedStrings 1 • -NSShowNonLocalizedStrings 1 @_Caro _N, 22/3/2015
Localization • -NSDoubleLocalizedStrings 1 • -NSShowNonLocalizedStrings 1 • -AppleLanguages (es
de) Technical Note TN2239 iOS Debugging Magic @_Caro _N, 22/3/2015
Debugging tools @_Caro _N, 22/3/2015
Charles • Debug http/https requests • Throttle traffic • Record
download statistics @_Caro _N, 22/3/2015
Swift REPL • Test and interact with your app •
Add new code • Clean slate xcrun swift in the terminal @_Caro _N, 22/3/2015
Activity Tracing Trace crashes in asynchonous code os_activity_t activity =
os_activity_start("activity name", OS_ACTIVITY_FLAG_DEFAULT); // [...] os_activity_set_breadcrumb("event description"); // [...] os_trace("Received %d creates, %d updates, %d deletes", created, updated, deleted); // [...] os_activity_end(activity); @_Caro _N, 22/3/2015
Activity Tracing @_Caro _N, 22/3/2015
Activity Tracing http://www.objc.io/issue-19/activity-tracing.html @_Caro _N, 22/3/2015
Summary • expression -l objc -O -- (id) 0x00007fbaa1f24910 •
Edit Breakpoints, add symbolic and exception breakpoints • Tackle incomprehensive compiler errors • Launch arguments • Charles, REPL, Activity tracing @_Caro _N, 22/3/2015
Thanks @_Caro _N, 22/3/2015