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.8k
Code Snippets for Debugging
carola
1
260
Other Decks in Technology
See All in Technology
Vista FinderMx
jtes
0
160
【ログ分析勉強会】EDR ログで内部不正を検出できるのか、Copilot に聞いてみた
hssh2_bin
2
270
kube-vipとkube-proxy置き換えCiliumを積んだ究極のK3sクラスタを建てる
logica0419
4
190
【shownet.conf_】多様化するネットワーク環境を柔軟に統合するルーティングテクノロジー
shownet
PRO
0
280
Consoles, printk, Nested-NMIs_ Oh my!
ennael
PRO
0
160
Amazon BedrockとPR-Agentでコードレビュー自動化に挑戦・実際に運用してみた
diggymo
0
550
Report of JAWS PANKRATION 2024, a global online event using Amazon IVS
yoshimi0227
1
130
DenoでもViteしたい!インポートパスのエイリアスを指定してラクラクアプリ開発
bengo4com
1
1.7k
普通の Web エンジニアのための様相論理入門 #yapcjapan / YAPC Hakodate 2024
ytaka23
2
360
スモールスタート、不都合な真実 〜 耳当たりの良い言葉に現場が振り回されないために/20240930-ssmjp-small-start
opelab
12
1.7k
【shownet.conf_】ShowNet伝送改めShowNet APN 2024
shownet
PRO
0
320
入門 バックアップ
ryuichi1208
11
4k
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1365
200k
Side Projects
sachag
452
42k
Building Better People: How to give real-time feedback that sticks.
wjessup
360
19k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.4k
Music & Morning Musume
bryan
46
6.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
279
13k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Typedesign – Prime Four
hannesfritz
39
2.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
Large-scale JavaScript Application Architecture
addyosmani
509
110k
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