This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] New Event Model Prototype


Keith,

I have another question about this.  How were you planning to pass all 
the details about the event?  Will there be methods in the GDBEvent 
class to get out the event data?  It almost seems like you want to have:

GDBEvent
     |
     ------> BreakpointEvent
     |
     ------> ExecutionStateEvent

and ALL you ever pass to the dispatch method is an event of the 
appropriate class.  This would really simplify the code in the event 
listeners, and we wouldn't get into the situation of the current code, 
where the event handlers have to know the order of the parameters in the 
hook call, which is very fragile.

Jim



On Friday, April 13, 2001, at 01:56 PM, Keith Seitz wrote:

> On Fri, 13 Apr 2001, Jim Ingham wrote:
>
>> Yes, this is what I had in mind.
>
> Ok, glad we're all on the same page (now).
>
>> One of the other things that I was thinking to handle in GDBWin was the
>> logic of tracking all the windows that logically belong to a single
>> thread, or a single processor - when we get to the point were gdb &
>> insight can support that.  That lives above the level of ManagedWin,
>> since ManagedWin doesn't know that this variable display & this 
>> register
>> display & this stack display belong to thread 1, etc...  Someone needs
>> to do this, since it would be great to be able to hide info about one
>> thread, then reveal it again.  Ditto for processors (like the CPU & the
>> DSP, or multiprocessor systems or what not...
>
> Sheesh. I disappear for a little while, and look at how much I forget.
> This seems like the right path to follow.
>
>> But it is also quite appropriate for it to inherit from GDBEvent.
>
> Yes, I agree. My latest incarnation (below) does just this. GDBWin
> inherits from GDBEvent.
>
>> Enough drivel for now...
>
> :-)
>
> I've included the two new files, gdbevent.ith and gdbevent.itb, and 
> given
> the small diff for gdbwin.ith.
>
> Once this is approved by Fernando and you (Jim), I will post the changes
> to interface.tcl, bpwin.it?, and srctextwin.itb to use this for
> breakpoint/tracepoint events.
>
> Keith
>
> *** File: gdbevent.ith
> # GDBEvent class definition for Insight.
> # Copyright 2001 Red Hat, Inc.
> #
> # This program is free software; you can redistribute it and/or modify 
> it
> # under the terms of the GNU General Public License (GPL) as published 
> by
> # the Free Software Foundation; either version 2 of the License, or (at
> # your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
>
>
> class GDBEvent {
>
>   constructor {args} {}
>   destructor {}
>
>   #
>   # Events
>   #
>   public {
>     # Dispatching proc. ALL events should be funneled through this
>     # procedure.
>     proc dispatch {event args}
>
>     # Breakpiont/tracepoint creation/deletion/modification
>     # ACTION    - "create", "modify", "delete"
>     # NUM       - gdb's internal token for the bp/tp
>     # ADDR      - the address at which the breakpoint is set
>     # LINE      - line number of this address
>     # FILE      - source file name containing the address
>     # TYPE      - what gdb will do with bp/tp: "delete", "delstop",
>     #             "disable", "donttouch" (see breakpoint.h "enum 
> bpdisp")
>     # ENABLED   - is the bp/tp enabled?
>     # THREAD    - thread number of thread-specific bp or -1 if don't 
> care
>     # PASSCOUNT - pass count of the tracepoint
>     method breakpoint {action num addr line file type enabled thread} {}
>     method tracepoint {action num addr line file passcount} {}
>   }
> }
>
> *** File: gdbevent.itb
> # GDBEvent class implementation for Insight.
> # Copyright 2001 Red Hat, Inc.
> #
> # This program is free software; you can redistribute it and/or modify 
> it
> # under the terms of the GNU General Public License (GPL) as published 
> by
> # the Free Software Foundation; either version 2 of the License, or (at
> # your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
>
> body GDBEvent::dispatch {event args} {
>
>   # Determine what event handler to call.
>   switch $event {
>     breakpoint   { set handler breakpoint }
>
>     tracepoint   { set handler tracepoint }
>
>     default { dbug E "unknown event: \"$event\""; return }
>   }
>
>   # invoke event handlers
>   foreach w [itcl_info objects -isa GDBWin] {
>     dbug I "posting event \"$event\" to \"$w\""
>     set err [catch {eval $w $handler $args} errMsg]
>     if {$err} {
>       dbug E "On $event event, $w errored:\n$errMsg"
>     }
>   }
> }
>
> *** Other patches:
>
> Index: gdbwin.ith
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/gdbwin.ith,v
> retrieving revision 1.2
> diff -p -u -r1.2 gdbwin.ith
> --- gdbwin.ith	2001/02/08 19:26:31	1.2
> +++ gdbwin.ith	2001/04/13 20:54:58
> @@ -13,8 +13,7 @@
>
>
>  class GDBWin {
> -  private variable _state
> -  public method update
> +  inherit GDBEvent
>
>   constructor {args} {
>      debug "$args"
>

--
Jim Ingham                                   jingham@apple.com
Developer Tools - gdb
Apple Computer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]