Add block['var'] accessor
authorChristian Biesinger <cbiesinger@google.com>
Thu, 1 Aug 2019 22:22:28 +0000 (17:22 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Mon, 5 Aug 2019 18:06:18 +0000 (13:06 -0500)
commit0b27c27d0d3060171876736f05c39f9c86a65d3e
treee9ea50193b9ee06ba7468ee9bce4440343286c51
parent4ee94178afbe062bc244d28595f86d63633a7af7
Add block['var'] accessor

Currently we support iteration on blocks; this patch extends that to make
subscript access work as well.

gdb/ChangeLog:

2019-08-05  Christian Biesinger  <cbiesinger@google.com>

* NEWS: Mention dictionary access on blocks.
* python/py-block.c (blpy_getitem): New function.
(block_object_as_mapping): New struct.
(block_object_type): Use new struct for tp_as_mapping field.

gdb/doc/ChangeLog:

2019-08-05  Christian Biesinger  <cbiesinger@google.com>

* python.texi (Blocks In Python): Document dictionary access on blocks.

gdb/testsuite/ChangeLog:

2019-08-05  Christian Biesinger  <cbiesinger@google.com>

* gdb.python/py-block.exp: Test dictionary access on blocks.
gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/python.texi
gdb/python/py-block.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-block.exp