Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: -var-update @
Date: Sat, 29 Mar 2008 06:38:00 -0000	[thread overview]
Message-ID: <200803290937.57101.vladimir@codesourcery.com> (raw)
In-Reply-To: <18413.53371.781723.755958@kahikatea.snap.net.nz>

On Saturday 29 March 2008 08:15:39 Nick Roberts wrote:
> *** varobj.c.~1.108.~   2008-03-27 08:02:16.000000000 +1200
> --- varobj.c    2008-03-29 17:06:35.000000000 +1200
> *************** varobj_update (struct varobj **varp, str
> *** 1160,1177 ****
>          has changed.  */
>         new = value_of_root (varp, &type_changed);
>         
> !       /* If this is a floating varobj, and its type has changed,
> !        them note that it's changed.  */
> !       if (type_changed)
>         VEC_safe_push (varobj_p, result, *varp);
>         
> !         if (install_new_value ((*varp), new, type_changed))
> !         {
> !           /* If type_changed is 1, install_new_value will never return
> !              non-zero, so we'll never report the same variable twice.  */
> !           gdb_assert (!type_changed);
> !           VEC_safe_push (varobj_p, result, *varp);
> !         }
>   
>         if (new == NULL)
>         {
> --- 1160,1176 ----
>          has changed.  */
>         new = value_of_root (varp, &type_changed);
>         
> !       /* If this is a floating varobj, then note that it's changed.  */
> !       if ((*varp)->root->floating)
>         VEC_safe_push (varobj_p, result, *varp);

What is the logic here? Surely, a floating varobj might as well not change.
         
> !       if (install_new_value ((*varp), new, type_changed))
> !       {
> !         /* If type_changed is 1, install_new_value will never return
> !            non-zero, so we'll never report the same variable twice.  */
> !         gdb_assert (!type_changed);
> !         VEC_safe_push (varobj_p, result, *varp);
> !       }
>   
>         if (new == NULL)
>         {
> *************** value_of_root (struct varobj **var_handl
> *** 1738,1758 ****
>         old_type = varobj_get_type (var);
>         new_type = varobj_get_type (tmp_var);
>         if (strcmp (old_type, new_type) == 0)
> -       {
> -         varobj_delete (tmp_var, NULL, 0);
>           *type_changed = 0;
> -       }
>         else
> -       {
> -         tmp_var->obj_name =
> -           savestring (var->obj_name, strlen (var->obj_name));
> -         varobj_delete (var, NULL, 0);
> - 
> -         install_variable (tmp_var);
> -         *var_handle = tmp_var;
> -         var = *var_handle;
>           *type_changed = 1;
> !       }
>         xfree (old_type);
>         xfree (new_type);
>       }
> --- 1737,1753 ----
>         old_type = varobj_get_type (var);
>         new_type = varobj_get_type (tmp_var);
>         if (strcmp (old_type, new_type) == 0)
>           *type_changed = 0;
>         else
>           *type_changed = 1;
> ! 
> !       tmp_var->obj_name =
> !       savestring (var->obj_name, strlen (var->obj_name));
> !       varobj_delete (var, NULL, 0);
> !       install_variable (tmp_var);
> !       *var_handle = tmp_var;
> !       var = *var_handle;
> ! 
>         xfree (old_type);
>         xfree (new_type);
>       }

Hmm, I see. This actually causes a new varobj to be created each time.

> I think the patch below fixes the behaviour for var2.  There may be a
> less expensive way to do this, e.g, just update the "struct value",
> but I don't know how to do that.

So, we still don't know why the current code does not work? I think
we still get to figure out, to make sure that whatever bug there is
does not affect other cases.

- Volodya







  reply	other threads:[~2008-03-29  6:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 14:54 Vladimir Prus
2008-03-27  5:17 ` Nick Roberts
2008-03-27  7:00   ` Vladimir Prus
2008-03-27  9:54     ` Nick Roberts
2008-03-27 10:38       ` Vladimir Prus
2008-03-27 13:25         ` Marc Khouzam
2008-03-27 13:37           ` Vladimir Prus
2008-03-27 20:58           ` Nick Roberts
2008-03-28 14:32             ` Marc Khouzam
2008-03-28 16:22               ` Vladimir Prus
2008-03-28 16:33                 ` Marc Khouzam
2008-04-01 13:37             ` André Pönitz
2008-04-01 13:56               ` Marc Khouzam
2008-04-01 14:30                 ` André Pönitz
2008-04-03 19:10                   ` Daniel Jacobowitz
2008-04-03 19:31             ` Daniel Jacobowitz
2008-04-03 20:05               ` Michael Snyder
2008-03-29  5:16         ` Nick Roberts
2008-03-29  6:38           ` Vladimir Prus [this message]
2008-03-30  3:54             ` Nick Roberts
2008-04-03 18:55               ` Vladimir Prus
2008-04-03 21:30                 ` Nick Roberts
2008-04-04 11:45                   ` Vladimir Prus
2008-04-11 22:01                     ` Vladimir Prus
2008-04-11 23:22                       ` Nick Roberts

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=200803290937.57101.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=nickrob@snap.net.nz \
    /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