This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Reading a static variable in Python
On 03/11/2010 04:53 PM, Tom Tromey wrote:
>>>>>> "Chris" == Chris Johns <chris@contemporary.net.au> writes:
>
> Tom> Use gdb.parse_and_eval.
>
> Chris> Nice. This is an excellent solution. I suppose being an expression it
> Chris> can do the pointer maths as well. I was looking at ways to construct a
> Chris> gdb.Value with a gdb.Symbol as an argument.
>
> Yes, strangely there doesn't seem to be a way to do that.
> If you want this, feel free to file a bug report for it...
Frame's read_var function creates a gdb.Value from a given gdb.Symbol,
but obviously one needs the frame and the symbol for that. There was
a stub in the gdb.Symbol code to do this without a frame, but it was
very limited so I removed it. Frame's function read_var uses
read_var_value which needs a frame (well, for some reads -
symbol_read_needs_frame returns a mixed bag of results). Not sure if
it is possible to construct a value from a symbol without the frame in
all cases?
Cheers,
Phil