Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* catchpoint - bptype
@ 2008-04-28 18:13 Aleksandar Ristovski
  2008-04-28 18:22 ` Joel Brobecker
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-04-28 18:13 UTC (permalink / raw)
  To: gdb

Hello,

I need some input on the bptype enum, and catchpoint treatment:

Right now we internally treat some of them as bp_breakpoint and some as special bp_catch_*. Catchpoints "catch" and "throw" are treated as bp_breakpoint while others are treated as special types. For example "fork" is bp_catch_fork.

I see that bp_catch_catch and bp_catch_trhow were removed in Dec. 2007 and this confuses me a bit: what is the intention? To get rid of all bp_catch_*? 

Since bptype is used to give more specific detail about a breakpoint it makes sense to have bp_catch_catch and bp_catch_throw there. It would also make those two catchpoints first-class citizens again.

Thoughts? 

Thanks,

Aleksandar Ristovski
QNX Software Systems



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-28 18:13 catchpoint - bptype Aleksandar Ristovski
@ 2008-04-28 18:22 ` Joel Brobecker
  2008-04-28 20:51   ` Aleksandar Ristovski
  0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2008-04-28 18:22 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb

> I see that bp_catch_catch and bp_catch_trhow were removed in Dec. 2007 and 
> this confuses me a bit: what is the intention? To get rid of all 
> bp_catch_*? 

I haven't looked at the implementation of the other catchpoints, but
when I implemented Ada exception catchpoints, I really appreciated
the new infrastructure which allowed me to use bp_breakpoint instead
of having to add my own new bp_catchpoint enums (I tried the latter
first). It allowed me to basically implement the functionality in
a couple of functions instead of littering "case bp_catchpoint_exception..."
everywhere in breakpoint.c.

I am not sure about the long term intentions in this area.  I think
that the new approach based on breakpoint_ops can be extremely effective,
but that assumes that the functionality is in fact implemented using
an underlying breakpoint, regardless of the architecture. Catchpoints
on fork or exec events, for instance, are not in this category,
and thus require their own bp_ enum kind.

> Since bptype is used to give more specific detail about a breakpoint it 
> makes sense to have bp_catch_catch and bp_catch_throw there. It would also 
> make those two catchpoints first-class citizens again.

I don't understand why you think that not having their own bp_catch
enum makes them less equal than the others.  Like I said above, it
certainly made the implementation more compact and easier to maintain.
At the user level, I don't think he's seeing much of a difference either.

-- 
Joel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-28 20:51   ` Aleksandar Ristovski
@ 2008-04-28 20:09     ` Aleksandar Ristovski
  2008-04-28 21:08     ` Daniel Jacobowitz
  1 sibling, 0 replies; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-04-28 20:09 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb

Joel Brobecker wrote:
>> I see that bp_catch_catch and bp_catch_trhow were removed in Dec. 2007 and 
>> this confuses me a bit: what is the intention? To get rid of all 
>> bp_catch_*? 
> 
> I haven't looked at the implementation of the other catchpoints, but
> when I implemented Ada exception catchpoints, I really appreciated
> the new infrastructure which allowed me to use bp_breakpoint instead
> of having to add my own new bp_catchpoint enums (I tried the latter
> first). It allowed me to basically implement the functionality in
> a couple of functions instead of littering "case bp_catchpoint_exception..."
> everywhere in breakpoint.c.
This is where breakpoint_ops could be used... but I first want to understand the intent and what conceptually makes more sense, and then we can talk about the implementation details.

> 
> I am not sure about the long term intentions in this area.  I think
> that the new approach based on breakpoint_ops can be extremely effective,

I agree, but without knowing the long term intent it is hard to tell. At the moment it introduces slight complication since only "catch" and "throw" use ops and nothing else (and, therefore, take different printing route than anything else). I can see how breakpoint_ops can be very useful, if used consistently - it could be used to, for example, get rid of the switch statements you mentioned above.

