woshidan's blog

あいとゆうきとITと、とっておきの話。

XCodeのデバッガについて少しだけメモ

内容

上の本を参考にiOSのUIViewと戯れています。

今日はスライダーなどをいじってみたのですが、そこでは特に書くことがなかったので、デバッガについて。

デバッガ

エディタの左側の灰色の部分をタップしてブレークポイントを設定。

デバッグしているときのメニューについて。

f:id:woshidan:20160729002703p:plain

左から

  • デバッグ関係のメニューを閉じたり開いたりする
  • ブレークポイントで処理を止めるかどうか決める
  • 次のブレークポイントorクラッシュ箇所まで進むか、今の処理を一時停止するか
  • 処理を一行分進む
  • 変数の中身などのステップも1つとして1ステップ次の処理に進む
  • よくわからない...

デバッグ用のメニューを開きながらステップ実行していくと変数の中身などが確認出来ます。

エラーの中身について

変数の中身を確認するタブの横にクラッシュなどが発生したときにメッセージがでるのですが、メソッド名などが確認出来るだけで行数がちょっとよくわからない現状です。

メソッド名がわかればブレークポイントを仕込めばいいわけですが。

2016-07-29 00:27:57.697 SliderEx[22451:903197] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modal view controller on itself. Presenting controller is <SliderEx.ViewController: 0x7ff723dad930>.'
*** First throw call stack:
(
  0   CoreFoundation                      0x000000010362dd85 __exceptionPreprocess + 165
  1   libobjc.A.dylib                     0x00000001053d1deb objc_exception_throw + 48
  2   UIKit                               0x0000000104003ab9 presentationControllerClassForPresentationStyle + 0
  3   UIKit                               0x000000010400685c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489
  4   UIKit                               0x000000010400636b -[UIViewController presentViewController:animated:completion:] + 179
  5   SliderEx                            0x000000010344572b _TFC8SliderEx14ViewController9showAlertfTGSqSS_4textGSqSS__T_ + 955
  6   SliderEx                            0x0000000103444fa8 _TFC8SliderEx14ViewController7onClickfCSo8UIButtonT_ + 1352
  7   SliderEx                            0x000000010344500a _TToFC8SliderEx14ViewController7onClickfCSo8UIButtonT_ + 58
  8   UIKit                               0x0000000103e57a8d -[UIApplication sendAction:to:from:forEvent:] + 92
  9   UIKit                               0x0000000103fcae67 -[UIControl sendAction:to:forEvent:] + 67
  10  UIKit                               0x0000000103fcb143 -[UIControl _sendActionsForEvents:withEvent:] + 327
  11  UIKit                               0x0000000103fca263 -[UIControl touchesEnded:withEvent:] + 601
  12  UIKit                               0x0000000103eca99f -[UIWindow _sendTouchesForEvent:] + 835
  13  UIKit                               0x0000000103ecb6d4 -[UIWindow sendEvent:] + 865
  14  UIKit                               0x0000000103e76dc6 -[UIApplication sendEvent:] + 263
  15  UIKit                               0x0000000103e50553 _UIApplicationHandleEventQueue + 6660
  16  CoreFoundation                      0x0000000103553301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
  17  CoreFoundation                      0x000000010354922c __CFRunLoopDoSources0 + 556
  18  CoreFoundation                      0x00000001035486e3 __CFRunLoopRun + 867
  19  CoreFoundation                      0x00000001035480f8 CFRunLoopRunSpecific + 488
  20  GraphicsServices                    0x0000000107cc3ad2 GSEventRunModal + 161
  21  UIKit                               0x0000000103e55f09 UIApplicationMain + 171
  22  SliderEx                            0x0000000103447092 main + 114
  23  libdyld.dylib                       0x0000000105e9592d start + 1
  24  ???