Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>, vladimir@codesourcery.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: Remove gdb-events
Date: Mon, 14 Jul 2008 17:10:00 -0000	[thread overview]
Message-ID: <20080714171004.GC3998@adacore.com> (raw)
In-Reply-To: <m3tzeubpw5.fsf@fleche.redhat.com>

Eli: if you could take a look at the documentation of the new observers,
that would be great! I'm going to approve the technical part, and we'll
follow any suggestion you might have either before or after commit.

Vladimir: This patch touches MI. Could you take a look at this part
of the patch? The changes seem fine to me, but see below my suggestion.

Hi Tom,

First of all, thanks very much for undertaking this task. I think
we have been talking of getting rid of hooks for at least since
the day we introduced the observers.

Here are my comments on the patch.

> * Removing the call to clear_gdb_event_hooks.  In theory I think this
>   could confuse some caller.  However, in practice I think it is
>   probably nothing to worry about.

We do have to be a little bit careful - because we don't want TUI
observers to trigger when TUI is inactive, or MI observers to trigger
when the interpreter is CLI. But I see that you definitely handled that.

My thought on this is that the observers should be installed permanently
and should have a way of determining whether the current interpreter is
the one they have been installed for before doing anything else. For
instance, inside MI, you'd have:

    current_interp_is_mi ()
    {
      return (current_interpreter () == ...
              || current_interpreter () == ...)
    }
    
    mi_breakpoint_notify (int b)
    {
      if (!current_interp_is_mi ())
        return;
      gdb_breakpoint_query (uiout, b, NULL)
    }

But, for now, the way you implemented things makes this unnecessary.
This should be discussed as a separate change, however, as I think
it would simplify things a bit inside mi and tui.

> * The architecture_changed observer is needed for gdbtk, but the only
>   place where this is notified is deprecated.  Since my goal here is
>   to remove events, I think this is probably fine.  It certainly
>   doesn't seem any worse.

The gdbtk team will probably be grateful that you took a look at their
code, but it's actually maintained by a different group, with a different
discussion list. I took a look, and the changes certainly look reasonable.
Let's send them a copy of the gdbtk patch (insight@sourceware.org) when
we're happy about the changes in GDB.

> * MI installs a new set of event handlers, does some work, then
>   uninstalls them.  Instead of trying to replicate this behavior --
>   say by deinstalling other observers -- I just made the MI observer
>   conditional on a global flag, which is set and reset at the
>   appropriate points.
> 
>   I think this is probably the friendliest approach; my thinking here
>   is that any given module should not be able to mess around with
>   observers installed by a separate module.

I would like Vladimir to review this part. It seems fine to me,
except that I would simply install the observer during the _init
phase instead of doing it on the fly with a static global used
to make sure they are installed only once.

Regarding the set/reset thing, see discussion above about interpreters
being able to know which interpreter is current.

