This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Fix to type changes in the Watch Window


As one goes up and down the stack, the USE_SELECTED_FRAME type of variables can change type (a variable with the same name on one stack level may have a different type from a variable on the same name on another stack level).

The code in variables.tcl (base class to the class that implements the Watch Window) did not handle that very well.  When structs were involved, it could dump core if the user would perform some actions like open/close the tree and go up/down the stack in some specific orders.

I have applied the following patch which fixes this problem.


2001-03-29  Fernando Nasser  <fnasser@redhat.com>

	* library/variable.tcl (update): Cope with varobj type changes.

Index: library/variables.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/variables.tcl,v
retrieving revision 1.6
diff -c -p -r1.6 variables.tcl
*** variables.tcl	2001/03/29 22:33:29	1.6
--- variables.tcl	2001/03/29 22:34:18
*************** class VariableWin {
*** 803,809 ****
--- 803,812 ----
  	return 0
      }
  
+     # ------------------------------------------------------------------
+     # METHOD:   update
      # OVERRIDE THIS METHOD and call it from there
+     # ------------------------------------------------------------------
      method update {} {
  	global Update
  	debug
*************** class VariableWin {
*** 821,828 ****
  	set ChangeList {}
  	set variables [$Hlist info children {}]
  	foreach var $variables {
! 	    #      debug "VARIABLE: $var ($Update($this,$var))"
! 	    set ChangeList [concat $ChangeList [$var update]]
  	}
  
  	foreach var $ChangeList {
--- 824,845 ----
  	set ChangeList {}
  	set variables [$Hlist info children {}]
  	foreach var $variables {
! 	    # debug "VARIABLE: $var ($Update($this,$var))"
! 	    set UpdatedList [$var update]
!             if {[lindex $UpdatedList 0] == $var} {
!               debug "Type changed."
!               # We must fix the tree entry to correspond to the new type
!               $Hlist delete offsprings $var
!               $Hlist entryconfigure $var -text [label $var]
!               if {[$var numChildren] > 0} {
!                 $Tree setmode $var open
!               } else {
!                 $Tree setmode $var none
!               }
!             } else {
! 	      set ChangeList [concat $ChangeList $UpdatedList]
! 	      # debug "ChangeList=$ChangeList"
!             }
  	}
  
  	foreach var $ChangeList {
                                                                                

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]