public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [patch] variable window bug
@ 2002-12-03 15:46 Martin M. Hunt
  0 siblings, 0 replies; only message in thread
From: Martin M. Hunt @ 2002-12-03 15:46 UTC (permalink / raw)
  To: insight

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Fixes a bug when updating a variable's value causes an error.  For
example, dereferencing a null pointer.

2002-12-03  Martin M. Hunt  <hunt@redhat.com>

	* library/vartree.itb (buildlayer): Check for error when
	updating a variable's value.
	(update_var): Ditto.




[-- Attachment #2: p --]
[-- Type: text/x-patch, Size: 2783 bytes --]

Index: vartree.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/vartree.itb,v
retrieving revision 1.2
diff -p -r1.2 vartree.itb
*** vartree.itb	11 Nov 2002 22:29:24 -0000	1.2
--- vartree.itb	3 Dec 2002 23:44:20 -0000
*************** itcl::body  VarTree::buildlayer {tlist i
*** 71,77 ****
      set x [expr [lindex [$c bbox $j1] 2] + 5]
      set j2 [$c create text $x $y -text "([$var type])" -fill $colors(type) -anchor w -font global/fixed]
      set x [expr [lindex [$c bbox $j2] 2] + 5]
!     set j3 [$c create text $x $y -text "[$var value]" -fill $colors(value) -anchor w -font global/fixed]
  
      set var_to_items($var) [list $j1 $j2 $j3]
      set item_to_var($j1) $var
--- 71,82 ----
      set x [expr [lindex [$c bbox $j1] 2] + 5]
      set j2 [$c create text $x $y -text "([$var type])" -fill $colors(type) -anchor w -font global/fixed]
      set x [expr [lindex [$c bbox $j2] 2] + 5]
!     if {[catch {$var value} val]} {
!       # error accessing memory, etc.
!       set j3 [$c create text $x $y -text $val -fill $colors(error) -anchor w -font global/fixed]      
!     } else {
!       set j3 [$c create text $x $y -text $val -fill $colors(value) -anchor w -font global/fixed]
!     }
  
      set var_to_items($var) [list $j1 $j2 $j3]
      set item_to_var($j1) $var
*************** itcl::body  VarTree::update_var {var ena
*** 126,136 ****
    if {$enabled} {
      $c itemconfigure $nam -fill $colors(name)
      $c itemconfigure $typ -fill $colors(type)
!     if {[$c itemcget $val -text] != [$var value]} {
!       $c itemconfigure $val -text [$var value] -fill $colors(change)
      } else {
!       $c itemconfigure $val -text [$var value] -fill $colors(value)
      }
    } else {
      $c itemconfigure $nam -fill $colors(disabled)
      $c itemconfigure $typ -fill $colors(disabled)
--- 131,145 ----
    if {$enabled} {
      $c itemconfigure $nam -fill $colors(name)
      $c itemconfigure $typ -fill $colors(type)
! 
!     if {[catch {$var value} value]} {
!       set color $colors(error)      
!     } elseif {[$c itemcget $val -text] != $value} {
!       set color $colors(change)
      } else {
!       set color $colors(value)
      }
+     $c itemconfigure $val -text $value -fill $color
    } else {
      $c itemconfigure $nam -fill $colors(disabled)
      $c itemconfigure $typ -fill $colors(disabled)
*************** itcl::body  VarTree::_compare {a b} {
*** 381,386 ****
--- 390,396 ----
  itcl::body  VarTree::_init_data {} {
    set colors(name) "\#0000C0"
    set colors(type) "red"
+   set colors(error) "red"
    set colors(value) "black"
    set colors(change) "green"
    set colors(disabled) "gray50"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-03 23:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-03 15:46 [patch] variable window bug Martin M. Hunt

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).