Slide 1

Slide 1 text

@florianbuerger

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Debugging Tools Profiling

Slide 4

Slide 4 text

Debugging

Slide 5

Slide 5 text

Exception Type: SIGSEGV Exception Codes: SEGV_ACCERR at 0x24 Crashed Thread: 14 (...) Thread 14 Crashed: 0 AGXGLDriver 0x2f24e37e agxuReloadCtxVertexConstants(GLDContextRec*, void*) + 2 1 GLEngine 0x326a4a37 gleDoDrawDispatchCoreES2 + 592 2 GLEngine 0x3268440b glDrawElements_IMM_ES2Exec + 184 3 QuartzCore 0x32916595 CA::OGL::GLContext::draw_elements(CA::OGL:: 4 QuartzCore 0x32916437 CA::OGL::Context::array_flush() + 88 5 QuartzCore 0x329162ab CA::OGL::Context::ClippedArray::next_rect(CA::Bounds&) + 220 6 QuartzCore 0x329449c7 CA::OGL::emit_quad_indices(CA::OGL::Context&, CA::OGL::RectState const&, 7 QuartzCore 0x32944845 CA::OGL::emit_mesh_with_center(CA::OGL::Context&, CA::OGL::RectState const&, 8 QuartzCore 0x3294d6ed CA::OGL::emit_n_part_rect(CA::OGL::Context&, CA::OGL::RectState const&, int, 9 QuartzCore 0x3294aff1 CA::OGL::emit_shadow_path(CA::OGL::Context&, double, CA::Vec2 const&, 10 QuartzCore 0x32928ae1 CA::CG::DrawPathShadow::draw_shadow(CA::CG::Renderer&, bool) const + 278 11 QuartzCore 0x32913b05 CA::CG::DrawOp::render(CA::CG::Renderer&) const + 738 12 QuartzCore 0x32912791 CA::CG::Queue::render_callback(void*) + 250 13 libdispatch.dylib 0x3b07ee7b _dispatch_queue_drain + 372 14 libdispatch.dylib 0x3b07bf93 _dispatch_queue_invoke + 40 15 libdispatch.dylib 0x3b07f745 _dispatch_root_queue_drain + 74 16 libdispatch.dylib 0x3b07f9c5 _dispatch_worker_thread2 + 54 17 libsystem_pthread.dylib 0x3b1a9dff _pthread_wqthread + 298 18 libsystem_pthread.dylib 0x3b1a9cc4 start_wqthread + 8

Slide 6

Slide 6 text

Panik&Ruhig&atmen

Slide 7

Slide 7 text

Mentales(Modell(=>(

Slide 8

Slide 8 text

Debugging(is(twice(as(hard(as( wri1ng(the(code(in(the(first(place.( Therefore,(if(you(write(the(code(as( cleverly(as(possible,(you(are,(by( defini1on,(not(smart(enough(to( debug(it.( —"Brian"Kernighan

Slide 9

Slide 9 text

100%$Verständnis

Slide 10

Slide 10 text

Tools

Slide 11

Slide 11 text

Xcode&Debugger

Slide 12

Slide 12 text

Alle$Breakpoints$ de0/ak2vieren Standort simulieren Programm0 ausführung$ kontrollieren

Slide 13

Slide 13 text

Demo

Slide 14

Slide 14 text

Watch&on&Vimeo h"ps:/ /vimeo.com/97512083

Slide 15

Slide 15 text

Target'Schemes

Slide 16

Slide 16 text

Launch'Arguments

Slide 17

Slide 17 text

-NSShowNonLocalizedStrings YES -NSDoubleLocalizedStrings YES -AppleLanguages (German)

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

LLDB$Debugger

Slide 20

Slide 20 text

(…) po expr (…)

Slide 21

Slide 21 text

po (NSString *)[self title]!→""Foo"

Slide 22

Slide 22 text

expr [self setTitle:@"Bar"]!→""Bar"

Slide 23

Slide 23 text

Aliase command alias spark \ p (void*)dlopen("(...)/SparkInspector.dylib")

Slide 24

Slide 24 text

chisel

Slide 25

Slide 25 text

Danke&Facebook 1. Sammlung*von*LLDB*Kommandos 2. presponder*=>*Ausgabe*der*Responder*Chain 3. (...) 4. brew install chisel

Slide 26

Slide 26 text

Demo

Slide 27

Slide 27 text

Watch&on&Vimeo h"ps:/ /vimeo.com/97512085

Slide 28

Slide 28 text

Wissen&weitergeben ~/.lldbinit !!dynamic!Library!für!iOS!! http://defagos.roon.io/sharing-lldb-debugging- helpers-between-projects-using-a-dynamic-library

Slide 29

Slide 29 text

Logging

Slide 30

Slide 30 text

Logging&!=&NSLog

Slide 31

Slide 31 text

Logging&via&Breakpoints

Slide 32

Slide 32 text

Logging&via&Breakpoints kein%Neu(Kompilieren De#/Ak'vierung.mit.einem.Klick Logs%in%Release%builds

Slide 33

Slide 33 text

CocoaLumberjack

Slide 34

Slide 34 text

Schnell Mäch%g Flexibel

Slide 35

Slide 35 text

NSLogger(❤(CocoaLumberjack

Slide 36

Slide 36 text

Demo

Slide 37

Slide 37 text

View%Inspec+on

Slide 38

Slide 38 text

Spark&Inspector Reveal

Slide 39

Slide 39 text

Spark&Inspector&der&laufenden&App&hinzufügen command alias spark p \ (void*)dlopen(" \ (…)Spark Inspector.app/(…)SparkInspector.dylib")

Slide 40

Slide 40 text

Live%Änderungen

Slide 41

Slide 41 text

Demo

Slide 42

Slide 42 text

Zusammenfassung Wissen&über&Code&ist&falsch NSLog()!=>!CocoaLumberjack Reveal!oder!Spark*Inspector

Slide 43

Slide 43 text

Profiling

Slide 44

Slide 44 text

Vermuten(Messen!

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Performance

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

60#FPS!

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Core%Data

Slide 51

Slide 51 text

Caching Disk%I/O

Slide 52

Slide 52 text

Demo

Slide 53

Slide 53 text

Q&A

Slide 54

Slide 54 text

Links&(1/2) • Florian)Bürger)→)h0p:/ /florianbuerger.com • keslcod)GmbH)→)h0p:/ /keslcod.com • LLDB)Kommandos)→)h0ps:/ /developer.apple.com/(…) • Facebook)chisel)→)h0ps:/ /github.com/facebook/chisel • Dynamic)Library)für)iOS)→)h0p:/ /defagos.roon.io/(…) • Cocoa)Lumberjack)→)h0ps:/ /github.com/CocoaLumberjack/ CocoaLumberjack

Slide 55

Slide 55 text

Links&(2/2) • NSLogger)→)h,ps:/ /github.com/fpillet/NSLogger • NSLogger)zu)CoocaLumberjack)Connector)→)h,ps:/ /github.com/ steipete/NSLogger@CocoaLumberjack@connector • Spark)Inspector)→)h,p:/ /sparkinspector.com • Reveval)→)h,p:/ /revealapp.com