diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-22 15:13:09 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-05-31 15:00:40 -0600 |
commit | 7729052b5377bfbf1c5ec5eaab59dd5071d4c5b1 (patch) | |
tree | 750e865b7e765e41e28c93214bcbdd1f98f8ce75 /gdb/python/python.c | |
parent | 8a60efe714e636c9f958058a8dfb12de81bdcbfa (diff) | |
download | binutils-7729052b5377bfbf1c5ec5eaab59dd5071d4c5b1.zip binutils-7729052b5377bfbf1c5ec5eaab59dd5071d4c5b1.tar.gz binutils-7729052b5377bfbf1c5ec5eaab59dd5071d4c5b1.tar.bz2 |
Add basic Python API for convenience variables
This adds a basic Python API for accessing convenience variables.
With this, convenience variables can be read and set from Python.
Although gdb supports convenience variables whose value changes at
each call, this is not exposed to Python; it could be, but I think
it's just as good to write a convenience function in this situation.
This is PR python/23080.
Tested on x86-64 Fedora 26.
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* NEWS: Update for new functions.
* python/py-value.c (gdbpy_set_convenience_variable)
(gdbpy_convenience_variable): New functions.
* python/python-internal.h (gdbpy_convenience_variable)
(gdbpy_set_convenience_variable): Declare.
* python/python.c (python_GdbMethods): Add convenience_variable,
set_convenience_variable.
doc/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* python.texi (Basic Python): Document gdb.convenience_variable,
gdb.set_convenience_variable.
testsuite/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* gdb.python/python.exp: Add convenience variable tests.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r-- | gdb/python/python.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index c29e7d7..1805c90 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -2132,6 +2132,14 @@ Return a tuple containing all inferiors." }, Invalidate any cached frame objects in gdb.\n\ Intended for internal use only." }, + { "convenience_variable", gdbpy_convenience_variable, METH_VARARGS, + "convenience_variable (NAME) -> value.\n\ +Return the value of the convenience variable $NAME,\n\ +or None if not set." }, + { "set_convenience_variable", gdbpy_set_convenience_variable, METH_VARARGS, + "convenience_variable (NAME, VALUE) -> None.\n\ +Set the value of the convenience variable $NAME." }, + {NULL, NULL, 0, NULL} }; |