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.
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
}
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
$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
+}