Pythons scripting API question

Tom Tromey
Wed Jun 6 17:58:00 GMT 2012

>>>>> "Joachim" == Joachim Protze <> writes:

Joachim> Thank you for this example!
Joachim> I never figured out this feature of Blocks :(

Keith> See the relevant sections in the Gdb Users Manual (,

Joachim> I totally miss the hint that Blocks drop Value objects on iteration in
Joachim> the documentation.

It was patched to be more clear:

2012-02-22  Tom Tromey  <>

	* gdb.texinfo (Blocks In Python): Clarify block iteration.

The new text says:

A @code{gdb.Block} is iterable.  The iterator returns the symbols
(@pxref{Symbols In Python}) local to the block.  [...]

If this is insufficient, suggest more...

Joachim> How to access the "hierarchically organized" sub-blocks?

Unfortunately we are missing API for this.
Could you file a bug report for it?

Or alternatively, try to write it?  I don't think gdb has a direct way
to iterate over sub-blocks; but at the very least you can iterate over
the blockvector and look for blocks with a certain parent.


More information about the Gdb mailing list