aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-26 16:18:07 -0600
committerTom Tromey <tom@tromey.com>2018-05-02 10:31:55 -0600
commit0489430a0e1a3ea302c22c540f3629e471591f23 (patch)
tree160d2ad23b6002ff316fbae5d840e4a3da90ff3c /gdb/python/python.c
parentd966ab2dc5c10626a1389c87e9bcf924a99e9dfb (diff)
downloadbinutils-0489430a0e1a3ea302c22c540f3629e471591f23.zip
binutils-0489430a0e1a3ea302c22c540f3629e471591f23.tar.gz
binutils-0489430a0e1a3ea302c22c540f3629e471591f23.tar.bz2
Handle var_zuinteger and var_zuinteger_unlimited from Python
PR python/20084 points out that the Python API doesn't handle the var_zuinteger and var_zuinteger_unlimited parameter types. This patch adds support for these types. Regression tested on x86-64 Fedora 26. ChangeLog 2018-05-02 Tom Tromey <tom@tromey.com> PR python/20084: * python/python.c (gdbpy_parameter_value): Handle var_zuinteger and var_zuinteger_unlimited. * python/py-param.c (struct parm_constant): Add PARAM_ZUINTEGER and PARAM_ZUINTEGER_UNLIMITED. (set_parameter_value): Handle var_zuinteger and var_zuinteger_unlimited. (add_setshow_generic): Likewise. (parmpy_init): Likewise. doc/ChangeLog 2018-05-02 Tom Tromey <tom@tromey.com> PR python/20084: * python.texi (Parameters In Python): Document PARAM_ZUINTEGER and PARAM_ZUINTEGER_UNLIMITED. testsuite/ChangeLog 2018-05-02 Tom Tromey <tom@tromey.com> PR python/20084: * gdb.python/py-parameter.exp: Add PARAM_ZUINTEGER and PARAM_ZUINTEGER_UNLIMITED tests.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 0dd7d6a..fbd6770 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -467,6 +467,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
Py_RETURN_NONE;
/* Fall through. */
case var_zinteger:
+ case var_zuinteger_unlimited:
return PyLong_FromLong (* (int *) var);
case var_uinteger:
@@ -477,6 +478,12 @@ gdbpy_parameter_value (enum var_types type, void *var)
Py_RETURN_NONE;
return PyLong_FromUnsignedLong (val);
}
+
+ case var_zuinteger:
+ {
+ unsigned int val = * (unsigned int *) var;
+ return PyLong_FromUnsignedLong (val);
+ }
}
return PyErr_Format (PyExc_RuntimeError,