summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gdbtk/ChangeLog11
-rw-r--r--gdb/gdbtk/generic/gdbtk-hooks.c3
-rw-r--r--gdb/gdbtk/library/ehandler.ith3
-rw-r--r--gdb/gdbtk/library/gdbevent.itb36
-rw-r--r--gdb/gdbtk/library/gdbevent.ith29
-rw-r--r--gdb/gdbtk/library/interface.tcl20
-rw-r--r--gdb/gdbtk/library/tclIndex8
7 files changed, 101 insertions, 9 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index 202c131d467..23c8f11c86f 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,3 +1,14 @@
+2001-04-20 Keith Seitz <keiths@cygnus.com>
+
+ * library/interface.tcl (gdbtk_tcl_set_variable): New proc.
+ * library/gdbevent.ith (SetVariableEvent): New event.
+ * library/gdbevent.itb (SetVariableEvent::get): Override
+ GDBEvent::get.
+ * library/ehandler.ith (set_variable): New public method.
+ * generic/gdbtk-hooks.c (gdbtk_set_hook): Let inteface function
+ gdbtk_tcl_set_variable do all the work.
+ * tclIndex: Regenerated.
+
2001-04-19 Keith Seitz <keiths@cygnus.com>
* library/gdbevent.ith: New file. Defines new event model.
diff --git a/gdb/gdbtk/generic/gdbtk-hooks.c b/gdb/gdbtk/generic/gdbtk-hooks.c
index bb6515c05b6..c647aa1fa5f 100644
--- a/gdb/gdbtk/generic/gdbtk-hooks.c
+++ b/gdb/gdbtk/generic/gdbtk-hooks.c
@@ -556,8 +556,7 @@ gdbtk_set_hook (struct cmd_list_element *cmdblk)
char *buffer = NULL;
Tcl_DStringInit (&cmd);
- Tcl_DStringAppendElement (&cmd, "run_hooks");
- Tcl_DStringAppendElement (&cmd, "gdb_set_hook");
+ Tcl_DStringAppendElement (&cmd, "gdbtk_tcl_set_variable");
/* Append variable name as sublist. */
Tcl_DStringStartSublist (&cmd);
diff --git a/gdb/gdbtk/library/ehandler.ith b/gdb/gdbtk/library/ehandler.ith
index a5c222b5f66..f38e666cfcc 100644
--- a/gdb/gdbtk/library/ehandler.ith
+++ b/gdb/gdbtk/library/ehandler.ith
@@ -29,5 +29,8 @@ class GDBEventHandler {
# Breakpiont/tracepoint events
method breakpoint {event} {}
method tracepoint {event} {}
+
+ # Set variable
+ method set_variable {event} {}
}
}
diff --git a/gdb/gdbtk/library/gdbevent.itb b/gdb/gdbtk/library/gdbevent.itb
index c0ca2708190..b9bd738b914 100644
--- a/gdb/gdbtk/library/gdbevent.itb
+++ b/gdb/gdbtk/library/gdbevent.itb
@@ -134,3 +134,39 @@ body TracepointEvent::_init {} {
configbody TracepointEvent::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" }
+ }
+}
+
+# ------------------------------------------------------------
+# PUBLIC METHOD: get - Retrieve data about the event
+# ------------------------------------------------------------
+body SetVariableEvent::get {what} {
+
+ switch $what {
+ variable { return $variable }
+ value { return $value }
+
+ default { error "unknown event data \"$what\": should be: variable|value" }
+ }
+}
diff --git a/gdb/gdbtk/library/gdbevent.ith b/gdb/gdbtk/library/gdbevent.ith
index 95b52ab717d..6166edc7cf0 100644
--- a/gdb/gdbtk/library/gdbevent.ith
+++ b/gdb/gdbtk/library/gdbevent.ith
@@ -23,6 +23,9 @@ class GDBEvent {
# BREAKPOINT EVENT
#
+# This event is created/dispatched whenever a breakpoint is created,
+# deleted, or modified.
+#
# action ....... what type of BP event ("create", "delete", "modify")
# number ....... gdb's internal token for the BP
# file ......... filename in which event occurred
@@ -37,7 +40,6 @@ class GDBEvent {
# 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
@@ -75,6 +77,9 @@ class BreakpointEvent {
# TRACEPOINT EVENT
#
+# This event is created/dispatched whenever a tracepoint is created,
+# deleted, or modified.
+#
# action ....... what type of BP event ("create", "delete", "modify")
# number ....... gdb's internal token for the BP
# file ......... filename in which event occurred
@@ -108,7 +113,6 @@ class TracepointEvent {
public method get {what}
public method handler {} { return "tracepoint" }
-
private variable _file {}
private variable _function {}
private variable _line {}
@@ -122,3 +126,24 @@ class TracepointEvent {
private method _init {}
}
+
+# SET VARIABLE EVENT
+#
+# This event is created/dispatched whenever a "set" command successfully
+# completes in gdb's command interpreter.
+#
+# variable ..... the variable that was changed
+# value ........ the variable's new value
+class SetVariableEvent {
+ inherit GDBEvent
+
+ public variable variable
+ public variable value
+
+ constructor {args} {
+ eval configure $args
+ }
+ #destructor { dbug I "" }
+ public method get {what}
+ public method handler {} { return "set_variable" }
+}
diff --git a/gdb/gdbtk/library/interface.tcl b/gdb/gdbtk/library/interface.tcl
index 9e44a878899..9a46e3b11fb 100644
--- a/gdb/gdbtk/library/interface.tcl
+++ b/gdb/gdbtk/library/interface.tcl
@@ -21,10 +21,22 @@ set gdbtk_state(busyCount) 0
# action, the breakpoint number, and the breakpoint info.
#define_hook gdb_breakpoint_change_hook
+# *** DEPRECATED: Use GDBEventHandler::set_variable instead.
# This is run when a `set' command successfully completes in gdb. The
# first argument is the gdb variable name (as a Tcl list). The second
# argument is the new value.
-define_hook gdb_set_hook
+#define_hook gdb_set_hook
+
+# ------------------------------------------------------------
+# PROC: gdbtk_tcl_set_variable - A "set" command was issued
+# in gdb to change an internal variable. Notify
+# gui.
+# ------------------------------------------------------------
+proc gdbtk_tcl_set_variable {var val} {
+ set e [SetVariableEvent \#auto -variable $var -value $val]
+ GDBEventHandler::dispatch $e
+ delete object $e
+}
####################################################################
# #
@@ -442,7 +454,8 @@ proc gdbtk_tcl_end_variable_annotation {} {
}
# ------------------------------------------------------------------
-# PROC: gdbtk_tcl_breakpoint -
+# PROC: gdbtk_tcl_breakpoint - A breakpoint was changed -- notify
+# gui.
# ------------------------------------------------------------------
proc gdbtk_tcl_breakpoint {action bpnum} {
# debug "BREAKPOINT: $action $bpnum"
@@ -452,7 +465,8 @@ proc gdbtk_tcl_breakpoint {action bpnum} {
}
# ------------------------------------------------------------------
-# PROC: gdbtk_tcl_tracepoint -
+# PROC: gdbtk_tcl_tracepoint - A tracepoint was changed -- notify
+# gui.
# ------------------------------------------------------------------
proc gdbtk_tcl_tracepoint {action tpnum} {
# debug "TRACEPOINT: $action $tpnum"
diff --git a/gdb/gdbtk/library/tclIndex b/gdb/gdbtk/library/tclIndex
index 86fb02775bb..78adec0306d 100644
--- a/gdb/gdbtk/library/tclIndex
+++ b/gdb/gdbtk/library/tclIndex
@@ -8,6 +8,9 @@
set auto_index(About) [list source [file join $dir about.tcl]]
set auto_index(ActionDlg) [list source [file join $dir actiondlg.tcl]]
+set auto_index(gdbtk_tcl_breakpoint) [list source [file join $dir interface.tcl]]
+set auto_index(gdbtk_tcl_tracepoint) [list source [file join $dir interface.tcl]]
+set auto_index(gdbtk_tcl_set_variable) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_tcl_preloop) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_busy) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_update) [list source [file join $dir interface.tcl]]
@@ -28,8 +31,6 @@ set auto_index(gdbtk_tcl_fputs_target) [list source [file join $dir interface.tc
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]]
-set auto_index(gdbtk_tcl_breakpoint) [list source [file join $dir interface.tcl]]
-set auto_index(gdbtk_tcl_tracepoint) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_tcl_trace_find_hook) [list source [file join $dir interface.tcl]]
set auto_index(gdb_run_readline_command) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_tcl_readline_begin) [list source [file join $dir interface.tcl]]
@@ -140,6 +141,7 @@ 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(SetVariableEvent) [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]]
@@ -289,6 +291,8 @@ set auto_index(::BreakpointEvent::number) [list source [file join $dir gdbevent.
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(::TracepointEvent::get) [list source [file join $dir gdbevent.itb]]
+set auto_index(::SetVariableEvent::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]]