From: Keith Seitz <keiths@cygnus.com>
To: Insight Maling List <insight@sources.redhat.com>
Subject: [PATCH] Report errors in MemWin
Date: Tue, 22 May 2001 12:05:00 -0000 [thread overview]
Message-ID: <Pine.GSO.4.33.0105221201530.18135-100000@ryobi.cygnus.com> (raw)
Hi,
If gdb was unable to set memory in the memory window, it would silently
reset the result -- no error was posted.
This patch adds an error dialog to inform the user that the write failed.
Keith
ChangeLog:
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.
Patch:
Index: library/memwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.itb,v
retrieving revision 1.2
diff -u -p -r1.2 memwin.itb
--- memwin.itb 2001/03/15 18:31:38 1.2
+++ memwin.itb 2001/05/22 19:02:27
@@ -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
@@ -768,4 +783,18 @@ body MemWin::memMoveCell {w x y} {
if { $r < 0 } { set r 0 }
$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
}
Index: library/memwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.ith,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 memwin.ith
--- memwin.ith 2000/02/07 00:19:42 1.1.1.1
+++ memwin.ith 2001/05/22 19:02:27
@@ -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}}
}
}
reply other threads:[~2001-05-22 12:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.33.0105221201530.18135-100000@ryobi.cygnus.com \
--to=keiths@cygnus.com \
--cc=insight@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).