Slide 1

Slide 1 text

Debugger ͷ Tips @dealforest Toshihro Morimoto 2013/11/13 potatotips #1 13೥11݄13೔ਫ༵೔

Slide 2

Slide 2 text

ࣗݾ঺հ http://about.me/dealforest iOS APP / Web Application(perl, ruby) / Flash @dealforest Toshihro Morimoto 13೥11݄13೔ਫ༵೔

Slide 3

Slide 3 text

Xcode ͷίϯιʔϧ্Ͱ௕͍ϝιουΛ ೖྗͨ͠ΓΊΜͲ͘͘͞ͳ͍Ͱ͔͢ʁ 13೥11݄13೔ਫ༵೔

Slide 4

Slide 4 text

13೥11݄13೔ਫ༵೔

Slide 5

Slide 5 text

recursiveDescription ౳ʑ 13೥11݄13೔ਫ༵೔

Slide 6

Slide 6 text

ิ׬΋͞Εͳ͍ͷͰ Α͘λΠϙ͠·͢ 13೥11݄13೔ਫ༵೔

Slide 7

Slide 7 text

(lldb) po [[[UIApplication sharedApplication] keyWindow] recursiveDescription] (lldb) po [self.view recursiveDescription] 13೥11݄13೔ਫ༵೔

Slide 8

Slide 8 text

ͳ͕͍... 13೥11݄13೔ਫ༵೔

Slide 9

Slide 9 text

͜Μͳͷ ͏ͬͯΒΕͳ͍... 13೥11݄13೔ਫ༵೔

Slide 10

Slide 10 text

Ͱ͸Ͳ͏͢Ε͹ղܾ Ͱ͖Δͷ͔ 13೥11݄13೔ਫ༵೔

Slide 11

Slide 11 text

GDB, LLDB Ͱ Command Λఆٛ͠ ͯ΍Ε͹͍͍ͷͰ͢ 13೥11݄13೔ਫ༵೔

Slide 12

Slide 12 text

Commannd ͱ͸ p ΍ po(print-object) ͷ͜ͱͰ͢ 13೥11݄13೔ਫ༵೔

Slide 13

Slide 13 text

Debugger ʹΑͬͯఆٛͷ ࢓ํ͕͔ΘΓ·͢ 13೥11݄13೔ਫ༵೔

Slide 14

Slide 14 text

ࠓճఆٛ͢Δ Command •pv ίϚϯυΛఆٛ • (lldb) pv • po [[[UIApplication sharedApplication] keyWindow] recursiveDescription] ɹ Λ࣮ߦ • (lldb) pv self.view • po [self.view recursiveDescription] Λ࣮ߦ 13೥11݄13೔ਫ༵೔

Slide 15

Slide 15 text

GDB ͷ৔߹ ~/.gdbinit define pv if $argc == 0 po [[[UIApplication sharedApplication] keyWindow] recursiveDescription] end if $argc == 1 po [$arg0 recursiveDescription] end end 13೥11݄13೔ਫ༵೔

Slide 16

Slide 16 text

LLDB ͷ৔߹ ~/.lldbinit command regex pv \ 's/^[[:space:]]*$/ po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]/' \ 's/^(.+)$/ po [%1 recursiveDescription]/' 13೥11݄13೔ਫ༵೔

Slide 17

Slide 17 text

(lldb) pv (lldb) pv self.view 13೥11݄13೔ਫ༵೔

Slide 18

Slide 18 text

\(^o^)/୤λΠϙ 13೥11݄13೔ਫ༵೔

Slide 19

Slide 19 text

ଞʹศརͳ Command ~/.gdbinit define st po [NSThread callStackSymbols] end ~/.lldbinit command regex st 's/^[[:space:]]*$/po [NSThread callStackSymbols]/' stacktrace Λදࣔ͢Δ 13೥11݄13೔ਫ༵೔

Slide 20

Slide 20 text

(lldb) st 13೥11݄13೔ਫ༵೔

Slide 21

Slide 21 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 13೥11݄13೔ਫ༵೔