Re: [PATCH] gdb/python: add property ranges to gdb.Block object

Eli Zaretskii
2026-03-12T06:53:00Z

> From: Jan Vrany <jan.vrany@labware.com>
> CC: Jan Vrany <jan.vrany@labware.com>
> Date: Wed, 11 Mar 2026 20:18:26 +0000
>
> This commit adds a new property - ranges - to gdb.Block object. It holds
> a tuple of ranges for that block. Each range is a tuple of (start, end)
> address. For contiguous blocks it contains only one range.
> ---
> gdb/NEWS | 4 ++++
> gdb/doc/python.texi | 7 +++++++
> gdb/python/py-block.c | 30 +++++++++++++++++++++++++++
> gdb/testsuite/gdb.python/py-block.exp | 3 +++
> 4 files changed, 44 insertions(+)

Thanks.

> + ** New gdb.Block.ranges attribute. This read only attribute contains
> + a tuple of pairs each representing a single range. Contiguous blocks
> + have only one range. ^^

Two spaces there, please.

> +@defvar Block.ranges
> +A tuple representing address ranges of the block. Each range is represented
> +as pair (two-element tuple) where first element is the start of the range
^^^^^^^ ^^^^^^^^^^^^^
"as a pair" and "the first element"

> +and second element is one past the last address that appears in the range.
^^^^^^^^^^^^^^
"the second element"

> +The order of ranges is unspecified. Contiguous blocks have only one range.
> +This attribute is not writable. ^^

Two spaces there.