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.


>> 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.


> I guess another advantage of automatic pointer dereferencing is that
> gdb/pyclewn could tell you if a pointer points to unallocated memory
> when hovering it.
>

Right, this is not correctly implemented right now. I will fix it.


> A slightly more "out there" feature would be to scan all the pointers
> in the current scope and highlight invalid ones (by toggling some
> flag). Might be hard to implement though =)

That would be great, but yes, difficult to implement with vim netbeans
interface.


-- 
Xavier

Les Chemins de Lokoti: http://lokoti.alwaysdata.net

------------------------------------------------------------------------------
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

Reply via email to