This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Variable errors
- To: Keith Seitz <keiths at cygnus dot com>
- Subject: Re: Variable errors
- From: Fernando Nasser <fnasser at redhat dot com>
- Date: Wed, 11 Apr 2001 14:19:15 -0400
- CC: Fernando Nasser <fnasser at cygnus dot com>, Insight Maling List <insight at sources dot redhat dot com>
- Organization: Red Hat Canada
- References: <Pine.SOL.3.91.1010411105957.14548U-100000@ryobi.cygnus.com>
Keith Seitz wrote:
>
> Hi,
>
> The recent changes to variables.tcl to deal with changing types in
> variables is not quite correct:
>
No, it is correct. It may require some extra comment, as I can conclude
from your message ;-)
> -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).
That is intentional. It is another variable, with the same name but
nevertheless another one. The blue thing is for when the _value_ of a
variable changes.
> 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.
>
Nope. The only root variable that will ever show up in there is a new
incarnation of a type_changed varobj -- which will have the same name.
I will add some extra comments to this code.
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9