> I don't understand why you think that not having their own bp_catch
> enum makes them less equal than the others.  Like I said above, it
> certainly made the implementation more compact and easier to maintain.
> At the user level, I don't think he's seeing much of a difference either.
 
For example:
(gdb) catch catch
Catchpoint 2 (catch)
(gdb) catch fork
Catchpoint 3 (fork)
(gdb) info b
Num     Type           Disp Enb Address    What
2       breakpoint     keep y   0xb7f75896 exception catch
3       catch fork     keep y
(gdb)

See how "fork" is cool and "catch" isn't. "Catch" looks just like any other breakpoint; the only diff. is in "What" field, while catch fork is clearly a catchpoint.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-28 18:22 ` Joel Brobecker
@ 2008-04-28 20:51   ` Aleksandar Ristovski
  2008-04-28 20:09     ` Aleksandar Ristovski
  2008-04-28 21:08     ` Daniel Jacobowitz
  0 siblings, 2 replies; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-04-28 20:51 UTC (permalink / raw)
  To: gdb; +Cc: gdb

Joel Brobecker wrote:
>> I see that bp_catch_catch and bp_catch_trhow were removed in Dec. 2007 and 
>> this confuses me a bit: what is the intention? To get rid of all 
>> bp_catch_*? 
> 
> I haven't looked at the implementation of the other catchpoints, but
> when I implemented Ada exception catchpoints, I really appreciated
> the new infrastructure which allowed me to use bp_breakpoint instead
> of having to add my own new bp_catchpoint enums (I tried the latter
> first). It allowed me to basically implement the functionality in
> a couple of functions instead of littering "case bp_catchpoint_exception..."
> everywhere in breakpoint.c.
This is where breakpoint_ops could be used... but I first want to understand the intent and what conceptually makes more sense, and then we can talk about the implementation details.

> 
> I am not sure about the long term intentions in this area.  I think
> that the new approach based on breakpoint_ops can be extremely effective,

I agree, but without knowing the long term intent it is hard to tell. At the moment it introduces slight complication since only "catch" and "throw" use ops and nothing else (and, therefore, take different printing route than anything else). I can see how breakpoint_ops can be very useful, if used consistently - it could be used to, for example, get rid of the switch statements you mentioned above.

> I don't understand why you think that not having their own bp_catch
> enum makes them less equal than the others.  Like I said above, it
> certainly made the implementation more compact and easier to maintain.
> At the user level, I don't think he's seeing much of a difference either.
 
For example:
(gdb) catch catch
Catchpoint 2 (catch)
(gdb) catch fork
Catchpoint 3 (fork)
(gdb) info b
Num     Type           Disp Enb Address    What
2       breakpoint     keep y   0xb7f75896 exception catch
3       catch fork     keep y
(gdb)

See how "fork" is cool and "catch" isn't. "Catch" looks just like any other breakpoint; the only diff. is in "What" field, while catch fork is clearly a catchpoint.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-28 20:51   ` Aleksandar Ristovski
  2008-04-28 20:09     ` Aleksandar Ristovski
@ 2008-04-28 21:08     ` Daniel Jacobowitz
  2008-04-29 17:05       ` Aleksandar Ristovski
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-04-28 21:08 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: Joel Brobecker, gdb

On Mon, Apr 28, 2008 at 01:28:57PM -0400, Aleksandar Ristovski wrote:
> I agree, but without knowing the long term intent it is hard to
> tell. At the moment it introduces slight complication since only
> "catch" and "throw" use ops and nothing else (and, therefore, take
> different printing route than anything else). I can see how
> breakpoint_ops can be very useful, if used consistently - it could
> be used to, for example, get rid of the switch statements you
> mentioned above.

Why do you assume there is a long term intent? :-)

I don't want to add new elements to those switches unless they are
really for things that do not behave like breakpoints.  I'd be happy
to see patches removing existing cases.  That's why, when I wrote new
code to catch C++ exceptions, I used breakpoint_ops.

> (gdb) info b
> Num     Type           Disp Enb Address    What
> 2       breakpoint     keep y   0xb7f75896 exception catch
> 3       catch fork     keep y
> (gdb)
>
> See how "fork" is cool and "catch" isn't. "Catch" looks just like
> any other breakpoint; the only diff. is in "What" field, while catch
> fork is clearly a catchpoint.

If you can convince us it matters, we can change the output.
Personally I think "breakpoint on exception catch" is a perfectly
reasonable thing to call it - that's what it is.  The fork catchpoints
are not like a breakpoint, though, since they do not correspond to
any code address - just an OS event.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-28 21:08     ` Daniel Jacobowitz
@ 2008-04-29 17:05       ` Aleksandar Ristovski
  2008-04-29 17:49         ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-04-29 17:05 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Joel Brobecker, gdb

Daniel Jacobowitz wrote:
> On Mon, Apr 28, 2008 at 01:28:57PM -0400, Aleksandar Ristovski wrote:
>> I agree, but without knowing the long term intent it is hard to
>> tell. At the moment it introduces slight complication since only
>> "catch" and "throw" use ops and nothing else (and, therefore, take
>> different printing route than anything else). I can see how
>> breakpoint_ops can be very useful, if used consistently - it could
>> be used to, for example, get rid of the switch statements you
>> mentioned above.
> 
> Why do you assume there is a long term intent? :-)

Just asking...

> 
> I don't want to add new elements to those switches unless they are
> really for things that do not behave like breakpoints.  I'd be happy
> to see patches removing existing cases.  That's why, when I wrote new
> code to catch C++ exceptions, I used breakpoint_ops.

I think breakpoint_ops is a good approach, but I would dare to say - incomplete. 
>> See how "fork" is cool and "catch" isn't. "Catch" looks just like
>> any other breakpoint; the only diff. is in "What" field, while catch
>> fork is clearly a catchpoint.
> 
> If you can convince us it matters, we can change the output.

Just that the documentation treats them differently and calls them catchpoints. And I would say that logically they are kind of special... that's all. 

> Personally I think "breakpoint on exception catch" is a perfectly
> reasonable thing to call it - that's what it is.  The fork catchpoints
> are not like a breakpoint, though, since they do not correspond to
> any code address - just an OS event.
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: catchpoint - bptype
  2008-04-29 17:05       ` Aleksandar Ristovski
