This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[PATCH] gdb_idle_hook -> GDBEventHandler::idle
- To: Insight Maling List <insight at sources dot redhat dot com>
- Subject: [PATCH] gdb_idle_hook -> GDBEventHandler::idle
- From: Keith Seitz <keiths at cygnus dot com>
- Date: Thu, 31 May 2001 13:34:58 -0700 (PDT)
Hi,
This patch converts gdb_idle_hook into a method call in GDBEventHandler.
The hook is NOT (yet) gone because of the stop button's dependencies on
it.
When I write a stop button class, I will get rid of this hook once and for
all.
Again, it's a large patch, I've attempted to test everything, but I've
probably missed a lot. If you find something, please let me know.
Keith
ChangeLog:
2001-05-31 Keith Seitz <keiths@redhat.com>
* library/interface.tcl (gdb_idle_hook): Mark as deprecated.
(gdbtk_idle): Dispatch an IdleEvent. gdb_idle_hook is gone.
* library/ehandler.ith (idle): New event handler.
* library/gdbevent.ith (IdleEvent): New event.
* library/console.ith (idle): Match event handler definition.
* library/console.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/kod.ith (idle): Match event handler definition.
* library/kod.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/memwin.ith (idle): Match event handler definition.
* library/memwin.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/pluginwin.itcl (stopped): Rename to "idle" and
match event handler definition.
Fix misleading comments.
* library/process.ith (idle): Match event handler definition.
* library/process.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/regwin.ith (idle): Match event handler definition.
* library/regwin.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/srcbar.itcl (idle): New method.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/srcwin.ith (idle): Match event handler definition.
* library/srcwin.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/stackwin.ith (idle): Match event handler definition.
* library/stackwin.itb (idle): Ditto.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/variables.tcl (idle): Match event handler definition.
(constructor): Remove gdb_idle_hook.
(destructor): Ditto.
* library/plugins/rhabout/rhabout.itcl (stopped): Rename
to "idle" and match new event handler definition.
* library/tclIndex: Regenerated.
Patch:
Index: console.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
retrieving revision 1.9
diff -u -p -r1.9 console.itb
--- console.itb 2001/05/31 15:21:40 1.9
+++ console.itb 2001/05/31 20:28:51
@@ -19,7 +19,6 @@ body Console::constructor {args} {
debug "$args"
_build_win
eval itk_initialize $args
- add_hook gdb_idle_hook [list $this idle]
add_hook gdb_no_inferior_hook [list $this idle]
# Right now the preferences window directly uses preference
@@ -39,7 +38,6 @@ body Console::constructor {args} {
body Console::destructor {} {
global gdbtk_state
set gdbtk_state(console) ""
- remove_hook gdb_idle_hook [list $this idle]
remove_hook gdb_no_inferior_hook [list $this idle]
# foreach option {gdb/console/wrap gdb/console/prompt_fg \
@@ -199,7 +197,7 @@ body Console::_build_win {} {
}
-body Console::idle {} {
+body Console::idle {event} {
set _running 0
}
Index: console.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
retrieving revision 1.4
diff -u -p -r1.4 console.ith
--- console.ith 2001/05/31 15:21:40 1.4
+++ console.ith 2001/05/31 20:28:51
@@ -26,7 +26,6 @@ class Console {
method constructor {args}
method destructor {}
- method idle {}
method insert {line}
method einsert {line tag}
method invoke {}
@@ -38,6 +37,7 @@ class Console {
# GDB Events
#
method busy {event}
+ method idle {event}
}
private {
Index: ehandler.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/ehandler.ith,v
retrieving revision 1.3
diff -u -p -r1.3 ehandler.ith
--- ehandler.ith 2001/05/31 15:21:40 1.3
+++ ehandler.ith 2001/05/31 20:28:51
@@ -35,5 +35,8 @@ class GDBEventHandler {
# Busy event
method busy {event} {}
+
+ # Idle event
+ method idle {event} {}
}
}
Index: gdbevent.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/gdbevent.ith,v
retrieving revision 1.3
diff -u -p -r1.3 gdbevent.ith
--- gdbevent.ith 2001/05/31 15:21:40 1.3
+++ gdbevent.ith 2001/05/31 20:28:51
@@ -159,3 +159,15 @@ class BusyEvent {
public method handler {} { return "busy" }
}
+
+# IDLE EVENT
+#
+# This event is created/dispatched whenever the GUI and GDB is not
+# "busy". Receipt of this event means that the GUI should be put into
+# a state to accept input by the user.
+
+class IdleEvent {
+ inherit GDBEvent
+
+ public method handler {} { return "idle" }
+}
Index: interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.23
diff -u -p -r1.23 interface.tcl
--- interface.tcl 2001/05/31 15:21:40 1.23
+++ interface.tcl 2001/05/31 20:28:52
@@ -57,6 +57,7 @@ proc gdbtk_tcl_set_variable {var val} {
# any state changes in either the target or the debugger.
#define_hook gdb_busy_hook
+# *** DEPRECATED: Use GDBEventHandler::idle instead.
# GDB_IDLE_HOOK
# This hook is used to register a callback when the UI should
# be enabled because the debugger is no longer busy.
@@ -178,11 +179,10 @@ proc gdbtk_update_safe {} {
}
# ------------------------------------------------------------------
-# PROCEDURE: gdbtk_idle - run all idle hooks
+# PROCEDURE: gdbtk_idle - dispatch IdleEvent
#
-# Use this procedure to run all the gdb_idle_hook's,
-# which should free the UI for more user input. This
-# hook should only be run AFTER all communication with
+# Use this procedure to free the UI for more user input.
+# This should only be run AFTER all communication with
# the target has halted, otherwise the risk of two (or
# more) widgets talking to the target arises.
# ------------------------------------------------------------------
@@ -192,12 +192,11 @@ proc gdbtk_idle {} {
# Put the unfiltered hook back in place, just in case
# somebody swapped it out, and then died before they
# could replace it.
-
gdb_restore_fputs
- set err [catch {run_hooks gdb_idle_hook} txt]
- if {$err} {
- dbug E "idle_hook error: $txt"
- }
+
+ set e [IdleEvent \#auto]
+ GDBEventHandler::dispatch $e
+ delete object $e
if {!$gdb_running} {
set err [catch {run_hooks gdb_no_inferior_hook} txt]
Index: kod.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/kod.itb,v
retrieving revision 1.4
diff -u -p -r1.4 kod.itb
--- kod.itb 2001/05/31 15:21:40 1.4
+++ kod.itb 2001/05/31 20:28:52
@@ -34,7 +34,6 @@ body KodWin::constructor {args} {
# Add hooks for this object
add_hook gdb_update_hook [code $this update]
- add_hook gdb_idle_hook [code $this idle]
}
# ------------------------------------------------------------------
@@ -398,7 +397,6 @@ body KodWin::destructor {} {
catch {unset kodActivePane}
remove_hook gdb_update_hook [code $this update]
- remove_hook gdb_idle_hook [code $this idle]
}
# ------------------------------------------------------------------
@@ -438,9 +436,10 @@ body KodWin::busy {event} {
}
# ------------------------------------------------------------------
-# METHOD: idle - idle hook. Run when the target is not running
+# METHOD: idle - idle event handler. Run when the target is not
+# running
# ------------------------------------------------------------------
-body KodWin::idle {} {
+body KodWin::idle {event} {
set Running 0
_restore_buttons
cursor {}
Index: kod.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/kod.ith,v
retrieving revision 1.3
diff -u -p -r1.3 kod.ith
--- kod.ith 2001/05/31 15:21:40 1.3
+++ kod.ith 2001/05/31 20:28:52
@@ -43,7 +43,6 @@ class KodWin {
method clear {}
method top {}
method up {}
- method idle {}
method cursor {glyph}
method _disable_buttons {}
method _restore_buttons {}
@@ -59,5 +58,6 @@ class KodWin {
#
method set_variable {event}
method busy {event}
+ method idle {event}
}
}
Index: memwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.itb,v
retrieving revision 1.6
diff -u -p -r1.6 memwin.itb
--- memwin.itb 2001/05/31 15:21:40 1.6
+++ memwin.itb 2001/05/31 20:28:52
@@ -50,7 +50,6 @@ body MemWin::constructor {args} {
gdbtk_idle
add_hook gdb_update_hook "$this update"
- add_hook gdb_idle_hook [list $this idle]
}
# ------------------------------------------------------------------
@@ -61,7 +60,6 @@ body MemWin::destructor {} {
$prefs_win cancel
}
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_idle_hook [list $this idle]
}
@@ -380,7 +378,7 @@ body MemWin::update {} {
# ------------------------------------------------------------------
# METHOD: idle - memory window is idle, so enable menus
# ------------------------------------------------------------------
-body MemWin::idle {} {
+body MemWin::idle {event} {
# Fencepost
set Running 0
Index: memwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.ith,v
retrieving revision 1.4
diff -u -p -r1.4 memwin.ith
--- memwin.ith 2001/05/31 15:21:40 1.4
+++ memwin.ith 2001/05/31 20:28:52
@@ -61,7 +61,6 @@ class MemWin {
method edit {cell}
method toggle_enabled {}
method update {}
- method idle {}
method newsize {height}
method update_address_cb {}
method update_address { {ae ""} }
@@ -79,5 +78,6 @@ class MemWin {
# GDB Events
#
method busy {event}
+ method idle {event}
}
}
Index: pluginwin.itcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/pluginwin.itcl,v
retrieving revision 1.3
diff -u -p -r1.3 pluginwin.itcl
--- pluginwin.itcl 2001/05/31 15:21:40 1.3
+++ pluginwin.itcl 2001/05/31 20:28:52
@@ -52,7 +52,6 @@ class PluginWindow {
pack $child -expand 1 -fill both
eval itk_initialize $args
- add_hook gdb_idle_hook [code $this stopped]
add_hook gdb_no_inferior_hook [code $this no_inferior]
}
@@ -60,7 +59,6 @@ class PluginWindow {
# DESTRUCTOR - destroy window containing widget
# ------------------------------------------------------------------
destructor {
- remove_hook gdb_idle_hook [code $this stopped]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
#destroy $this
@@ -80,11 +78,10 @@ class PluginWindow {
####################################################################
# ------------------------------------------------------------------
- # METHOD: stopped
- # Invoked when there is an inferior and it has stopped
+ # METHOD: idle - handle IdleEvent
# ------------------------------------------------------------------
- protected method stopped {} {
- debug "PluginWindow::stopped"
+ protected method idle {event} {
+ debug "PluginWindow::idle"
enable_ui 1
}
Index: process.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/process.itb,v
retrieving revision 1.2
diff -u -p -r1.2 process.itb
--- process.itb 2001/05/31 15:21:40 1.2
+++ process.itb 2001/05/31 20:28:52
@@ -29,7 +29,6 @@ body ProcessWin::constructor {args} {
# Add hooks for this object
add_hook gdb_update_hook [code $this update]
add_hook gdb_no_inferior_hook [code $this idle]
- add_hook gdb_idle_hook [code $this idle]
}
@@ -128,7 +127,6 @@ body ProcessWin::change_context {y} {
# ------------------------------------------------------------------
body ProcessWin::destructor {} {
remove_hook gdb_update_hook [code $this update]
- remove_hook gdb_idle_hook [code $this idle]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
@@ -153,9 +151,9 @@ body ProcessWin::busy {event} {
}
# ------------------------------------------------------------------
-# METHOD: idle - idle hook. Run when the target is not running
+# METHOD: idle - handle IdleEvent
# ------------------------------------------------------------------
-body ProcessWin::idle {} {
+body ProcessWin::idle {event} {
set Running 0
cursor {}
}
Index: process.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/process.ith,v
retrieving revision 1.2
diff -u -p -r1.2 process.ith
--- process.ith 2001/05/31 15:21:40 1.2
+++ process.ith 2001/05/31 20:28:52
@@ -28,7 +28,6 @@ class ProcessWin {
method cursor {glyph}
method change_frame {y}
method update {}
- method idle {}
}
public {
@@ -40,5 +39,6 @@ class ProcessWin {
# Event
#
method busy {event}
+ method idle {event}
}
}
Index: regwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/regwin.itb,v
retrieving revision 1.10
diff -u -p -r1.10 regwin.itb
--- regwin.itb 2001/05/31 15:21:40 1.10
+++ regwin.itb 2001/05/31 20:28:52
@@ -33,7 +33,6 @@ body RegWin::constructor {args} {
gdbtk_idle
add_hook gdb_update_hook "$this update"
- add_hook gdb_idle_hook [list $this idle]
}
# ------------------------------------------------------------------
@@ -43,7 +42,6 @@ body RegWin::destructor {} {
debug
save_reg_display_vars
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_idle_hook [list $this idle]
}
@@ -656,7 +654,7 @@ body RegWin::update {} {
debug "END REGISTER UPDATE CALLBACK"
}
-body RegWin::idle {} {
+body RegWin::idle {event} {
[winfo toplevel $itk_interior] configure -cursor {}
set Running 0
}
Index: regwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/regwin.ith,v
retrieving revision 1.5
diff -u -p -r1.5 regwin.ith
--- regwin.ith 2001/05/31 15:21:40 1.5
+++ regwin.ith 2001/05/31 20:28:52
@@ -60,7 +60,6 @@ class RegWin {
method acceptEdit {r}
method unedit {}
method update {}
- method idle {}
method reconfig {}
#
@@ -68,6 +67,7 @@ class RegWin {
#
method set_variable {event}
method busy {event}
+ method idle {event}
}
Index: srcbar.itcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcbar.itcl,v
retrieving revision 1.8
diff -u -p -r1.8 srcbar.itcl
--- srcbar.itcl 2001/05/31 15:21:40 1.8
+++ srcbar.itcl 2001/05/31 20:28:52
@@ -65,7 +65,6 @@ class SrcBar {
pack $Tool -expand 1 -fill both
eval itk_initialize $args
- add_hook gdb_idle_hook "$this enable_ui 1"
add_hook gdb_no_inferior_hook "$this enable_ui 2"
add_hook gdb_trace_find_hook "$this handle_trace_find_hook"
}
@@ -77,7 +76,6 @@ class SrcBar {
global GDBSrcBar_state
unset GDBSrcBar_state($this)
- remove_hook gdb_idle_hook "$this enable_ui 1"
remove_hook gdb_no_inferior_hook "$this enable_ui 2"
remove_hook gdb_trace_find_hook "$this handle_trace_find_hook"
@@ -1073,6 +1071,13 @@ Do you want to continue?" \
# ------------------------------------------------------------------
method busy {event} {
enable_ui 0
+ }
+
+ # ------------------------------------------------------------------
+ # METHOD: idle - IdleEvent handler
+ # ------------------------------------------------------------------
+ method idle {event} {
+ enable_ui 1
}
####################################################################
Index: srcwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcwin.itb,v
retrieving revision 1.13
diff -u -p -r1.13 srcwin.itb
--- srcwin.itb 2001/05/31 15:21:40 1.13
+++ srcwin.itb 2001/05/31 20:28:52
@@ -42,7 +42,6 @@ body SrcWin::constructor {args} {
set update_hook_init 1
add_hook gdb_update_hook "SrcWin::choose_and_update"
}
- add_hook gdb_idle_hook "$this idle"
add_hook gdb_no_inferior_hook "$this no_inferior"
add_hook download_progress_hook "$this download_progress"
add_hook state_hook [code $this _set_state]
@@ -60,7 +59,6 @@ body SrcWin::constructor {args} {
body SrcWin::destructor {} {
debug
remove_hook gdb_no_inferior_hook "$this no_inferior"
- remove_hook gdb_idle_hook "$this idle"
remove_hook download_progress_hook "$this download_progress"
remove_hook state_hook [code $this _set_state]
remove_hook gdb_clear_file_hook [code $this clear_file]
@@ -511,7 +509,7 @@ body SrcWin::_update {loc} {
# PUBLIC METHOD: idle - callback for gdbtk_idle
# Called when the target is idle, so enable all buttons.
# ------------------------------------------------------------------
-body SrcWin::idle {} {
+body SrcWin::idle {event} {
$_toolbar configure -runstop normal
enable_ui 1
}
Index: srcwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcwin.ith,v
retrieving revision 1.5
diff -u -p -r1.5 srcwin.ith
--- srcwin.ith 2001/05/31 15:21:40 1.5
+++ srcwin.ith 2001/05/31 20:28:52
@@ -35,7 +35,6 @@ class SrcWin {
method fillNameCB {}
method fillFuncCB {name}
method goto_func {w {val ""}}
- method idle {}
method location {tag linespec}
method mode {w new_mode {go 1}}
method no_inferior {}
@@ -61,6 +60,7 @@ class SrcWin {
# GDB Events
#
method busy {event}
+ method idle {event}
}
private {
Index: stackwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/stackwin.itb,v
retrieving revision 1.2
diff -u -p -r1.2 stackwin.itb
--- stackwin.itb 2001/05/31 15:21:40 1.2
+++ stackwin.itb 2001/05/31 20:28:52
@@ -22,7 +22,6 @@ body StackWin::constructor {args} {
add_hook gdb_update_hook [code $this update]
add_hook gdb_no_inferior_hook [code $this no_inferior]
- add_hook gdb_idle_hook [code $this idle]
}
# ------------------------------------------------------------------
@@ -30,7 +29,6 @@ body StackWin::constructor {args} {
# ------------------------------------------------------------------
body StackWin::destructor {} {
remove_hook gdb_update_hook [code $this update]
- remove_hook gdb_idle_hook [code $this idle]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
@@ -107,7 +105,7 @@ body StackWin::update {} {
}
}
-body StackWin::idle {} {
+body StackWin::idle {event} {
set Running 0
cursor {}
}
Index: stackwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/stackwin.ith,v
retrieving revision 1.2
diff -u -p -r1.2 stackwin.ith
--- stackwin.ith 2001/05/31 15:21:40 1.2
+++ stackwin.ith 2001/05/31 20:28:52
@@ -28,7 +28,6 @@ class StackWin {
method change_frame {y}
method update {}
method no_inferior {}
- method idle {}
}
public {
@@ -40,6 +39,7 @@ class StackWin {
# GDB Events
#
method busy {event}
+ method idle {event}
}
}
Index: variables.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/variables.tcl,v
retrieving revision 1.10
diff -u -p -r1.10 variables.tcl
--- variables.tcl 2001/05/31 15:21:40 1.10
+++ variables.tcl 2001/05/31 20:28:52
@@ -36,7 +36,6 @@ class VariableWin {
add_hook gdb_update_hook "$this update"
add_hook gdb_no_inferior_hook "$this no_inferior"
- add_hook gdb_idle_hook [list $this idle]
add_hook gdb_clear_file_hook [code $this clear_file]
# FIXME: This is too harsh. We must add to varobj a method
# to re-parse the expressions and compute new types so we can
@@ -166,7 +165,6 @@ class VariableWin {
# Remove this window and all hooks
remove_hook gdb_update_hook "$this update"
remove_hook gdb_no_inferior_hook "$this no_inferior"
- remove_hook gdb_idle_hook [list $this idle]
remove_hook gdb_clear_file_hook [code $this clear_file]
remove_hook file_changed_hook [code $this clear_file]
}
@@ -865,7 +863,7 @@ class VariableWin {
}
}
- method idle {} {
+ method idle {event} {
# Re-enable the UI
enable_ui
}
Index: plugins/rhabout/rhabout.itcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl,v
retrieving revision 1.7
diff -u -p -r1.7 rhabout.itcl
--- rhabout.itcl 2001/05/31 15:21:41 1.7
+++ rhabout.itcl 2001/05/31 20:28:53
@@ -70,13 +70,13 @@ class RHAbout {
$_status configure -text "Running..."
}
- # You can overload the base class stopped method, but make sure
+ # You can overload the base class idle method, but make sure
# to call it as well or the menu and button status will not be updated
# (unless this is what you want)
- private method stopped {} {
+ private method idle {} {
debug
# First call the baseclass version
- PluginWindow::stopped
+ PluginWindow::idle
# Display something in the status area
$_status configure -text "Stopped."