* GDB/MI design question re: Ada exception catchpoints
@ 2011-03-09 6:27 Joel Brobecker
2011-03-10 10:12 ` Vladimir Prus
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2011-03-09 6:27 UTC (permalink / raw)
To: gdb-patches, vladimir
Hello all,
One of the guys at AdaCore would like to use CDT, and noticed that
some normal CDT notifications do not get triggered when the program
hits an Ada exception catchpoint. We narrowed down the issue to
the fact that we don't emit the stop reason:
(gdb)
~"\nCatchpoint 2, unhandled CONSTRAINT_ERROR at "
*stopped,frame={addr="0x080497f2",func="test",args=[],file="/[...]/test.adb",fullname="/[...]/test.adb",line="21"},thread-id="1",stopped-threads="all",core="1"
(gdb)
In fact, looking deeper, we get the above, because, well, the
"print_it" routine for Ada exception catchpoints does little more
than `printf ("Catchpoint %d, %s at")', thus not handling the MI case
at all.
But once I rewrote a bit the code to follow what other breakpoint
"print_it" routines do, I now get the following output:
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000402062",func="foo",args=[],file="foo.adb",fullname="/[...]/foo.adb",line="3"},thread-id="1",stopped-threads="all",core="3"
The front-end no longer has as much information as before.
The fact that we've just hit an exception catchpoint can probably
be deduced from the breakpoint number. But we are missing the
exception name.
I think that it would be sufficient to add an extra field providing
that exception name:
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",exception-name="CONSTRAINT_ERROR",frame={addr="0x0000000000402062",func="foo",args=[],file="foo.adb",fullname="/[...]/foo.adb",line="3"},thread-id="1",stopped-threads="all",core="3"
If the field is missing, it means that we were unable to determine
that exception name (in the CLI, we print "exception" instead of
"CONSTRAINT_ERROR").
Would that be OK? I don't want to change the current code until
we address this issue, because CDT apparently works around the
current situation by parsing the contents of the console stream
output (the `~"..."' stuff).
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: GDB/MI design question re: Ada exception catchpoints
2011-03-09 6:27 GDB/MI design question re: Ada exception catchpoints Joel Brobecker
@ 2011-03-10 10:12 ` Vladimir Prus
2011-03-10 11:51 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Prus @ 2011-03-10 10:12 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Wednesday, March 09, 2011 07:59:39 Joel Brobecker wrote:
> Hello all,
>
> One of the guys at AdaCore would like to use CDT, and noticed that
> some normal CDT notifications do not get triggered when the program
> hits an Ada exception catchpoint. We narrowed down the issue to
> the fact that we don't emit the stop reason:
>
> (gdb)
> ~"\nCatchpoint 2, unhandled CONSTRAINT_ERROR at "
> *stopped,frame={addr="0x080497f2",func="test",args=[],file="/[...]/test.adb
> ",fullname="/[...]/test.adb",line="21"},thread-id="1",stopped-threads="all"
> ,core="1" (gdb)
>
> In fact, looking deeper, we get the above, because, well, the
> "print_it" routine for Ada exception catchpoints does little more
> than `printf ("Catchpoint %d, %s at")', thus not handling the MI case
> at all.
>
> But once I rewrote a bit the code to follow what other breakpoint
> "print_it" routines do, I now get the following output:
>
> (gdb)
> *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000
> 000000402062",func="foo",args=[],file="foo.adb",fullname="/[...]/foo.adb",l
> ine="3"},thread-id="1",stopped-threads="all",core="3"
>
> The front-end no longer has as much information as before.
> The fact that we've just hit an exception catchpoint can probably
> be deduced from the breakpoint number. But we are missing the
> exception name.
>
> I think that it would be sufficient to add an extra field providing
> that exception name:
>
> *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",exception-name="CON
> STRAINT_ERROR",frame={addr="0x0000000000402062",func="foo",args=[],file="fo
> o.adb",fullname="/[...]/foo.adb",line="3"},thread-id="1",stopped-threads="a
> ll",core="3"
>
> If the field is missing, it means that we were unable to determine
> that exception name (in the CLI, we print "exception" instead of
> "CONSTRAINT_ERROR").
>
> Would that be OK?
That seems totally reasonable for me. I assume that for Ada catchpoints, "-break-list"
lists some special type?
- Volodya
--
Vladimir Prus
Mentor Graphics
+7 (812) 677-68-40
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: GDB/MI design question re: Ada exception catchpoints
2011-03-10 10:12 ` Vladimir Prus
@ 2011-03-10 11:51 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2011-03-10 11:51 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb-patches
> That seems totally reasonable for me.
Cool, thanks.
> I assume that for Ada catchpoints, "-break-list" lists some special
> type?
Not a special type, no, but a special "what":
bkpt={number="1",type="breakpoint",
disp="keep",enabled="y",addr="0x000000000040527c",
what="all Ada exceptions",
times="0",original-location="__gnat_debug_raise_exception"}
the key elements are type="breakpoint", and what="all Ada exceptions".
It's the same for "C++ exception catchpoints":
bkpt={number="2",type="breakpoint",
disp="keep",enabled="y",addr="[...]",
what="exception catch",times="0",
original-location="__cxa_begin_catch"}
So, the FE has to determine by itself what type of "breakpoint"
this is by looking at the "what"...
Thanks for the feedback, I'll try to come up with a patch sometime
soon.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-10 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 6:27 GDB/MI design question re: Ada exception catchpoints Joel Brobecker
2011-03-10 10:12 ` Vladimir Prus
2011-03-10 11:51 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox