From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: -var-update @
Date: Sat, 29 Mar 2008 05:16:00 -0000 [thread overview]
Message-ID: <18413.53371.781723.755958@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200803271338.24328.vladimir@codesourcery.com>
> > -var-update --all-values var1
> > ^done,changelist=[{name="var1",in_scope="true",new_type="float",new_num_children="0"}]
> > (gdb)
> > -var-update --all-values var2
> > ^done,changelist=[{name="var2",value="-1080652880",in_scope="true",type_changed="false"}]
> > (gdb)
>
> This is weird. I did not look at var1 missing new value (should be easy),
> but the var2 behaviour is strange. Evaluating 'myvar1' by hand gives the
> right value, whereas -var-update gives this apparent garbage. My guess is
> that that parsed expression somehow holds on to frame. I'll look further.
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.
> > > > I think we should fix (and document) such floating variable objects
> > >
> > > We should; I was not aware of the bug with wrong value you report above.
There's still no doc or tests for this type of varobj.
> > <snip>
> > I would just suggest a more consistent syntax as currently:
> >
> > -var-update @ Updates all floating variable objects.
> > -var-update * Updates all variable objects.
> > -var-update var1 Updates the variable object var1 (floating or otherwise).
> >
> > -var-create - @ Creates a floating variable object.
> > -var-create - * Creates a fixed frame variable object.
>
> IIUC, the above is that current syntax? If yes, how do you propose to
> change. If this is the proposed syntax, can you spell out the difference
> from the current one?
This is the current syntax which I find confusing because "*" means "fixed" in
one context and "all" in another. I'm not sure how to change it and remain
backward compatible.
--
Nick http://www.inet.net.nz/~nickrob
2008-03-29 Nick Roberts <nickrob@snap.net.nz>
* varobj.c (varobj_update): Always mark floating variable objects
as changed.
(value_of_root): Always recreate a floating variable object.
*** 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);
! 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);
}
next prev parent reply other threads:[~2008-03-29 5:16 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 [this message]
2008-03-29 6:38 ` Vladimir Prus
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=18413.53371.781723.755958@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@sources.redhat.com \
--cc=vladimir@codesourcery.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