* [PATCH] varobj.c: Report changed values that use a pretty-printer
@ 2009-09-02 23:48 Nick Roberts
2009-09-03 0:08 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2009-09-02 23:48 UTC (permalink / raw)
To: gdb-patches
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;
}
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] varobj.c: Report changed values that use a pretty-printer
2009-09-02 23:48 [PATCH] varobj.c: Report changed values that use a pretty-printer Nick Roberts
@ 2009-09-03 0:08 ` Tom Tromey
2009-09-03 0:59 ` Nick Roberts
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-09-03 0:08 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
>>>>> "Nick" == Nick Roberts <nickrob@snap.net.nz> writes:
Nick> I've had a play with pretty printing in MI and it looks really neat. I've
Nick> got Emacs to display map objects as described on Trom Tromey's page:
Nick> http://tromey.com/blog/?p=546
Nick> There have been a few problems, notably changed values don't seem
Nick> to get reported by -var-update. The patch below seems to fix
Nick> this.
Oops, bad timing ... I have a big patch to redo all this code, as
discussed on the gdb list and the archer list. It is on the
archer-tromey-python branch, but I plan to push it to CVS as soon as
Volodya declares it ready (and as soon as I tidy up the documentation,
my task for tomorrow).
Nick> The scope of this work seems enormous as it opens the possiblity
Nick> of formatting the watch expressions of all STL containers (as,
Nick> ISTR, is already done in Totalview). Of course the amount of work
Nick> it entails is probably enormous too and the problem, as always, is
Nick> finding someone to do it.
GCC svn trunk has pretty-printers for basically everything in libstdc++ :-)
I'd like to write printers for some other programs (gdb, or gcc, or
python, or emacs) but haven't found the time ...
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] varobj.c: Report changed values that use a pretty-printer
2009-09-03 0:08 ` Tom Tromey
@ 2009-09-03 0:59 ` Nick Roberts
2009-09-03 1:35 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2009-09-03 0:59 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> Nick> There have been a few problems, notably changed values don't seem
> Nick> to get reported by -var-update. The patch below seems to fix
> Nick> this.
>
> Oops, bad timing ... I have a big patch to redo all this code, as
> discussed on the gdb list and the archer list. It is on the
> archer-tromey-python branch, but I plan to push it to CVS as soon as
> Volodya declares it ready (and as soon as I tidy up the documentation,
> my task for tomorrow).
No problem, it was only a small patch. Were you aware that changed values
aren't reported? Does your patch fix the problems that I mentioned?
> Nick> The scope of this work seems enormous as it opens the possiblity
> Nick> of formatting the watch expressions of all STL containers (as,
> Nick> ISTR, is already done in Totalview). Of course the amount of work
> Nick> it entails is probably enormous too and the problem, as always, is
> Nick> finding someone to do it.
>
> GCC svn trunk has pretty-printers for basically everything in libstdc++ :-)
Cool! Will they be distributed as part of the libstdc++ package files?
i.e. with future GNU/Linux distributions
> I'd like to write printers for some other programs (gdb, or gcc, or
> python, or emacs) but haven't found the time ...
I'm not sure what you mean. I was thinking of writing lisp code so that
Emacs can parse the output of the pretty printers like the ones you describe
above.
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] varobj.c: Report changed values that use a pretty-printer
2009-09-03 0:59 ` Nick Roberts
@ 2009-09-03 1:35 ` Tom Tromey
2009-09-24 5:29 ` Nick Roberts
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-09-03 1:35 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
>>>>> "Nick" == Nick Roberts <nickrob@snap.net.nz> writes:
Nick> No problem, it was only a small patch. Were you aware that
Nick> changed values aren't reported? Does your patch fix the problems
Nick> that I mentioned?
Yeah, it should fix those problems.
Tom> GCC svn trunk has pretty-printers for basically everything in
Tom> libstdc++ :-)
Nick> Cool! Will they be distributed as part of the libstdc++ package
Nick> files? i.e. with future GNU/Linux distributions
Yes, they are installed in a way that lets them auto-activate, if the
distro configures everything properly. We're already doing this in
Fedora 11.
Tom> I'd like to write printers for some other programs (gdb, or gcc, or
Tom> python, or emacs) but haven't found the time ...
Nick> I'm not sure what you mean. I was thinking of writing lisp code
Nick> so that Emacs can parse the output of the pretty printers like the
Nick> ones you describe above.
At least gcc, emacs, and python all have their own complicated .gdbinit
files with commands to help print data structures more nicely. I think
it would be nice to convert these to use the pretty-printer
infrastructure. This provides a couple concrete advantages: it works
better with MI, and it works in stack traces.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] varobj.c: Report changed values that use a pretty-printer
2009-09-03 1:35 ` Tom Tromey
@ 2009-09-24 5:29 ` Nick Roberts
2009-09-24 18:31 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2009-09-24 5:29 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Tom> GCC svn trunk has pretty-printers for basically everything in
> Tom> libstdc++ :-)
>
> Nick> Cool! Will they be distributed as part of the libstdc++ package
> Nick> files? i.e. with future GNU/Linux distributions
>
> Yes, they are installed in a way that lets them auto-activate, if the
> distro configures everything properly. We're already doing this in
> Fedora 11.
How does that work? I can see that a front-end can get GDB to read the file
printers.py, if it is distributed with the libstdc++ package, using
"library-loaded" notification:
=library-loaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libstdc++.so.6",host-name="/usr/lib/libstdc++.so.6",symbols-loaded="0"
Or do you mean that the build of GDB in Fedora 11 will recognise that
libstdc++ has been loaded and then automatically read in the file printers.py?
--
Nick http://users.snap.net.nz/~nickrob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] varobj.c: Report changed values that use a pretty-printer
2009-09-24 5:29 ` Nick Roberts
@ 2009-09-24 18:31 ` Tom Tromey
0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-09-24 18:31 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
>>>>> "Nick" == Nick Roberts <nickrob@snap.net.nz> writes:
Nick, sorry about the double reply. The copy of your message that I
received was CCd to gdb-patches@redhat.com... either you resent it (?)
or there is some bad address mangling going on somewhere. (If you did
not resend it, let me know, because I'd like to try to track down the
problem.)
Tom> Yes, they are installed in a way that lets them auto-activate, if the
Tom> distro configures everything properly. We're already doing this in
Tom> Fedora 11.
Nick> How does that work?
GDB has code in it to automatically find and read a .py file when a new
objfile is created. On Fedora, we install such a file that loads the
libstdc++ printers when libstdc++.so is used by the inferior.
See (info "(gdb)Auto-loading") for the details.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-24 18:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 23:48 [PATCH] varobj.c: Report changed values that use a pretty-printer Nick Roberts
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox