OSDN Git Service

New event handling infrastructure.
authorKeith Seitz <keiths@redhat.com>
Thu, 19 Apr 2001 22:48:47 +0000 (22:48 +0000)
committerKeith Seitz <keiths@redhat.com>
Thu, 19 Apr 2001 22:48:47 +0000 (22:48 +0000)
* library/gdbevent.ith: New file. Defines new event model.
* library/gdbevent.itb: New file. Implements new event
model.
* library/ehandler.ith: New file. Defines new event model.
* library/ehandler.itb: New file. Implements new event
model.
* library/gdbwin.ith: Inherit from GDBEventHandler.
(update): Delete unused method.
(_state): Delete unused variable.
* library/tclIndex: Regenerated.

gdb/gdbtk/ChangeLog
gdb/gdbtk/library/ehandler.itb [new file with mode: 0644]
gdb/gdbtk/library/ehandler.ith [new file with mode: 0644]
gdb/gdbtk/library/gdbevent.itb [new file with mode: 0644]
gdb/gdbtk/library/gdbevent.ith [new file with mode: 0644]
gdb/gdbtk/library/tclIndex

index d5dfd71..85992be 100644 (file)
@@ -1,3 +1,16 @@
+2001-04-19  Keith Seitz  <keiths@cygnus.com>
+
+       * library/gdbevent.ith: New file. Defines new event model.
+       * library/gdbevent.itb: New file. Implements new event
+       model.
+       * library/ehandler.ith: New file. Defines new event model.
+       * library/ehandler.itb: New file. Implements new event
+       model.
+       * library/gdbwin.ith: Inherit from GDBEventHandler.
+       (update): Delete unused method.
+       (_state): Delete unused variable.
+       * library/tclIndex: Regenerated.
+
 2001-04-18  Martin M. Hunt  <hunt@redhat.com>
        
        * generic/gdbtk.c (gdbtk_init): Initialize uiout.
