(gdbtk_update): Dispatch and UpdateEvent, too.
* library/ehandler.ith (update): New event handler.
* library/gdbevent.ith (UpdateEvent): New event.
* library/gdbevent.itb (UpdateEvent::constructor): New method.
(UpdateEvent::get): New method.
* library/kod.ith (udpate): Match event handler definition.
* library/kod.itb (update): Ditto.
(build_win): Pass dummy argument to update method.
(top): Ditto.
(up): Ditto.
(set_variable): Ditto.
* library/memwin.ith (update): Match event handler definition.
* library/memwin.itb (update): Ditto.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
* library/process.ith (update): Match event handler definition.
* library/process.itb (update): Ditto.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
(build_win): Pass dummy argument to update method.
* library/regwin.ith (update): Match event handler definition.
* library/regwin.itb (update): Ditto.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
(build_win): Pass dummy argument to update method.
(but3): Ditto.
(unedit): Ditto.
* library/stackwin.ith (update): Match event handler definition.
* library/stackwin.itb (update): Ditto.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
(build_win): Pass dummy argument to update method.
* library/tdump.tcl (update): Match event handler definition.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
(build_win): Pass dummy argument to update method.
* library/variables.tcl (update): Match event handler definition.
(build_win): Pass dummy argument to update method.
* library/locals.tcl (update): Match event handler definition.
(constructor): Pass dummy argument to update method.
* library/watch.tcl (update): Match event handler definition.
Pass dummy argument to VariableWin::update.
(add): Pass dummy argument to update method.
* library/srcwin.ith (update): New method.
(update_hook_init): Remove.
* library/srcwin.itb (update): New method.
(constructor): Remove gdb_update_hook.
(destructor): Ditto.
* tclIndex: Regenerate.
+2001-06-04 Keith Seitz <keiths@redhat.com>
+
+ * library/interface.tcl (gdb_update_hook): Mark as deprecated.
+ (gdbtk_update): Dispatch and UpdateEvent, too.
+ * library/ehandler.ith (update): New event handler.
+ * library/gdbevent.ith (UpdateEvent): New event.
+ * library/gdbevent.itb (UpdateEvent::constructor): New method.
+ (UpdateEvent::get): New method.
+ * library/kod.ith (udpate): Match event handler definition.
+ * library/kod.itb (update): Ditto.
+ (build_win): Pass dummy argument to update method.
+ (top): Ditto.
+ (up): Ditto.
+ (set_variable): Ditto.
+ * library/memwin.ith (update): Match event handler definition.
+ * library/memwin.itb (update): Ditto.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ * library/process.ith (update): Match event handler definition.
+ * library/process.itb (update): Ditto.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ (build_win): Pass dummy argument to update method.
+ * library/regwin.ith (update): Match event handler definition.
+ * library/regwin.itb (update): Ditto.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ (build_win): Pass dummy argument to update method.
+ (but3): Ditto.
+ (unedit): Ditto.
+ * library/stackwin.ith (update): Match event handler definition.
+ * library/stackwin.itb (update): Ditto.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ (build_win): Pass dummy argument to update method.
+ * library/tdump.tcl (update): Match event handler definition.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ (build_win): Pass dummy argument to update method.
+ * library/variables.tcl (update): Match event handler definition.
+ (build_win): Pass dummy argument to update method.
+ * library/locals.tcl (update): Match event handler definition.
+ (constructor): Pass dummy argument to update method.
+ * library/watch.tcl (update): Match event handler definition.
+ Pass dummy argument to VariableWin::update.
+ (add): Pass dummy argument to update method.
+ * library/srcwin.ith (update): New method.
+ (update_hook_init): Remove.
+ * library/srcwin.itb (update): New method.
+ (constructor): Remove gdb_update_hook.
+ (destructor): Ditto.
+ * tclIndex: Regenerate.
+
2001-06-01 Keith Seitz <keiths@redhat.com>
* library/console.itb (constructor): Pass dummy argument
# Idle event
method idle {event} {}
+
+ # Update event
+ method update {event} {}
}
}
default { error "unknown event data \"$what\": should be: variable|value" }
}
}
+
+# ------------------------------------------------------------
+# CONSTRUCTOR: Create an UpdateEvent
+# ------------------------------------------------------------
+body UpdateEvent::constructor {args} {
+ if {[catch {gdb_loc} loc]} {
+ dbug E "could not get current location: $loc"
+ } else {
+ lassign $loc _compile_filename _function _full_filename \
+ _line _frame_pc _pc _shlib
+ }
+}
+
+# ------------------------------------------------------------
+# PUBLIC METHOD: get - Retrieve data about the event
+# ------------------------------------------------------------
+body UpdateEvent::get {what} {
+
+ switch $what {
+ compile_filename { return $_compile_filename }
+ full_filename { return $_full_filename }
+ function { return $_function }
+ line { return $_line }
+ frame_pc { return $_frame_pc }
+ pc { return $_pc }
+ shlib { return $_shlib }
+
+ default { error "unknown event data \"$what\": should be: variable|value" }
+ }
+}
public method handler {} { return "idle" }
}
+
+# UPDATE EVENT
+#
+# This event is created/dispatched whenever the target's state
+# has changed. When an UpdateEvent is received, widgets should
+# update their contents to reflect the inferior's new state.
+#
+# Right now, this just holds the output of gdb_loc...
+#
+# compile_filename - Filename stored in the symtab
+# full_filename - Full filename of file, if found in source search dir
+# function - Function name
+# line - Line number
+# frame_pc - Frame's PC
+# pc - Real stop PC
+# shlib - Shared library stopped in
+#
+# FIXME: Should probably put frame_pc and pc into different
+# types of update events...
+class UpdateEvent {
+ inherit GDBEvent
+
+ constructor {args} {}
+ public method get {what}
+ public method handler {} { return "update" }
+
+ private variable _compile_filename {}
+ private variable _function {}
+ private variable _full_filename {}
+ private variable _line {}
+ private variable _frame_pc {}
+ private variable _pc {}
+ private variable _shlib {}
+}
# time delays when enabling the UI.
define_hook gdb_idle_hook
+# *** DEPRECATED: Use GDBEventHandler::update instead.
# GDB_UPDATE_HOOK
# This hook is used to register a callback to update the widget
# when debugger state has changed.
-define_hook gdb_update_hook
+#define_hook gdb_update_hook
# GDB_NO_INFERIOR_HOOK
# This hook is used to register a callback which should be invoked
# that could change target state.
# ------------------------------------------------------------------
proc gdbtk_update {} {
- set err [catch {run_hooks gdb_update_hook} txt]
- if {$err} {
- dbug E "$txt"
- }
+
+ set e [UpdateEvent \#auto]
+ GDBEventHandler::dispatch $e
+ delete object $e
# Force the screen to update
update
gdbtk_busy
build_win
gdbtk_idle
-
- # Add hooks for this object
- add_hook gdb_update_hook [code $this update]
}
# ------------------------------------------------------------------
# window_name "Kernel Objects"
- update
+ update dummy
}
# ------------------------------------------------------------------
# METHOD: update - update widget when something changes
# ------------------------------------------------------------------
-body KodWin::update {} {
+body KodWin::update {event} {
debug "updating kod window"
set LevelCmd($level) $LevelCmd([expr $level-1])
append LevelCmd($level) $object
debug "kod command for level $level is now: $LevelCmd($level)"
- update
+ update dummy
# Run idle hooks and cause all other widgets to update
gdbtk_idle
}
debug "going to top from level $level"
if {$level > 0} {
set level 0
- update
+ update dummy
}
}
if {$level > 0} {
incr level -1
debug "...to level $level"
- update
+ update dummy
}
}
catch {unset pane1_vals}
catch {unset pane2_vals}
catch {unset kodActivePane}
-
- remove_hook gdb_update_hook [code $this update]
}
# ------------------------------------------------------------------
if {[$event get variable] == "os" && $value != ""} {
set LevelCmd(0) "info $value "
set level 0
- update
+ update dummy
}
}
variable BState
variable Running 0
method build_win {}
- method update {}
method display {}
method display_list {}
method display_object {{cmd ""} {obj ""}}
method set_variable {event}
method busy {event}
method idle {event}
+ method update {event}
}
}
# CONSTRUCTOR - create new locals window
# ------------------------------------------------------------------
constructor {args} {
- update
+ update dummy
}
# ------------------------------------------------------------------
return [$_frame variables]
}
- method update {} {
+ method update {event} {
global Update Display
debug "START LOCALS UPDATE CALLBACK"
}
# Update variables in window
- VariableWin::update
+ VariableWin::update dummy
debug "END LOCALS UPDATE CALLBACK"
}
init_addr_exp
build_win
gdbtk_idle
-
- add_hook gdb_update_hook "$this update"
}
# ------------------------------------------------------------------
if {[winfo exists $prefs_win]} {
$prefs_win cancel
}
- remove_hook gdb_update_hook "$this update"
}
# ------------------------------------------------------------------
# METHOD: update - update widget after every PC change
# ------------------------------------------------------------------
-body MemWin::update {} {
+body MemWin::update {event} {
global _mem
if {$_mem($this,enabled)} {
update_address
method changed_cell {from to}
method edit {cell}
method toggle_enabled {}
- method update {}
method newsize {height}
method update_address_cb {}
method update_address { {ae ""} }
#
method busy {event}
method idle {event}
+ method update {event}
}
}
gdbtk_idle
# Add hooks for this object
- add_hook gdb_update_hook [code $this update]
add_hook gdb_no_inferior_hook [code $this idle]
}
-selectforeground black \
-font src-font \
-exportselection false
- update
+ update dummy
balloon register $lb "Click on a line to change context"
# bind mouse button 1 to change the current context
# ------------------------------------------------------------------
# METHOD: update - update widget when something changes
# ------------------------------------------------------------------
-body ProcessWin::update {} {
+body ProcessWin::update {event} {
if {!$protect_me} {
$lb delete 0 end
# DESTRUCTOR - destroy window containing widget
# ------------------------------------------------------------------
body ProcessWin::destructor {} {
- remove_hook gdb_update_hook [code $this update]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
method change_context {y}
method cursor {glyph}
method change_frame {y}
- method update {}
}
public {
method destructor {}
#
- # Event
+ # GDB Events
#
method busy {event}
method idle {event}
+ method update {event}
}
}
\ No newline at end of file
eval itk_initialize $args
gdbtk_idle
- add_hook gdb_update_hook "$this update"
}
# ------------------------------------------------------------------
body RegWin::destructor {} {
debug
save_reg_display_vars
- remove_hook gdb_update_hook "$this update"
}
$m add cascade -menu $itk_interior.m.reg.format -label "Format" -underline 0
set f [menu $itk_interior.m.reg.format]
$f add radio -label "Hex" -value x -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Decimal" -value d -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Natural" -value {} -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Binary" -value t -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Octal" -value o -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Raw" -value r -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$f add radio -label "Floating Point" -value f -underline 0 -state disabled \
- -command "$this update"
+ -command "$this update dummy"
$m add command -label "Remove from Display" -underline 0 -state disabled
$m add separator
$m add command -label "Add to Watch" -underline 7 -state disabled
$Menu add command -label $reg_display($rn,name) -state disabled
$Menu add separator
if {!$reg_display($rn,typed)} {
- $Menu add radio -label "Hex" -command "$this update" \
+ $Menu add radio -label "Hex" -command "$this update dummy" \
-value x -variable reg_display($rn,format)
- $Menu add radio -label "Decimal" -command "$this update" \
+ $Menu add radio -label "Decimal" -command "$this update dummy" \
-value d -variable reg_display($rn,format)
- $Menu add radio -label "Natural" -command "$this update" \
+ $Menu add radio -label "Natural" -command "$this update dummy" \
-value {} -variable reg_display($rn,format)
- $Menu add radio -label "Binary" -command "$this update" \
+ $Menu add radio -label "Binary" -command "$this update dummy" \
-value t -variable reg_display($rn,format) -underline 0
- $Menu add radio -label "Octal" -command "$this update" \
+ $Menu add radio -label "Octal" -command "$this update dummy" \
-value o -variable reg_display($rn,format)
- $Menu add radio -label "Raw" -command "$this update" \
+ $Menu add radio -label "Raw" -command "$this update dummy" \
-value r -variable reg_display($rn,format)
- $Menu add radio -label "Floating Point" -command "$this update" \
+ $Menu add radio -label "Floating Point" -command "$this update dummy" \
-value f -variable reg_display($rn,format)
$Menu add separator
}
grid $ScrolledWin.$Editing.val -column 1 -row 0
focus -force $ScrolledWin.$Editing
set Editing -1
- update
+ update dummy
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: update - update widget when PC changes
# ------------------------------------------------------------------
-body RegWin::update {} {
+body RegWin::update {event} {
global reg_display
debug "START REGISTER UPDATE CALLBACK"
if {$reg_display_list == ""
method edit {r}
method acceptEdit {r}
method unedit {}
- method update {}
method reconfig {}
#
method set_variable {event}
method busy {event}
method idle {event}
+ method update {event}
}
wm protocol $top WM_DELETE_WINDOW "[code $this _exit]"
# add hooks
- if {! $update_hook_init} then {
- set update_hook_init 1
- add_hook gdb_update_hook "SrcWin::choose_and_update"
- }
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]
# PRIVATE PUBLIC METHOD: toggle_updates - update toggle callback
# ------------------------------------------------------------------
body SrcWin::toggle_updates {value} {
- if {$value} {
- add_hook gdb_update_hook "$this update"
- } else {
- remove_hook gdb_update_hook "$this update"
- }
# save state in do_updates so it will be preserved
# in window reconfigs
set do_updates $value
}
# ------------------------------------------------------------------
+# PUBLIC METHOD: update - The inferior's state has changed.
+# ------------------------------------------------------------------
+body SrcWin::update {event} {
+
+ # FIXME: This is kinda lame. We need to run this only once
+ # as it is now written, so only the first window in the list
+ # will actually call choose_and_update.
+ # This is still better than before, since it will not
+ # matter if this window is destroyed: as long as _a_
+ # SrcWin exists, this will get called.
+ if {[lindex $window_list 0] == $this} {
+ choose_and_update
+ }
+}
+
+# ------------------------------------------------------------------
# PRIVATE METHOD: _set_name - set the name in the name combobox and in the title
# ------------------------------------------------------------------
body SrcWin::_set_name { val {found 1} } {
#
method busy {event}
method idle {event}
+ method update {event}
}
private {
# source windows.
common window_list ""
common pc_window ""
- common update_hook_init 0
# fenceposts
variable Running 0
build_win
gdbtk_idle
- add_hook gdb_update_hook [code $this update]
add_hook gdb_no_inferior_hook [code $this no_inferior]
}
# DESTRUCTOR - destroy window containing widget
# ------------------------------------------------------------------
body StackWin::destructor {} {
- remove_hook gdb_update_hook [code $this update]
remove_hook gdb_no_inferior_hook [code $this no_inferior]
}
-selectforeground black \
-font src-font \
-exportselection false
- update
+ update dummy
$lb configure -width $maxwidth
# bind mouse button 1 to change the stack frame
# ------------------------------------------------------------------
# METHOD: update - update widget when PC changes
# ------------------------------------------------------------------
-body StackWin::update {} {
+body StackWin::update {event} {
global gdb_selected_frame_level
if {!$protect_me} {
method build_win {}
method cursor {glyph}
method change_frame {y}
- method update {}
method no_inferior {}
}
#
method busy {event}
method idle {event}
+ method update {event}
}
}
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(IdleEvent) [list source [file join $dir gdbevent.ith]]
+set auto_index(UpdateEvent) [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(::TracepointEvent::number) [list source [file join $dir gdbevent.itb]]
set auto_index(::TracepointEvent::get) [list source [file join $dir gdbevent.itb]]
set auto_index(::SetVariableEvent::get) [list source [file join $dir gdbevent.itb]]
+set auto_index(::UpdateEvent::constructor) [list source [file join $dir gdbevent.itb]]
+set auto_index(::UpdateEvent::get) [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]]
set auto_index(::SrcWin::mode) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::_update_title) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::busy) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::update) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::_set_name) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::set_status) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::set_execution_status) [list source [file join $dir srcwin.itb]]
wm withdraw $top
build_win
- add_hook gdb_update_hook "$this update"
after idle [list wm deiconify $top]
}
$twin configure -insertwidth 0
pack append [namespace tail $this] [namespace tail $this].stext {left expand fill}
- update
+ update dummy
}
# ------------------------------------------------------------------
# METHOD: update - update widget when PC changes
# ------------------------------------------------------------------
- method update {} {
+ method update {event} {
#debug "tdump: update"
gdbtk_busy
set tframe_num [gdb_get_trace_frame_num]
# DESTRUCTOR - destroy window containing widget
# ------------------------------------------------------------------
destructor {
- remove_hook gdb_update_hook "$this update"
set top [winfo toplevel [namespace tail $this]]
destroy $this
destroy $top
build_win $itk_interior
gdbtk_idle
- add_hook gdb_update_hook "$this update"
add_hook gdb_no_inferior_hook "$this no_inferior"
add_hook gdb_clear_file_hook [code $this clear_file]
# FIXME: This is too harsh. We must add to varobj a method
# Update the tree display
- update
+ update dummy
pack $Tree -expand yes -fill both
# Create the popup menu for this widget
destroy $DisabledTextStyle
# 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_clear_file_hook [code $this clear_file]
remove_hook file_changed_hook [code $this clear_file]
# METHOD: update
# OVERRIDE THIS METHOD and call it from there
# ------------------------------------------------------------------
- method update {} {
+ method update {event} {
global Update
debug
return $list
}
- method update {} {
+ method update {event} {
global Update Display
debug "START WATCH UPDATE CALLBACK"
catch {populate {}} msg
- catch {VariableWin::update} msg
+ catch {VariableWin::update dummy} msg
debug "Did VariableWin::update with return \"$msg\""
# Make sure all variables are marked as _not_ Openable?
set var [gdb_variable create -expr $name]
set ::Update($this,$var) 1
lappend Watched $var
- update
+ update dummy
return 1
}
}