Blocks In Python - Debugging with GDB

Next: Symbols In Python, Previous: Frames In Python, Up: Python API

##### 23.2.2.16 Accessing frame blocks from Python.

Within each frame, gdb maintains information on each block stored in that frame. These blocks are organized hierarchically, and are represented individually in Python as a `gdb.Block`. Please see Frames In Python, for a more in-depth discussion on frames. Furthermore, see Examining the Stack, for more detailed technical information on gdb's book-keeping of the stack.

The following block-related functions are available in the `gdb` module:

— Function: block_for_pc pc

> Return the `gdb.Block` containing the given pc value. If the block cannot be found for the pc value specified, the function will return `None`.

A `gdb.Block` object has the following attributes:

— Instance Variable of Block: start

> The start address of the block. This attribute is not writable.

— Instance Variable of Block: end

> The end address of the block. This attribute is not writable.

— Instance Variable of Block: function

> The name of the block represented as a `gdb.Symbol`. If the block is not named, then this attribute holds `None`. This attribute is not writable.

— Instance Variable of Block: superblock

> The block containing this block. If this parent block does not exist, this attribute holds `None`. This attribute is not writable.