diff --git a/gdb/gdbtk/library/ehandler.itb b/gdb/gdbtk/library/ehandler.itb
new file mode 100644 (file)
index 0000000..bf95c0e
--- /dev/null
@@ -0,0 +1,31 @@
+# GDBEventHandler 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.
+
+# ------------------------------------------------------------
+#  PUBLIC PROC:  dispatch - Dispatch the given event to all
+#                 event handlers. The name of the handler
+#                 method to call is stored in the event's
+#                 "handler" method.                  
+# ------------------------------------------------------------
+body GDBEventHandler::dispatch {event} {
+
+  set handler [$event handler]
+
+  # invoke event handlers
+  foreach w [itcl_info objects -isa GDBEventHandler] {
+    dbug I "posting event \"$handler\" to \"$w\""
+    if {[catch {$w $handler $event}]} {
+      dbug E "On $handler event, $w errored:\n$::errorInfo"
+    }
+  }
+}
diff --git a/gdb/gdbtk/library/ehandler.ith b/gdb/gdbtk/library/ehandler.ith
new file mode 100644 (file)
index 0000000..a5c222b
--- /dev/null
@@ -0,0 +1,33 @@
+# GDBEventHandler 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 GDBEventHandler {
+
+  constructor {args} {}
+  destructor {}
+
+  # Dispatching proc. ALL events should be funneled through this
+  # procedure.
+  public proc dispatch {event}
+
+  #
+  # Events
+  #
+
+  # See gdbevent.ith for descriptions of event
+  public {
+    # Breakpiont/tracepoint events
+    method breakpoint {event} {}
+    method tracepoint {event} {}
+  }
+}
diff --git a/gdb/gdbtk/library/gdbevent.itb b/gdb/gdbtk/library/gdbevent.itb
new file mode 100644 (file)
index 0000000..c0ca270
--- /dev/null
@@ -0,0 +1,136 @@
+# GDB event class implementations 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.
+
+# ------------------------------------------------------------
+#  PUBLIC METHOD:  get - Retrieve data about the event
+# ------------------------------------------------------------
+body BreakpointEvent::get {what} {
+
+  switch $what {
+    action       { return $action }
+    number       { return $number }
+    file         { return $_file }
+    function     { return $_function }
+    line         { return $_line }
+    address      { return $_address }
+    type         { return $_type }
+    enabled      { return $_enabled }
+    disposition  { return $_disposition }
+    ignore_count { return $_ignore_count }
+    commands     { return $_commands }
+    condition    { return $_condition }
+    thread       { return $_thread }
+    hit_count    { return $_hit_count }
+
+    default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|type|enabled|disposition|ignore_count|commands|condition|thread|hit_count" }
+  }
+}
+
+# ------------------------------------------------------------
+#  PRIVATE METHOD:  _init - Initialize all private data
+# ------------------------------------------------------------
+body BreakpointEvent::_init {} {
+  if {[catch {gdb_get_breakpoint_info $number} bpinfo]} {
+    set _file         {}
+    set _function     {}
+    set _line         {}
+    set _address      {}
+    set _type         {}
+    set _enabled      {}
+    set _disposition  {}
+    set _ignore_count {}
+    set _commands     {}
+    set _condition    {}
+    set _thread       {}
+    set _hit_count    {}
+  } else {
+    lassign $bpinfo \
+      _file         \
+      _function     \
+      _line         \
+      _address      \
+      _type         \
+      _enabled      \
+      _disposition  \
+      _ignore_count \
+      _commands     \
+      _condition    \
+      _thread       \
+      _hit_count
+  }
+}
+
+# When the breakpoint number for the event changes,
+# update the private data in the event.
+configbody BreakpointEvent::number {
+  _init
+}
+
+# ------------------------------------------------------------
+#  PUBLIC METHOD:  get - Retrieve data about the event
+# ------------------------------------------------------------
+body TracepointEvent::get {what} {
+
+  switch $what {
+    action     { return $action }
+    number     { return $number }
+    file       { return $_file }
+    function   { return $_function }
+    line       { return $_line }
+    address    { return $_address }
+    enabled    { return $_enabled }
+    pass_count { return $_pass_count }
+    step_count { return $_step_count }
+    thread     { return $_thread }
+    hit_count  { return $_hit_count }
+    actions    { return $_actions }
+
+    default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|pass_count|step_count|thread|hit_count|actions" }
+  }
+}
+
+# ------------------------------------------------------------
+#  PRIVATE METHOD:  _init - Initialize all private data
+# ------------------------------------------------------------
+body TracepointEvent::_init {} {
+  if {[catch {gdb_get_tracepoint_info $number} tpinfo]} {
+    set _file         {}
+    set _function     {}
+    set _line         {}
+    set _address      {}
+    set _enabled      {}
+    set _pass_count   {}
+    set _step_count   {}
+    set _thread       {}
+    set _hit_count    {}
+    set _actions      {}
+  } else {
+    lassign $tpinfo \
+      _file         \
+      _function     \
+      _line         \
+      _address      \
+      _enabled      \
+      _pass_count   \
+      _step_count   \
+      _thread       \
+      _hit_count    \
+      _actions
+  }
+}
+
+# When the tracepoint number for the event changes,
+# update the private data in the event.
+configbody TracepointEvent::number {
+  _init
+}
diff --git a/gdb/gdbtk/library/gdbevent.ith b/gdb/gdbtk/library/gdbevent.ith
new file mode 100644 (file)
index 0000000..95b52ab
--- /dev/null
@@ -0,0 +1,124 @@
+# GDBEvent class definitions 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.
+
+# For reasons unknown to me, I cannot put any of the constructors
+# in the implementation files. The very first instance of the class
+# will call the (empty) constructor in here instead of the one
+# defined in the implementation file. Sigh.
+
+class GDBEvent {
+  public method get {what} { return "" }
+  public method handler {} { return "unknown" }
+}
+
+# BREAKPOINT EVENT
+#
+# action ....... what type of BP event ("create", "delete", "modify")
+# number ....... gdb's internal token for the BP
+# file ......... filename in which event occurred
+# function ..... function in which event occurred
+# line ......... line number in file
+# address ...... address of BP
+# type ......... breakpoint type ("breakpoint", "hw breakpoint", "step resume", etc)
+# enabled ...... BP enabled?
+# disposition .. BP's disposition ("delete", "delstop", "disable", "donttouch")
+# ignore_count . BP's ignore count
+# commands ..... list of commands to run when BP hit
+# condition .... BP condition
+# thread ....... thread in which BP is set (or -1 for all threads) 
+# hit_count .... number of times BP has been hit
+
+class BreakpointEvent {
+  inherit GDBEvent
+
+  public variable action {}
+  public variable number {}
+
+  #constructor {args} {}
+  constructor {args} {
+    eval configure $args
+
+    # If creating/modifying a breakpoint, then get
+    # all info about it and save it away.
+    _init
+  }
+  #destructor { dbug I "" }
+
+  public method get {what}
+  public method handler {} { return "breakpoint" }
+
+  private variable _file         {}
+  private variable _function     {}
+  private variable _line         {}
+  private variable _address      {}
+  private variable _type         {}
+  private variable _enabled      {}
+  private variable _disposition  {}
+  private variable _ignore_count {}
+  private variable _commands     {}
+  private variable _condition    {}
+  private variable _thread       {}
+  private variable _hit_count    {}
+
+  private method _init {}
+}
+
+# TRACEPOINT EVENT
+#
+# action ....... what type of BP event ("create", "delete", "modify")
+# number ....... gdb's internal token for the BP
+# file ......... filename in which event occurred
+# function ..... function in which event occurred
+# line ......... line number in file
+# address ...... address of BP
+# enabled ...... BP enabled?
+# pass_count ...
+# step_count ...
+# thread ....... thread in which BP is set (or -1 for all threads) 
+# hit_count .... number of times BP has been hit
+# actions ...... a list of actions to be performed when the tracepoint is hit
+class TracepointEvent {
+  inherit GDBEvent
+
+  public variable action {}
+  public variable number {}
+
+  # For reasons unknown to me, I cannot put this in the implementation
+  # file. The very first instance of the class will call this empty
+  # constructor instead of the one defined in the implementation file.
+  #constructor {args} {}
+  constructor {args} {
+    eval configure $args
+
+    # If creating/modifying a tracepoint, then get
+    # all info about it and save it away.
+    _init
+  }
+  #destructor { dbug I "" }
+  public method get {what}
+  public method handler {} { return "tracepoint" }
+
+
+  private variable _file       {}
+  private variable _function   {}
+  private variable _line       {}
+  private variable _address    {}
+  private variable _enabled    {}
+  private variable _pass_count {}
+  private variable _step_count {}
+  private variable _thread     {}
+  private variable _hit_count  {}
+  private variable _actions    {}
+
+  private method _init {}
+}
index a839c0e..86fb027 100644 (file)
@@ -23,6 +23,8 @@ set auto_index(gdbtk_tcl_ignorable_warning) [list source [file join $dir interfa
 set auto_index(gdbtk_tcl_fputs) [list source [file join $dir interface.tcl]]
 set auto_index(echo) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_tcl_fputs_error) [list source [file join $dir interface.tcl]]
+set auto_index(gdbtk_tcl_fputs_log) [list source [file join $dir interface.tcl]]
+set auto_index(gdbtk_tcl_fputs_target) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_tcl_flush) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_tcl_start_variable_annotation) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_tcl_end_variable_annotation) [list source [file join $dir interface.tcl]]
@@ -132,7 +134,12 @@ set auto_index(Queue) [list source [file join $dir data.ith]]
 set auto_index(DebugWin) [list source [file join $dir debugwin.ith]]
 set auto_index(DebugWinDOpts) [list source [file join $dir debugwin.ith]]
 set auto_index(Download) [list source [file join $dir download.ith]]
