diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/lib/gdb/__init__.py | 9 | ||||
-rw-r--r-- | gdb/python/py-param.c | 10 |
2 files changed, 13 insertions, 6 deletions
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index 191915e..dab57a3 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -235,9 +235,12 @@ def find_pc_line(pc): def set_parameter(name, value): """Set the GDB parameter NAME to VALUE.""" - # Handle the specific case of booleans here, because gdb.parameter - # can return them, but they can't be passed to 'set' this way. - if isinstance(value, bool): + # Handle the specific cases of None and booleans here, because + # gdb.parameter can return them, but they can't be passed to 'set' + # this way. + if value is None: + value = "unlimited" + elif isinstance(value, bool): if value: value = "on" else: diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index 5d509ba..cab0c56 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -243,14 +243,18 @@ set_parameter_value (parmpy_object *self, PyObject *value) long l; int ok; - if (!PyLong_Check (value)) + if (value == Py_None + && (self->type == var_uinteger || self->type == var_integer)) + l = 0; + else if (value == Py_None && self->type == var_zuinteger_unlimited) + l = -1; + else if (!PyLong_Check (value)) { PyErr_SetString (PyExc_RuntimeError, _("The value must be integer.")); return -1; } - - if (! gdb_py_int_as_long (value, &l)) + else if (! gdb_py_int_as_long (value, &l)) return -1; switch (self->type) |