From 7729052b5377bfbf1c5ec5eaab59dd5071d4c5b1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 22 Apr 2018 15:13:09 -0600 Subject: 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 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 PR python/23080: * python.texi (Basic Python): Document gdb.convenience_variable, gdb.set_convenience_variable. testsuite/ChangeLog 2018-04-22 Tom Tromey PR python/23080: * gdb.python/python.exp: Add convenience variable tests. --- gdb/python/python-internal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 26400f4..495655e 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -477,6 +477,8 @@ extern enum ext_lang_rc gdbpy_get_matching_xmethod_workers PyObject *gdbpy_history (PyObject *self, PyObject *args); +PyObject *gdbpy_convenience_variable (PyObject *self, PyObject *args); +PyObject *gdbpy_set_convenience_variable (PyObject *self, PyObject *args); PyObject *gdbpy_breakpoints (PyObject *, PyObject *); PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *); PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw); -- cgit v1.1