public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@cygnus.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: Insight Maling List <insight@sources.redhat.com>
Subject: Variable errors
Date: Wed, 11 Apr 2001 11:14:00 -0000	[thread overview]
Message-ID: <Pine.SOL.3.91.1010411105957.14548U-100000@ryobi.cygnus.com> (raw)

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


             reply	other threads:[~2001-04-11 11:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-11 11:14 Keith Seitz [this message]
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

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.SOL.3.91.1010411105957.14548U-100000@ryobi.cygnus.com \
    --to=keiths@cygnus.com \
    --cc=fnasser@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).