pretty printing of smart pointers and making function calls

Vladimir volo.zyko@gmail.com
Wed Feb 8 16:36:00 GMT 2012


Hi,

> You can work around this a little by having the base printer also print
> the pointed-to value.  This is what the libstdc++ iterator printers do
> (for now).

I'm not sure I understand you correctly. Do you mean that if the user asks for a
value of variable a and pretty printer knows that it's a pointer then along with
pointer address it should print the value the pointer points too? Anyway some
reference to document or example would be useful here.

> Yes, it can be done.  What you have to do is get the address of the
> function as a value.  There's no super way to do this right now:
> 
>     http://sourceware.org/bugzilla/show_bug.cgi?id=12027

The link above mentions gdb.parse_and_eval() which does exactly what I need.

> However, you usually don't want to call functions when pretty-printing.
> For one thing, this means core-file debugging won't work.
> It is better, when possible, to do everything in Python instead.

But you are right that this doesn't work with core-file. Is there any way to
check in Python whether I debug alive process or see its dead body?

Thanks,

Vladimir



More information about the Archer mailing list