Re: C++ exception breakpoint failure
Re: C++ exception breakpoint failure
- Subject: Re: C++ exception breakpoint failure
- From: Dmitry Markman <email@hidden>
- Date: Tue, 28 Jul 2009 22:39:03 -0400
thanks Jim
it's not clear how it works
so here is what I did
suppose I have a small program
int main (int argc, char * const argv[]) {
try {
throw A();
} catch (A &a) {
std::cout << "A exception" << std::endl;
} catch (B &b) {
std::cout << "B exception" << std::endl;
}
return 1;
}
so I started gdb
and said
set exception-catch-type-regexp B
catch catch //DO I need to issue catch catch after set exception-
catch-type-regexp???
anyway after starting program
gdb hangs
if I press ^C the gdb stops at __cxa_begin_catch
gdb) set exception-catch-type-regexp B
(gdb) catch catch
Catchpoint 3 (catch)
(gdb) r
Starting program: <path_to_my_executable>
^C
Program received signal SIGINT, Interrupt.
0x96a1243c in __cxa_begin_catch ()
(gdb)
if I issue the following 2 commands
delete
set exception-catch-type-regexp A
catch catch
then gdb stop as expected
so what I'm doing wrong and why gdb hangs?
thanks
On Jul 28, 2009, at 9:26 PM, Jim Ingham wrote:
Dmitry,
You guessed correctly. You can actually set a regular expression
and if the thrown object classname matches the regular expression,
then you stop. Set it with:
(gdb) set exception-throw-type-regexp
BTW, the command "apropos" is really useful for tracking this sort
of thing down, e.g.:
(gdb) apropos throw
catch -- Set catchpoints to catch events
set exception-throw-type-regexp -- Set throw regexp
set objc-exceptions-interrupt-hand-call-fns -- Set whether hitting
an ObjC exception throw interrupts a function called by hand from
the debugger
show exception-throw-type-regexp -- Show throw regexp
show objc-exceptions-interrupt-hand-call-fns -- Show whether hitting
an ObjC exception throw interrupts a function called by hand from
the debugger
Jim
On Jul 28, 2009, at 6:15 PM, Dmitry Markman wrote:
Hi Jim
I saw that the manage c++ exception dialog has
text field C++ Exception Name
what does it mean?
so I can stop only if exception A was thrown, but not B?
if so what is gdb command line equivalent for that
thanks
On Jul 28, 2009, at 1:35 PM, Jim Ingham wrote:
"catch throw" is essentially what the Xcode "Stop on C++
exceptions" menu item calls.
Jim
On Jul 28, 2009, at 5:58 AM, Dmitry Markman wrote:
did you try "catch throw" gdb command?
dm
On Jul 27, 2009, at 10:36 PM, James Walker wrote:
Jim Ingham wrote:
This should work. We break on the cxa_throw function, which is
supposed to be how all C++ exceptions get thrown. The
disassembly for __throw_logic_error shows it calling cxa_throw,
so we should catch that.
If you can put together an example program that shows this
error getting thrown but us not catching it, please file a bug,
including the test program.
So far I haven't been able to construct a simple project that
has this problem, and it doesn't always happen in my big
program. But thanks for letting me know that I'm not missing
anything real obvious.
On Jul 27, 2009, at 11:42 AM, James Walker wrote:
I have Xcode set to break on throw for all C++ exceptions.
But I found that it did not break when a C++ standard library
routine called __throw_logic_error. Why would that be?
(Xcode 3.1.3)
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
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
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
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
Dmitry Markman
_______________________________________________
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
Dmitry Markman
Dmitry Markman
_______________________________________________
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