Re: debugging exceptions!
Re: debugging exceptions!
- Subject: Re: debugging exceptions!
- From: Markian Hlynka <email@hidden>
- Date: Mon, 21 Nov 2005 15:47:33 -0700
On Nov 18, 2005, at 8:00, James Bucanek wrote:
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].
I think I see. You're saying that the debugger is waiting for the
throw to return and come back to the next line, which of course it
doesn't because the throw unravelled the stack and ended up in the
appropriate catch block, right?
So, if I'm stepping through the code and hit a throw and want to
follow it, will it make any difference to step _into instead of over?
Thanks,
Markian
_______________________________________________
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