This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A few python/pretty-printing questions

Hi Ray,

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

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
returns, see:

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]