+2001-05-31 Keith Seitz <keiths@redhat.com>
+
+ * library/interface.tcl (gdb_busy_hook): Deprecate.
+ (gdbtk_busy): Create and dispatch a BusyEvent instead
+ of running hooks.
+ * library/ehandler.ith (busy): New event handler.
+ * library/gdbevent.ith (BusyEvent): New event class.
+ * library/console.ith: Inherit from GDBEventHandler.
+ (busy): Match event handler definition.
+ * library/console.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_event.
+ (destructor): Ditto.
+ * library/kod.ith (busy): Match event handler definition.
+ * library/kod.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/memwin.ith (busy): Match event handler definition.
+ * library/memwin.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/pluginwin.itcl (running): Rename to "busy" and
+ match event handler definition.
+ (consturctor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/process.ith (busy): Match event handler definition.
+ * library/process.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/regwin.ith (busy): Match event handler definition.
+ * library/regwin.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/srcbar.itcl (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ (busy): New method.
+ * library/srcwin.ith (busy): Match event handler definition.
+ * library/srcwin.itb (busy): Ditto.
+ Only do the "busy" stuff if do_updates is set.
+ (toggle_updates): Remove gdb_busy_hook.
+ (constructor): Ditto.
+ (destructor): Ditto.
+ * library/stackwin.ith (busy): Match event handler definition.
+ * library/stackwin.itb (busy): Ditto.
+ (constructor): Remove gdb_busy_hook.
+ (destructor): Ditto.
+ * library/variables.tcl (constructor): Ditto.
+ (destructor): Ditto.
+ (disable_ui): Rename to "busy" and match event handler
+ definition.
+ * library/plugins/rhabout/rhabout.itcl (running): Rename
+ to "busy" and match new event handler definition.
+ * library/tclIndex: Regenerated.
+
2001-05-25 Keith Seitz <keiths@cygnus.com>
* generic/gdbtk-cmds.c (bin2hex): New function.
debug "$args"
_build_win
eval itk_initialize $args
- add_hook gdb_busy_hook [list $this busy]
add_hook gdb_idle_hook [list $this idle]
add_hook gdb_no_inferior_hook [list $this idle]
body Console::destructor {} {
global gdbtk_state
set gdbtk_state(console) ""
- remove_hook gdb_busy_hook [list $this busy]
remove_hook gdb_idle_hook [list $this idle]
remove_hook gdb_no_inferior_hook [list $this idle]
set _running 0
}
-body Console::busy {} {
+# ------------------------------------------------------------------
+# METHOD: busy - busy event handler
+# ------------------------------------------------------------------
+body Console::busy {event} {
set _running 1
}
# ----------------------------------------------------------------------
class Console {
- inherit EmbeddedWin
+ inherit EmbeddedWin GDBEventHandler
public {
#Approximate maximum number of lines allowed in widget
method constructor {args}
method destructor {}
method idle {}
- method busy {}
method insert {line}
method einsert {line tag}
method invoke {}
method _insertion {args}
method get_text {}
method activate {{prompt {}}}
+
+ #
+ # GDB Events
+ #
+ method busy {event}
}
private {
# Set variable
method set_variable {event} {}
+
+ # Busy event
+ method busy {event} {}
}
}
public method get {what}
public method handler {} { return "set_variable" }
}
+
+# BUSY EVENT
+#
+# This event is created/dispatched whenever the GUI or GDB is "busy".
+# This could happen when the inferior is executing or when the GUI
+# is, for example, fetching memory from the target.
+
+class BusyEvent {
+ inherit GDBEvent
+
+ public method handler {} { return "busy" }
+}
# For debugging purposes, please put debug statements at the very
# beginning and ends of all GUI state hooks.
+# *** DEPRECATED: Use GDBEventHandler::busy instead.
# GDB_BUSY_HOOK
# This hook is used to register a callback when the UI should
# be disabled because the debugger is either busy or talking
#
# All callbacks should disable ALL user input which could cause
# any state changes in either the target or the debugger.
-define_hook gdb_busy_hook
+#define_hook gdb_busy_hook
# GDB_IDLE_HOOK
# This hook is used to register a callback when the UI should
# ------------------------------------------------------------------
-# PROCEDURE: gdbtk_busy - run all busy hooks
+# PROCEDURE: gdbtk_busy - Dispatch a busy event
#
# Use this procedure from within GUI code to indicate that
# the debugger is busy, either running the inferior or
-# talking to the target. This will call all the registered
-# gdb_busy_hook's.
+# talking to the target.
# ------------------------------------------------------------------
proc gdbtk_busy {} {
- set err [catch {run_hooks gdb_busy_hook} txt]
- if {$err} {
- dbug E "$txt"
- }
+ set e [BusyEvent \#auto]
+ GDBEventHandler::dispatch $e
+ delete object $e
# Force the screen to update
update
# Add hooks for this object
add_hook gdb_update_hook [code $this update]
- add_hook gdb_busy_hook [code $this busy]
add_hook gdb_idle_hook [code $this idle]
}
remove_hook gdb_update_hook [code $this update]
remove_hook gdb_idle_hook [code $this idle]
- remove_hook gdb_busy_hook [code $this busy]
}
# ------------------------------------------------------------------
}
# ------------------------------------------------------------------
-# METHOD: busy - gdb_busy_hook
+# METHOD: busy - BusyEvent handler
#
# This method should accomplish blocking
# - clicks in the window
# - change mouse pointer
# ------------------------------------------------------------------
-body KodWin::busy {} {
+body KodWin::busy {event} {
set Running 1
_disable_buttons
cursor watch
method clear {}
method top {}
method up {}
- method busy {}
method idle {}
method cursor {glyph}
method _disable_buttons {}
# Gdb Events
#
method set_variable {event}
+ method busy {event}
}
}
gdbtk_idle
add_hook gdb_update_hook "$this update"
- add_hook gdb_busy_hook [list $this busy]
add_hook gdb_idle_hook [list $this idle]
}
$prefs_win cancel
}
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_busy_hook [list $this busy]
remove_hook gdb_idle_hook [list $this idle]
}
# ------------------------------------------------------------------
-# METHOD: busy - disable menus 'cause we're busy updating things
+# METHOD: busy - BusyEvent handler
+# Disable menus 'cause we're busy updating things.
# ------------------------------------------------------------------
-body MemWin::busy {} {
+body MemWin::busy {event} {
# Fencepost
set Running 1
method toggle_enabled {}
method update {}
method idle {}
- method busy {}
method newsize {height}
method update_address_cb {}
method update_address { {ae ""} }
method goto {addr}
method memMoveCell {w x y}
method error_dialog {msg {modality task} {type ok}}
+
+ #
+ # GDB Events
+ #
+ method busy {event}
}
}
window_name "About Red Hat Insight Plug-In"
}
- # You can overload the base class running method, but make sure
+ # You can overload the base class busy 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 running {} {
+ public method busy {event} {
debug
# Call the baseclass version
- PluginWindow::running
+ PluginWindow::busy $event
# Display something in the status area
$_status configure -text "Running..."
# ----------------------------------------------------------------------
class PluginWindow {
- inherit ManagedWin
+ inherit ManagedWin GDBEventHandler
# ------------------------------------------------------------------
# CONSTRUCTOR - create widget
eval itk_initialize $args
add_hook gdb_idle_hook [code $this stopped]
- add_hook gdb_busy_hook [code $this running]
add_hook gdb_no_inferior_hook [code $this no_inferior]
}
# ------------------------------------------------------------------
destructor {
remove_hook gdb_idle_hook [code $this stopped]
- remove_hook gdb_busy_hook [code $this running]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
#destroy $this
}
# ------------------------------------------------------------------
- # METHOD: running
+ # METHOD: busy - BusyEvent handler
# Invoked when gdb is going to run the inferior
# ------------------------------------------------------------------
- protected method running {} {
- debug "PluginWindow::running"
+ public method busy {event} {
+ debug "PluginWindow::busy"
enable_ui 0
}
# Add hooks for this object
add_hook gdb_update_hook [code $this update]
- add_hook gdb_busy_hook [code $this busy]
add_hook gdb_no_inferior_hook [code $this idle]
add_hook gdb_idle_hook [code $this idle]
}
body ProcessWin::destructor {} {
remove_hook gdb_update_hook [code $this update]
remove_hook gdb_idle_hook [code $this idle]
- remove_hook gdb_busy_hook [code $this busy]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
}
# ------------------------------------------------------------------
-# METHOD: busy - gdb_busy_hook
+# METHOD: busy - BusyEvent handler
#
# This method should accomplish blocking
# - clicks in the window
# - change mouse pointer
# ------------------------------------------------------------------
-body ProcessWin::busy {} {
+body ProcessWin::busy {event} {
set Running 1
cursor watch
}
method cursor {glyph}
method change_frame {y}
method update {}
- method busy {}
method idle {}
}
method reconfig {}
method constructor {args}
method destructor {}
+
+ #
+ # Event
+ #
+ method busy {event}
}
}
\ No newline at end of file
gdbtk_idle
add_hook gdb_update_hook "$this update"
- add_hook gdb_busy_hook [list $this busy]
add_hook gdb_idle_hook [list $this idle]
}
debug
save_reg_display_vars
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_busy_hook [list $this busy]
remove_hook gdb_idle_hook [list $this idle]
}
}
# ------------------------------------------------------------------
-# PRIVATE METHOD: busy - gdb_busy_hook
+# PUBLIC METHOD: busy - BusyEvent handler
# ------------------------------------------------------------------
-body RegWin::busy {} {
+body RegWin::busy {event} {
# Cancel edits
unedit
method update {}
method idle {}
method reconfig {}
- method busy {}
#
# Gdb Events
#
method set_variable {event}
+ method busy {event}
}
eval itk_initialize $args
add_hook gdb_idle_hook "$this enable_ui 1"
- add_hook gdb_busy_hook "$this enable_ui 0"
add_hook gdb_no_inferior_hook "$this enable_ui 2"
add_hook gdb_trace_find_hook "$this handle_trace_find_hook"
}
unset GDBSrcBar_state($this)
remove_hook gdb_idle_hook "$this enable_ui 1"
- remove_hook gdb_busy_hook "$this enable_ui 0"
remove_hook gdb_no_inferior_hook "$this enable_ui 2"
remove_hook gdb_trace_find_hook "$this handle_trace_find_hook"
}
}
\f
+ # ------------------------------------------------------------------
+ # METHOD: busy - BusyEvent handler
+ # ------------------------------------------------------------------
+ method busy {event} {
+ enable_ui 0
+ }
+\f
####################################################################
#
# PRIVATE DATA
set update_hook_init 1
add_hook gdb_update_hook "SrcWin::choose_and_update"
}
- add_hook gdb_busy_hook "$this busy"
add_hook gdb_idle_hook "$this idle"
add_hook gdb_no_inferior_hook "$this no_inferior"
add_hook download_progress_hook "$this download_progress"
# ------------------------------------------------------------------
body SrcWin::destructor {} {
debug
- remove_hook gdb_busy_hook "$this busy"
remove_hook gdb_no_inferior_hook "$this no_inferior"
remove_hook gdb_idle_hook "$this idle"
remove_hook download_progress_hook "$this download_progress"
body SrcWin::toggle_updates {value} {
if {$value} {
add_hook gdb_update_hook "$this update"
- add_hook gdb_busy_hook "$this busy"
} else {
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_busy_hook "$this busy"
}
# save state in do_updates so it will be preserved
# in window reconfigs
# ------------------------------------------------------------------
# PUBLIC METHOD: busy - disable things when gdb is busy
# ------------------------------------------------------------------
-body SrcWin::busy {} {
+body SrcWin::busy {event} {
global gdb_loaded gdb_target_name
# debug "gdb_loaded=$gdb_loaded, gdb_target_name=$gdb_target_name"
- enable_ui 0
- if {$Running} {
- $_toolbar configure -runstop running
- if {$gdb_loaded || \
- ([TargetSelection::native_debugging] && $gdb_target_name != "remote")} {
- set_status "Program is running."
- }
- } else {
- $_toolbar configure -runstop busy
+ if {$do_updates} {
+ enable_ui 0
+ if {$Running} {
+ $_toolbar configure -runstop running
+ if {$gdb_loaded || \
+ ([TargetSelection::native_debugging] && $gdb_target_name != "remote")} {
+ set_status "Program is running."
+ }
+ } else {
+ $_toolbar configure -runstop busy
+ }
}
}
inherit TopLevelWin GDBWin
public {
- method busy {}
method constructor {args}
method destructor {}
method download_progress { section num tot {msg ""} }
proc choose_and_update {}
proc choose_and_display {tag linespec}
proc point_to_main {}
+
+ #
+ # GDB Events
+ #
+ method busy {event}
}
private {
gdbtk_idle
add_hook gdb_update_hook [code $this update]
- add_hook gdb_busy_hook [code $this busy]
add_hook gdb_no_inferior_hook [code $this no_inferior]
add_hook gdb_idle_hook [code $this idle]
}
body StackWin::destructor {} {
remove_hook gdb_update_hook [code $this update]
remove_hook gdb_idle_hook [code $this idle]
- remove_hook gdb_busy_hook [code $this busy]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
}
# ------------------------------------------------------------------
-# METHOD: busy - gdb_busy_hook
-#
-# This body StackWin::should accomplish blocking
-# - clicks in the window
-# - change mouse pointer
+# PUBLIC METHOD: busy - BusyEvent handler
+# This method should cause blocking of clicks in
+# the window and change mouse pointer.
# ------------------------------------------------------------------
-body StackWin::busy {} {
+body StackWin::busy {event} {
set Running 1
cursor watch
}
method cursor {glyph}
method change_frame {y}
method update {}
- method busy {}
method no_inferior {}
method idle {}
}
method reconfig {}
method constructor {args}
method destructor {}
+
+ #
+ # GDB Events
+ #
+ method busy {event}
}
}
set auto_index(set_exe_name) [list source [file join $dir interface.tcl]]
set auto_index(set_exe) [list source [file join $dir interface.tcl]]
set auto_index(_open_file) [list source [file join $dir interface.tcl]]
+set auto_index(_close_file) [list source [file join $dir interface.tcl]]
set auto_index(set_target_name) [list source [file join $dir interface.tcl]]
set auto_index(set_target) [list source [file join $dir interface.tcl]]
set auto_index(run_executable) [list source [file join $dir interface.tcl]]
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(SetVariableEvent) [list source [file join $dir gdbevent.ith]]
+set auto_index(BusyEvent) [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]]
set auto_index(::MemWin::init_addr_exp) [list source [file join $dir memwin.itb]]
set auto_index(::MemWin::cursor) [list source [file join $dir memwin.itb]]
set auto_index(::MemWin::memMoveCell) [list source [file join $dir memwin.itb]]
+set auto_index(::MemWin::error_dialog) [list source [file join $dir memwin.itb]]
set auto_index(::ProcessWin::constructor) [list source [file join $dir process.itb]]
set auto_index(::ProcessWin::build_win) [list source [file join $dir process.itb]]
set auto_index(::ProcessWin::update) [list source [file join $dir process.itb]]
gdbtk_idle
add_hook gdb_update_hook "$this update"
- add_hook gdb_busy_hook "$this disable_ui"
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]
# Remove this window and all hooks
remove_hook gdb_update_hook "$this update"
- remove_hook gdb_busy_hook "$this disable_ui"
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]
}
# ------------------------------------------------------------------
- # METHOD: disable_ui
+ # PUBLIC METHOD: busy - BusyEvent handler
# Disable all ui elements that could affect gdb's state
# ------------------------------------------------------------------
- method disable_ui {} {
+ method busy {event} {
# Set fencepost
set Running 1