summaryrefslogtreecommitdiff
path: root/gdb/gdbtk
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2001-05-22 19:02:54 +0000
committerKeith Seitz <keiths@redhat.com>2001-05-22 19:02:54 +0000
commitb52358678fb6b85573b19cf1f4f172f8a853ad8a (patch)
treeaf5140ef2b54eb64f11442f73adf755eafc3b235 /gdb/gdbtk
parent414d070d09cd2e0c33a1b7b927061437b446059e (diff)
downloadgdb-b52358678fb6b85573b19cf1f4f172f8a853ad8a.tar.gz
* memwin.ith (error_dialog): Declare public method.
* memwin.itb (error_dialog): Define. (edit): When attempting to set memory, post an error dialog if gdb told us an error occurred while writing the memory.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r--gdb/gdbtk/ChangeLog7
-rw-r--r--gdb/gdbtk/library/memwin.itb33
-rw-r--r--gdb/gdbtk/library/memwin.ith1
3 files changed, 39 insertions, 2 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index d09a0af42a8..3ec81459be5 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,5 +1,12 @@
2001-05-22 Keith Seitz <keiths@cygnus.com>
+ * memwin.ith (error_dialog): Declare public method.
+ * memwin.itb (error_dialog): Define.
+ (edit): When attempting to set memory, post an error dialog
+ if gdb told us an error occurred while writing the memory.
+
+2001-05-22 Keith Seitz <keiths@cygnus.com>
+
* library/interface.tcl (gdbtk_tcl_file_changed): Handle
the case of empty-string files, sent by gdb when the
user requests to reset the file.
diff --git a/gdb/gdbtk/library/memwin.itb b/gdb/gdbtk/library/memwin.itb
index adc8ed7a55a..139f202a68c 100644
--- a/gdb/gdbtk/library/memwin.itb
+++ b/gdb/gdbtk/library/memwin.itb
@@ -289,7 +289,14 @@ body MemWin::edit { cell } {
foreach c [split $val ""] {
if {$c != $ascii_char} {
if {$c == "'"} {set c "\\'"}
- catch {gdb_cmd "set *(char *)($addr) = '$c'"}
+ set err [catch {gdb_cmd "set *(char *)($addr) = '$c'"} res]
+ if {$err} {
+ error_dialog [winfo toplevel $itk_interior] $res
+
+ # reset value
+ set ${this}_memval($row,$col) $saved_value
+ return
+ }
}
incr addr
}
@@ -315,7 +322,15 @@ body MemWin::edit { cell } {
set addr [expr {$current_addr + $bytes_per_row * $row + $size * $col}]
#debug " edit $row,$col [format "%x" $addr] = $val"
#set memory
- catch {gdb_cmd "set *($type($size) *)($addr) = $val"} res
+ set err [catch {gdb_cmd "set *($type($size) *)($addr) = $val"} res]
+ if {$err} {
+ error_dialog [winfo toplevel $itk_interior] $res
+
+ # reset value
+ set ${this}_memval($row,$col) $saved_value
+ return
+ }
+
# read it back
# FIXME - HACK ALERT - This call causes trouble with remotes on Windows.
# This routine is in fact called from within an idle handler triggered by
@@ -769,3 +784,17 @@ body MemWin::memMoveCell {w x y} {
$w activate $r,$c
$w see active
}
+
+# ------------------------------------------------------------
+# PUBLIC METHOD: error_dialog - Open and error dialog.
+# Arguments:
+# msg - The message to display in the dialog
+# modality - The dialog modailty. Default: task
+# type - The dialog type (tk_messageBox).
+# Default: ok
+# ------------------------------------------------------------
+body MemWin::error_dialog {msg {modality task} {type ok}} {
+ set parent [winfo toplevel [namespace tail $this]]
+ tk_messageBox -icon error -title Error -type $type \
+ -modal $modality -message $msg -parent $parent
+}
diff --git a/gdb/gdbtk/library/memwin.ith b/gdb/gdbtk/library/memwin.ith
index fd2bc0d93fe..a8a770ee168 100644
--- a/gdb/gdbtk/library/memwin.ith
+++ b/gdb/gdbtk/library/memwin.ith
@@ -74,5 +74,6 @@ class MemWin {
method do_popup {x y}
method goto {addr}
method memMoveCell {w x y}
+ method error_dialog {msg {modality task} {type ok}}
}
}