+set auto_index(GDBEventHandler) [list source [file join $dir ehandler.ith]]
+set auto_index(::GDBEventHandler::dispatch) [list source [file join $dir ehandler.ith]]
 set auto_index(EmbeddedWin) [list source [file join $dir embeddedwin.ith]]
+set auto_index(GDBEvent) [list source [file join $dir gdbevent.ith]]
+set auto_index(BreakpointEvent) [list source [file join $dir gdbevent.ith]]
+set auto_index(TracepointEvent) [list source [file join $dir gdbevent.ith]]
 set auto_index(GDBWin) [list source [file join $dir gdbwin.ith]]
 set auto_index(GlobalPref) [list source [file join $dir globalpref.ith]]
 set auto_index(HtmlViewer) [list source [file join $dir helpviewer.ith]]
@@ -189,7 +196,8 @@ set auto_index(::BpWin::bp_able) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::bp_remove) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::bp_type) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::bp_delete) [list source [file join $dir bpwin.itb]]
-set auto_index(::BpWin::update) [list source [file join $dir bpwin.itb]]
+set auto_index(::BpWin::breakpoint) [list source [file join $dir bpwin.itb]]
+set auto_index(::BpWin::tracepoint) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::bp_all) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::get_actions) [list source [file join $dir bpwin.itb]]
 set auto_index(::BpWin::toggle_threads) [list source [file join $dir bpwin.itb]]
