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
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
230
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
150
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
440
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Automating Front-end Workflow
addyosmani
1366
200k
Producing Creativity
orderedlist
PRO
341
39k
How to Ace a Technical Interview
jacobian
276
23k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Building Your Own Lightsaber
phodgson
103
6.1k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
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