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
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
180
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
110
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
Lexical Analysis
shigashiyama
1
150
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
490
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.1k
Featured
See All Featured
Designing the Hi-DPI Web
ddemaree
280
34k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Language of Interfaces
destraynor
154
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
We Have a Design System, Now What?
morganepeng
50
7.2k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Teambox: Starting and Learning
jrom
133
8.8k
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