@@ -274,6 +282,13 @@ set auto_index(::Download::destructor) [list source [file join $dir download.itb
 set auto_index(::Download::do_download_hooks) [list source [file join $dir download.itb]]
 set auto_index(::Download::download_hash) [list source [file join $dir download.itb]]
 set auto_index(::Download::download_it) [list source [file join $dir download.itb]]
+set auto_index(::GDBEventHandler::dispatch) [list source [file join $dir ehandler.itb]]
+set auto_index(::BreakpointEvent::get) [list source [file join $dir gdbevent.itb]]
+set auto_index(::BreakpointEvent::_init) [list source [file join $dir gdbevent.itb]]
+set auto_index(::BreakpointEvent::number) [list source [file join $dir gdbevent.itb]]
+set auto_index(::TracepointEvent::get) [list source [file join $dir gdbevent.itb]]
+set auto_index(::TracepointEvent::_init) [list source [file join $dir gdbevent.itb]]
+set auto_index(::TracepointEvent::number) [list source [file join $dir gdbevent.itb]]
 set auto_index(::GlobalPref::_init) [list source [file join $dir globalpref.itb]]
 set auto_index(::GlobalPref::constructor) [list source [file join $dir globalpref.itb]]
 set auto_index(::GlobalPref::destructor) [list source [file join $dir globalpref.itb]]
@@ -319,7 +334,8 @@ set auto_index(::KodWin::idle) [list source [file join $dir kod.itb]]
 set auto_index(::KodWin::cursor) [list source [file join $dir kod.itb]]
 set auto_index(::KodWin::_disable_buttons) [list source [file join $dir kod.itb]]
 set auto_index(::KodWin::_restore_buttons) [list source [file join $dir kod.itb]]
-set auto_index(::ManagedWin::reconfig) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::constructor) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::destructor) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::window_name) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::pickle) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::reveal) [list source [file join $dir managedwin.itb]]
@@ -331,12 +347,11 @@ set auto_index(::ManagedWin::open) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::_open) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::_create) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::find) [list source [file join $dir managedwin.itb]]
-set auto_index(::ManagedWin::enable) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::init) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::destroy_toplevel) [list source [file join $dir managedwin.itb]]
-set auto_index(::ManagedWin::freeze_me) [list source [file join $dir managedwin.itb]]
-set auto_index(::ManagedWin::thaw_me) [list source [file join $dir managedwin.itb]]
-set auto_index(::ManagedWin::make_icon_window) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::_freeze_me) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::_thaw_me) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::_make_icon_window) [list source [file join $dir managedwin.itb]]
 set auto_index(::MemPref::constructor) [list source [file join $dir mempref.itb]]
 set auto_index(::MemPref::destructor) [list source [file join $dir mempref.itb]]
 set auto_index(::MemPref::build_win) [list source [file join $dir mempref.itb]]
@@ -449,6 +464,8 @@ set auto_index(::SrcTextWin::display_line) [list source [file join $dir srctextw
 set auto_index(::SrcTextWin::display_breaks) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::insertBreakTag) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::removeBreakTag) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::breakpoint) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::tracepoint) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::bp) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::do_bp) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::hasBP) [list source [file join $dir srctextwin.itb]]