diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-26 16:18:07 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-05-02 10:31:55 -0600 |
commit | 0489430a0e1a3ea302c22c540f3629e471591f23 (patch) | |
tree | 160d2ad23b6002ff316fbae5d840e4a3da90ff3c /gdb/testsuite/gdb.python/py-parameter.exp | |
parent | d966ab2dc5c10626a1389c87e9bcf924a99e9dfb (diff) | |
download | binutils-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/testsuite/gdb.python/py-parameter.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/py-parameter.exp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp index 3cd1198..b9ff9f1 100644 --- a/gdb/testsuite/gdb.python/py-parameter.exp +++ b/gdb/testsuite/gdb.python/py-parameter.exp @@ -179,3 +179,26 @@ gdb_test "python print (test_param.value)" "False" "test parameter value" gdb_test "help show print test-param" "State of the Test Parameter.*" "test show help" gdb_test "help set print test-param" "Set the state of the Test Parameter.*" "test set help" gdb_test "help set print" "set print test-param -- Set the state of the Test Parameter.*" "test general help" + +foreach kind {PARAM_ZUINTEGER PARAM_ZUINTEGER_UNLIMITED} { + gdb_py_test_multiple "Simple gdb $kind" \ + "python" "" \ + "class TestNodocParam (gdb.Parameter):" "" \ + " def __init__ (self, name):" "" \ + " super (TestNodocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.$kind)" "" \ + " self.value = 0" "" \ + "test_param_$kind = TestNodocParam ('test-$kind')" "" \ + "end" + + gdb_test "python print(gdb.parameter('test-$kind'))" "0" + + gdb_test "python test_param_$kind.value = -5" "RuntimeError: Range exceeded.*" + + if {$kind == "PARAM_ZUINTEGER"} { + gdb_test "python test_param_$kind.value = -1" "RuntimeError: Range exceeded.*" + } else { + gdb_test_no_output "python test_param_$kind.value = -1" "" + gdb_test "python print(gdb.parameter('test-$kind'))" "-1" \ + "check that PARAM_ZUINTEGER value is -1 after setting" + } +} |