On Sun, Jun 5, 2011 at 3:19 PM, Xavier de Gaye <[email protected]> wrote: > On Fri, Jun 3, 2011 at 7:34 PM, Ulf Magnusson wrote: >>>>> Is there a way to make pyclewn automatically dereference pointer >>>>> values when hovering them? Just getting the address itself often isn't >>>>> very useful. >>>>> >>>> The gdb 'whatis' command prints the type of a variable. This should >>>> provide a way to automatically dereference variables on balloon >>>> evaluation. I am going to give it a try. >>> > > Note that the value of a dereferenced char pointer is a character and > not a string, so dereferencing must not be done in this case as gdb > already displays the string when printing a char pointer. > > Also I believe that a pointer to a pointer should not be dereferenced. > > I guess you could recursively dereference those as well, though it's of course impossible to know for sure what the user intended (does the pointer point to an array?, etc.). If this is implemented, a sensible default might be to display the single element you get after dereferencing n times, perhaps displaying both *p and **p for a pointer to a pointer.
>>> Thanks! I guess it could be made configurable as well (having options >>> for the style of presentation for structs and arrays would be neat >>> too). >>> > > This will be configurable, the default being that pointers are > dereferenced. > > Pretty printing in gdb is already available (since gdb 7.0) through > python scripting. It is configurable and values that are printed in > the vim balloon follow the configured gdb pretty printing rules. > > See an introduction to gdb pretty printing made by Tom Tromey in the > following sections at http://tromey.com/blog/?cat=17 > > 7. Pretty printing, part 1 > 8. Pretty printing, Part 2 > > The gdb wiki http://sourceware.org/gdb/wiki/STLSupport > explains how to setup C++ STL pretty printers to reproduce Tom > example for printing a C++ string. > > The next gdb 7.3 release provides a gdb.printing python package to be > used in building custom pretty printers. > Thanks for the links! I'll look into it. Also saw you had implemented this now, so I'll try it out later (after my vacation =). /Ulf ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Pyclewn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyclewn-general