@ 2008-04-29 17:49         ` Daniel Jacobowitz
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-04-29 17:49 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: Joel Brobecker, gdb

On Mon, Apr 28, 2008 at 02:00:02PM -0400, Aleksandar Ristovski wrote:
>> I don't want to add new elements to those switches unless they are
>> really for things that do not behave like breakpoints.  I'd be happy
>> to see patches removing existing cases.  That's why, when I wrote new
>> code to catch C++ exceptions, I used breakpoint_ops.
>
> I think breakpoint_ops is a good approach, but I would dare to say - 
> incomplete. 

Yes, that's accurate.  I didn't change any of the existing
ones when I added the mechanism.

>>> See how "fork" is cool and "catch" isn't. "Catch" looks just like
>>> any other breakpoint; the only diff. is in "What" field, while catch
>>> fork is clearly a catchpoint.
>>
>> If you can convince us it matters, we can change the output.
>
> Just that the documentation treats them differently and calls them 
> catchpoints. And I would say that logically they are kind of special... 
> that's all. 

If you want them displayed as catchpoints I'm amenable to a patch.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-28 18:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-28 18:13 catchpoint - bptype Aleksandar Ristovski
2008-04-28 18:22 ` Joel Brobecker
2008-04-28 20:51   ` Aleksandar Ristovski
2008-04-28 20:09     ` Aleksandar Ristovski
2008-04-28 21:08     ` Daniel Jacobowitz
2008-04-29 17:05       ` Aleksandar Ristovski
2008-04-29 17:49         ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox