This is the mail archive of the
mailing list for the Archer project.
Re: A few python/pretty-printing questions
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: Ray Ruvinskiy <rruvinsk at sybase dot com>
- Cc: archer at sourceware dot org
- Date: Mon, 06 Apr 2009 18:55:45 -0300
- Subject: Re: A few python/pretty-printing questions
- References: <5961E381-9F09-4ADE-80DE-9BCCB02E802B@sybase.com>
El lun, 06-04-2009 a las 16:07 -0400, Ray Ruvinskiy escribiÃ:
> - Can pretty-printers be toggled on a case-by-case basis? If I have a
> printer enabled for a certain type, can I still look at the raw
Yes, with print/r.
> - Is it possible to export convenience variables from within the
> python layer so that they would be visible from the gdb prompt?
I'm not sure I understood this or if my answer will apply to what you
have in mind, but you can create a python -> gdb convenience variables
"escape path" with a convenience function. Whatever the invoke method
> - Suppose I want to pass an expression of the form 'this-
> >inner1.inner2.leaf' to a python command, is there a quick way to
> look up the gdb.Value corresponding to the name, or do I have to first
> look up 'this' and then index into the dictionary?
You mean, an easy way to get to the value of .leaf? The Python command
will get the expression as a string. It can then call the
gdb.parse_and_eval function and it will evaluate the string as an
expression in the current language and return the resulting gdb.Value.
In your example, that would be the contents of "leaf".
The gdb.parse_and_eval function is not present in GDB CVS yet, only in
the Python branch. It will probably be renamed when we push it
In fact, we are running a contest to see who can come up with a good
name for it. It's clear that Tromey and myself failed. Any takers?
Thiago Jung Bauermann
IBM Linux Technology Center