This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Pythons scripting API question
- From: Evan Driscoll <driscoll at cs dot wisc dot edu>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb at sourceware dot org
- Date: Wed, 30 May 2012 17:42:25 -0500
- Subject: Re: Pythons scripting API question
- References: <4FC66293.5040908@cs.wisc.edu> <4FC68FD0.4060809@redhat.com>
On 05/30/2012 04:23 PM, Keith Seitz wrote:
Frames contain blocks, blocks contain variables. Blocks in python can be
iterated
Great, it's that information that I was missing.
However, if I do this:
$ ./gdb -nx -q gdb -ex "break main" -ex "run"
(gdb) python import gdb
(gdb) python for n in gdb.selected_frame().block(): print n,
argc argv args
(gdb) python print n.type
struct captured_main_args
(gdb) python print n.name
args
(gdb) python print n.is_argument
False
(gdb) python print n.value(gdb.selected_frame())
{argc = 0, argv = 0x488f80 <_start>, use_windows = -8032, interpreter_p
= 0x0}
then on the last step I get this instead:
(gdb) python print n.value(gdb.selected_frame())
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'gdb.Symbol' object has no attribute 'value'
Error while executing Python code.
Instead, I have to use
(gdb) python print gdb.selected_frame().read_var(n)
{argc = 6742752, argv = 0x0, use_windows = -7696, interpreter_p = 0x0}
Is this just a version difference?
Evan