> ChangeLog:
> 2008-07-12  Tom Tromey  <tromey@redhat.com>
> 
> 	* tui/tui-hooks.c: Include observer.h.
> 	(tui_event_default, tui_old_event_hooks, tui_event_hooks):
> 	Remove.
> 	(tui_bp_created_observer, tui_bp_deleted_observer,
> 	tui_bp_modified_observer): New globals.
> 	(tui_install_hooks): Use observers, not events.
> 	(tui_remove_hooks): Likewise.
> 	* mi/mi-cmd-break.c: Include observer.h, not gdb-events.h.
> 	(mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New
> 	globals.
> 	(breakpoint_notify): Check mi_can_breakpoint_notify.
> 	(breakpoint_hooks): Remove.
> 	(mi_cmd_break_insert): Attach observers.  Don't use events.
> 	* tracepoint.c: Include observer.h, not gdb-events.h.
> 	(tracepoint_operation, trace_pass_command): Notify observer.
> 	* interps.c: Don't include gdb-events.h.
> 	(clear_interpreter_hooks): Don't call clear_gdb_event_hooks.
> 	* gdbarch.c: Include observer.h, not gdb-events.h.
> 	(deprecated_current_gdbarch_select_hack): Notify observer.
> 	* breakpoint.h: Don't include gdb-events.h.
> 	* breakpoint.c: Don't include gdb-events.h.
> 	(condition_command): Notify observer.
> 	(commands_command): Likewise.
> 	(commands_from_control_command): Likewise.
> 	(mention, delete_breakpoint, set_ignore_count): Likewise.
> 	(disable_breakpoint, do_enable_breakpoint): Likewise.
> 	* Makefile.in (gdb_events_h): Remove.
> 	(breakpoint_h): Update.
> 	(COMMON_OBS): Remove gdb-events.o.
> 	(gdb-events.o): Remove.
> 	(breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o,
> 	gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update.
> 	* gdb-events.c: Remove.
> 	* gdb-events.h: Remove.
> 	* gdb-events.sh: Remove.

Overall, this looks OK to me. Let's wait for Vladimir to provide
his comments the MI part of your changes. There are a few nits that
need fixing before this is checked in, but except for the MI part,
this is pre-approved.

First nit: gdbarch.c is a generated file. You'll need to modify gdbarch.sh
instead, and regenerate gdbarch.c. You'll see that the changes should
be identical to the ones you made, but in a different file.

> doc/ChangeLog:
> 2008-07-12  Tom Tromey  <tromey@redhat.com>
> 
> 	* observer.texi (GDB Observers): Document new observers:
> 	breakpoint_created, breakpoint_deleted, breakpoint_modified,
> 	tracepoint_created, tracepoint_deleted, tracepoint_modified,
> 	architecture_changed.

OK.

> gdbtk/ChangeLog:
> 2008-07-12  Tom Tromey  <tromey@redhat.com>
> 
> 	* generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h.
> 	(gdbtk_add_hooks): Use observers, not events.
> 	(gdbtk_architecture_changed): Add argument, for observer.
> 	* generic/gdbtk-bp.c: Include observer.h.
> 	(gdb_set_bp): Notify observer.
> 	(gdb_set_bp_addr): Likewise.

This is insight "territory". 

> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.1035
> diff -u -r1.1035 Makefile.in
> --- Makefile.in	11 Jul 2008 11:07:38 -0000	1.1035
> +++ Makefile.in	13 Jul 2008 00:04:57 -0000

For this part, could you re-do a pass to check that the dependencies
have all been correctly updated. For instance, I noticed that for
tracepoint.c, you correctly removed the dependency on gdb-events.h,
but forgot to add the one on observer.h. As far as I can tell, this
is the only case were something was missed.

Let's isolate the Makefile.in changes related to gdbtk and send them
to the insight list together with your other gdbtk changes.


-- 
Joel


  parent reply	other threads:[~2008-07-14 17:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-13  0:16 Tom Tromey
2008-07-13  3:26 ` Stan Shebs
2008-07-13 21:56   ` Tom Tromey
2008-08-01 16:20     ` Tom Tromey
2008-08-01 16:33       ` Subdir ChangeLogs (was Re: RFA: Remove gdb-events) Stan Shebs
2008-08-01 17:10         ` Subdir ChangeLogs Tom Tromey
2008-08-01 17:27           ` Stan Shebs
2008-08-01 17:54             ` Tom Tromey
2008-08-01 18:44             ` Eli Zaretskii
2008-08-01 18:55               ` Tom Tromey
2008-08-01 19:25                 ` Eli Zaretskii
2008-08-01 19:33                   ` Tom Tromey
2008-08-01 20:11                     ` Thiago Jung Bauermann
2008-08-02  7:13                     ` Eli Zaretskii
2008-08-02 16:52                       ` Tom Tromey
2008-08-02 17:28                         ` Eli Zaretskii
2008-08-02 20:24                         ` Thiago Jung Bauermann
2008-08-03  0:02           ` Michael Snyder
2008-08-01 17:40       ` RFA: Remove gdb-events Mark Kettenis
2008-07-14 17:10 ` Joel Brobecker [this message]
2008-07-14 20:33   ` Tom Tromey
2008-07-15  6:54     ` Joel Brobecker
2008-07-17 23:41   ` Tom Tromey
2008-07-21 16:54     ` GDB/MI PING (was: "Re: RFA: Remove gdb-events") Joel Brobecker
2008-07-22  0:56     ` RFA: Remove gdb-events Tom Tromey
2008-07-25 16:11       ` Tom Tromey
2008-07-20 11:46 ` Eli Zaretskii
2008-07-21 17:13 ` Vladimir Prus
2008-07-22  0:32   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080714171004.GC3998@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=tromey@redhat.com \
    --cc=vladimir@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox