Add Python support for dynamic types
[deliverable/binutils-gdb.git] / gdb / python / py-param.c
index c211d477ea42f9290936f2efe840ddbcf2da8750..7b183cfa553c71bbd767937018e722138608f86d 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB parameters implemented in Python
 
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
+   Copyright (C) 2008-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -55,7 +55,10 @@ struct parm_constant parm_constants[] =
 /* A union that can hold anything described by enum var_types.  */
 union parmpy_variable
 {
-  /* Hold an integer value, for boolean and integer types.  */
+  /* Hold a boolean value.  */
+  bool boolval;
+
+  /* Hold an integer value.  */
   int intval;
 
   /* Hold an auto_boolean.  */
@@ -198,7 +201,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
       cmp = PyObject_IsTrue (value);
       if (cmp < 0)
          return -1;
-      self->value.intval = cmp;
+      self->value.boolval = cmp;
       break;
 
     case var_auto_boolean:
@@ -475,7 +478,7 @@ add_setshow_generic (int parmclass, enum command_class cmdclass,
     case var_boolean:
 
       add_setshow_boolean_cmd (cmd_name, cmdclass,
-                              &self->value.intval, set_doc, show_doc,
+                              &self->value.boolval, set_doc, show_doc,
                               help_doc, get_set_value, get_show_value,
                               set_list, show_list);
 
@@ -733,7 +736,7 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
                           set_doc.get (), show_doc.get (),
                           doc.get (), set_list, show_list);
     }
-  catch (const gdb_exception_RETURN_MASK_ALL &except)
+  catch (const gdb_exception &except)
     {
       xfree (cmd_name);
       Py_DECREF (self);
This page took 0.029792 seconds and 4 git commands to generate.