Re: debugging exceptions!
Re: debugging exceptions!
- Subject: Re: debugging exceptions!
- From: James Bucanek <email@hidden>
- Date: Fri, 18 Nov 2005 08:00:18 -0700
Markian Hlynka wrote on Thursday, November 17, 2005:
>Hi! How do exceptions work in the debugger?
Pretty much the same as everything else. ;)
>I was just debugging
>something, and clicked "step over" when it was pointing at my
>"throw", and it said the executable was still running... but nothing
>was displayed in the debugger window. Did I do something wrong? Is
>there a proper way to do this? I expect to see focus go to the catch
>block...?
Throws in most languages are just funky flow control. Treat them like a goto statement (look up longjmp() if you want the details). They are not exceptional states or events as far as the debugger is concerned, and the debugger knows nothing about them so it can't anticipate the effect of a thrown exception in a step-over or step-into command.
When you stepped over the throw, the debugger simply placed a temporary breakpoint at the next line and let the function call at the current line execute. It's not the debugger's fault it never came back from the call.
The easiest way to catch an exception is to set a breakpoint in the code that catches the exception first. C++ has an option to break into the debugger whenever an exception is thrown (see the Debug menu). In Objective-C, you can set a global breakpoint at -[NSException raise].
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden