public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Variable errors
@ 2001-04-11 11:14 Keith Seitz
  2001-04-11 11:23 ` Fernando Nasser
  0 siblings, 1 reply; 8+ messages in thread
From: Keith Seitz @ 2001-04-11 11:14 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: Insight Maling List

Hi,

The recent changes to variables.tcl to deal with changing types in 
variables is not quite correct:

-821,8 +824,22 @@ class VariableWin {
        set ChangeList {}
        set variables [$Hlist info children {}]
        foreach var $variables {
-           #      debug "VARIABLE: $var ($Update($this,$var))"
-           set ChangeList [concat $ChangeList [$var update]]
+           # 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"
+            }
        }

There are two problems here. We'll start with the easy one.

When the type of a variable changes, this code (correctly) deletes the 
offsprings of the variable and configures the existing entry to 
correspond to the latest version of the variable. However, it does not 
add itself to the ChangeList, so it never appears to be updated (its 
value changes in the window, but the value is never highlighted in blue). 
The (obvious?) fix is to add "set UpdatedList $var" in the "type changed" 
block.

Now the tougher one. This statement is incorrect:
+            if {[lindex $UpdatedList 0] == $var} {
+              debug "Type changed."

This means that ANY root variable whose value changes is going to have 
its offspring deleted and the variable (if it has any displayed children) 
will also be collapsed. So if I change the value of a struct* which I was 
viewing, all the children go away.

The other side affect is that simple variables like integers also never 
show up in the ChangeList. Adding the "set UpdateList $var" fix above 
will work around this, though, as kludgy as it is.

Is there a better way to find out if the type has changed?? Can we add a 
new gdbtk-varobj variable method to check this, i.e., let the variable 
explicitly tell us that its type has changed? Then we could do something 
like:

     if {[$var typeChanged]} {
       debug "Type changed"

This would be a much more definitive test.
Keith


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-05-10 17:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-11 11:14 Variable errors Keith Seitz
2001-04-11 11:23 ` Fernando Nasser
2001-04-11 11:31   ` Keith Seitz
2001-04-11 11:58     ` Fernando Nasser
2001-04-11 12:13       ` Keith Seitz
2001-04-11 12:27         ` Lewin A.R.W. Edwards
2001-05-07 17:33         ` Fernando Nasser
2001-05-10 17:25           ` Keith Seitz

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