63

Maybe somebody knows where is the "Run > Stop on Objective-C exception" menu in Xcode 4? I've used it sometimes in Xcode 3, but it disappeared in the new IDE.

ddnv
  • 2,104
  • 2
  • 16
  • 16

3 Answers3

96

In the left side column of xcode 4:

  1. tap on the breakpoint tab (the 6th tab over)
  2. tap on the + button in the bottom left of the window
  3. tap 'add exception breakpoint'
  4. tap 'done' on the popup
Tylerc230
  • 2,883
  • 1
  • 27
  • 31
49

See the image It will help,

enter image description here

good luck, Naveen Shan

Naveen Shan
  • 9,192
  • 3
  • 29
  • 43
7

Someone else told me this, and I'm adding it here so I can favorite this question and have a useful reference to look back on.

Set the objc exception breakpoint action to po $eax and you'll usually get the handy-dandy exception message right there in the debugger window when it breaks.

xgalaxy
  • 201
  • 3
  • 6
  • 1
    This is a great tip but $eax only works on the simulator (x86) code. The register on the device (ARM) is different. – jsd Oct 29 '12 at 21:02
  • @jsd do you know what it is? – yonix Nov 15 '12 at 11:52
  • I haven't been able to figure it out. – jsd Nov 15 '12 at 22:08
  • if i'm understanding this article correctly, the register for ARM is either $r0 or $r1, depending on what threw the exception. http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html – ericsoco Feb 10 '13 at 23:33
  • more on this here, under "Printing CPU registers" http://nachbaur.com/blog/basics-xcode-debugging-tips – ericsoco Feb 11 '13 at 06:05