Re: RFC: MI output during program execution

Bob Rossi
2005-08-13T12:53:40Z

On Fri, Aug 12, 2005 at 11:47:24PM -0700, Jim Ingham wrote:
>
> On Aug 12, 2005, at 10:04 PM, Daniel Jacobowitz wrote:
>
> >On Fri, Aug 12, 2005 at 09:15:42PM -0400, Bob Rossi wrote:
> >
> >>On Fri, Aug 12, 2005 at 05:33:25PM -0700, Jim Ingham wrote:
> >>
> >>>>OK, unfortunatly, I'm still trying to catch up here. I think I
> >>>>understand the observer approach, however, what is the event
> >>>>approach?
> >>>>Is that different than the "hooks" you have?
> >>>>
> >>>
> >>>So it LOOKS like the "events" are supposed to be the replacements
> >>>for
> >>>the hooks...
> >>>
> >>>But then there's the whole observer thing, which from what I read of
> >>>the gdb-patches traffic at the time was supposed to be a more
> >>>general
> >>>solution for watching interesting events. But it doesn't seem to be
> >>>used all that much.
> >>>
> >>>So I am not really sure what's supposed to be happening here.
> >>>
> >>>Moving from hooks to events seems a trivial formal exercise. I
> >>>don't
> >>>know if they will get deprecated soon or what, however...
> >>>
> >>
> >>Jim thanks for all the help! Really.
> >>
> >>Can anyone reliable answer if hooks or events are supposed to be
> >>used in
> >>the future for GDB? if neither of these, is there another approach?
> >>
> >>If there is no approach that the core GDB developers prefer, or know
> >>that are already in place, we are free to choose from any approach.
> >>
> >
> >Or do as I described earlier today, and add a new mechanism
> >specifically designed to notify interpreters of events that could be
> >interesting (which might meet Eli's concerns about misusing observers,
> >but we'd have to ask him!), or else call into the MI interpreter
> >directly from the code without messing with any kind of mechanism.
>
> The hooks worked just fine for this purpose. Dunno why they were
> deprecated. The events which are in all the same places, and work
> pretty much the same way, also should be just fine... We should pick
> one of these, I think, rather than invent yet another.

Agreed, and if I understand them, both Daniel and Eli OK this idea.

The strange this is, it doesn't look like the "event" approach was a
replacement for the "hook" approach, unless it was a long time coming.
For instance, in breakpoint.c,

1.167 (cagney 21-Apr-04): if (deprecated_create_breakpoint_hook)
1.167 (cagney 21-Apr-04): deprecated_create_breakpoint_hook (b);
1.2 (cagney 23-Feb-00): breakpoint_create_event (b->number);

The event's seem to have been there forever. Apparently, I have no idea
to figure out why someone Deprecated a piece of software in GDB because
the ChangeLog just says,
2004-04-21 Andrew Cagney <cagney@redhat.com>

* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
...

Anyways, it looks like all of the "hooks" have been removed and the
replacement is events, like you have noticed Jim. The problem I see is
that gdb-events.[hc] is supposed to be the interface. However, I notice
2 problems.

The first is that the events layer looks like it is unable to provide
events to more than one listener. There is a single static event
variable in the body of gdb-events.c. I would think more than one
subsystem would want to know about the events that have been gathered so
far. Maybe that variable should be a list?

Second, the function that installs the event hooks is deprecated! So, it
appears that both the hooks and the custom events have been deprecated.
This is odd. How would the event interface be usable if the custom event
hooks (very bad name, since this is for events, not hooks) function was
deprecated?

1.15 (cagney 26-Jun-04): extern struct gdb_events *deprecated_set_gdb_event_hooks (struct gd b_events *vector);

This change is *not* in the ChangeLog, so I have no idea why it
was changed.

Anyways, the events look just fine to me, as long as the above questions
can be satisfied.

Thanks,
Bob Rossi