From: nickrob@snap.net.nz (Nick Roberts)
To: gdb-patches@sources.redhat.com
Subject: [PATCH] varobj.c: Report changed values that use a pretty-printer
Date: Wed, 02 Sep 2009 23:48:00 -0000 [thread overview]
Message-ID: <19103.1108.215005.684662@totara.tehura.co.nz> (raw)
I've had a play with pretty printing in MI and it looks really neat. I've
got Emacs to display map objects as described on Trom Tromey's page:
http://tromey.com/blog/?p=546
There have been a few problems, notably changed values don't seem to get
reported by -var-update. The patch below seems to fix this. I think the
expectation might have been that continue would break out of the if statement
when v->children_requested was false, but it breaks out of the whole loop so
the varobj_update_result, r, never gets pushed on to result, even when
r.changed is 1.
When children are added the usual syntax of -var-update breaks and I get
something like:
"^done,changelist=[{name=\"var5\",value=\"std::tr1::unordered_map with 2 elements\",in_scope=\"true\",type_changed=\"false\",displayhint=\"map\",children=[{name=\"var5.[0]\",exp=\"[0]\",numchild=\"0\",value=\"1\",type=\"const int\",thread-id=\"1\"},...
e.g displayhint and children fields which aren't usually there and all
children including those which have _not_ changed get reported. I think the
normal syntax could be used and just the new children reported and the front
end could be made handle this.
The scope of this work seems enormous as it opens the possiblity of
formatting the watch expressions of all STL containers (as, ISTR, is already
done in Totalview). Of course the amount of work it entails is probably
enormous too and the problem, as always, is finding someone to do it. GSoC
2009 worked well with Emacs and Dmitry. I know it's a long way off, but
perhaps we could think about planning something for 2010.
--
Nick http://www.inet.net.nz/~nickrob
2009-09-03 Nick Roberts <nickrob@snap.net.nz>
* varobj.c (varobj_update): Ensure that changed values
are reported when using a pretty-printer.
*** varobj.c 28 Aug 2009 15:11:29 +1200 1.147
--- varobj.c 03 Sep 2009 02:47:39 +1200
*************** VEC(varobj_update_result) *varobj_update
*** 1545,1581 ****
int i, children_changed;
varobj_p tmp;
! if (!v->children_requested)
! continue;
!
! if (v->frozen)
! continue;
!
! /* If update_dynamic_varobj_children returns 0, then we have
! a non-conforming pretty-printer, so we skip it. */
! if (update_dynamic_varobj_children (v, &changed, &new_and_unchanged,
! &children_changed))
{
! if (children_changed)
! r.children_changed = 1;
! for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i)
! {
! varobj_update_result r = {tmp};
! r.changed = 1;
! r.value_installed = 1;
! VEC_safe_push (varobj_update_result, stack, &r);
! }
! for (i = 0;
! VEC_iterate (varobj_p, new_and_unchanged, i, tmp);
! ++i)
{
! varobj_update_result r = {tmp};
! r.value_installed = 1;
! VEC_safe_push (varobj_update_result, stack, &r);
}
- if (r.changed || r.children_changed)
- VEC_safe_push (varobj_update_result, result, &r);
- continue;
}
}
--- 1545,1578 ----
int i, children_changed;
varobj_p tmp;
! if (v->children_requested && !v->frozen)
{
! /* If update_dynamic_varobj_children returns 0, then we have
! a non-conforming pretty-printer, so we skip it. */
! if (update_dynamic_varobj_children (v, &changed, &new_and_unchanged,
! &children_changed))
{
! if (children_changed)
! r.children_changed = 1;
! for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i)
! {
! varobj_update_result r = {tmp};
! r.changed = 1;
! r.value_installed = 1;
! VEC_safe_push (varobj_update_result, stack, &r);
! }
! for (i = 0;
! VEC_iterate (varobj_p, new_and_unchanged, i, tmp);
! ++i)
! {
! varobj_update_result r = {tmp};
! r.value_installed = 1;
! VEC_safe_push (varobj_update_result, stack, &r);
! }
! if (r.changed || r.children_changed)
! VEC_safe_push (varobj_update_result, result, &r);
! continue;
}
}
}
next reply other threads:[~2009-09-02 23:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 23:48 Nick Roberts [this message]
2009-09-03 0:08 ` Tom Tromey
2009-09-03 0:59 ` Nick Roberts
2009-09-03 1:35 ` Tom Tromey
2009-09-24 5:29 ` Nick Roberts
2009-09-24 18:31 ` Tom Tromey
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=19103.1108.215005.684662@totara.tehura.co.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@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