public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* The main event(s)...
@ 2001-02-22 18:30 Keith Seitz
  2001-03-01 22:22 ` Martin M. Hunt
  2001-03-20  8:35 ` Andrew Cagney
  0 siblings, 2 replies; 5+ messages in thread
From: Keith Seitz @ 2001-02-22 18:30 UTC (permalink / raw)
  To: insight

Hi,

Well, I think we're at the point where we need to really start cleaning up
Insight.

Fernando has already started a plugin class (thanks Fernando!), and it
occurred to me while looking over the code: It isn't at all obvious
what events are communicated from gdb to Insight.

In an effort to identify these events, I would like to propose the following
cleanup:

Currently, windows/widgets register for events from gdb by using "add_hook".
For example, to register with the GUI what to do when the target's state
has changed (stopped executing or a stack frame change by the user), windows
would do something like this:

     FooWindow::constructor {args} {
        # ...
        add_hook gdb_update_hook [code $this update]
        # ...
      }

     FooWindow::destructor {args} {
        # ...
        remove_hook gdb_udate_hook [code $this update]
        # ...
     }

My proposal is to whack all occurences of "add_hook" (and 
"remove_hook") and just extend GDBWin (a now empty class) to include a 
dispatch method for events. (I think that GDBWin was originally "written" 
with this idea in mind.) Every window interested in gdb events would 
inherit from GDBWin. Then, to "register" for an event, simply override the 
GDBWin method. So, assuming we use "update" as the method name for what we 
currently call gdb_update_hook, we would have:

     FooWindow::update {args} {
       # code for updating
     }

Events would come from gdb in the normal way, except instead of
doing:

     proc gdbtk_tcl_foo_event {args} {
        set err [catch {run_hooks foo_hook} txt]
        # blah blah
     }

We would simply have:

     proc gdbtk_tcl_foo_event {args} {
       GDBWin::dispatch foo $args
     }

(Yes, would could even call this directly from the hook in C-land.)

In the process, this would give all windows access to all event
notification, and give us "one" file (gdbwin.ith/b) which defined
all known events.

Comments? (Yes, I have an incomplete prototype working if you need/want
to see more details.)

Keith

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <3A95F090.B57ECAF5@neurizon.net>]

end of thread, other threads:[~2001-03-20  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-22 18:30 The main event(s) Keith Seitz
2001-03-01 22:22 ` Martin M. Hunt
2001-03-20  8:35 ` Andrew Cagney
2001-03-20  9:40   ` Fernando Nasser
     [not found] <3A95F090.B57ECAF5@neurizon.net>
2001-02-23  8:13 ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).