/* Python function to set the (Ada) task of a breakpoint. */ static int bppy_set_task (PyObject *self, PyObject *newvalue, void *closure) { gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; long id; int valid_id = 0; volatile struct gdb_exception except; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `task' attribute.")); return -1; } else if (PyInt_Check (newvalue)) { if (! gdb_py_int_as_long (newvalue, &id)) return -1; TRY_CATCH (except, RETURN_MASK_ALL) { valid_id = valid_task_id (id); } GDB_PY_SET_HANDLE_EXCEPTION (except); if (! valid_id) { PyErr_SetString (PyExc_RuntimeError, _("Invalid task ID.")); return -1; } }
/* Python function to set the enabled state of a breakpoint. */ static int bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure) { breakpoint_object *self_bp = (breakpoint_object *) self; int cmp; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `enabled' attribute.")); return -1; } else if (! PyBool_Check (newvalue)) { PyErr_SetString (PyExc_TypeError, _("The value of `enabled' must be a boolean.")); return -1; } cmp = PyObject_IsTrue (newvalue); if (cmp < 0) return -1; else if (cmp == 1) enable_breakpoint (self_bp->bp); else disable_breakpoint (self_bp->bp); return 0; }
static int bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure) { char *exp; breakpoint_object *self_bp = (breakpoint_object *) self; volatile struct gdb_exception except; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `condition' attribute.")); return -1; } else if (newvalue == Py_None) exp = ""; else { exp = python_string_to_host_string (newvalue); if (exp == NULL) return -1; } TRY_CATCH (except, RETURN_MASK_ALL) { set_breakpoint_condition (self_bp->bp, exp, 0); }
/* Python function to set the hit count of a breakpoint. */ static int bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure) { breakpoint_object *self_bp = (breakpoint_object *) self; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `hit_count' attribute.")); return -1; } else { long value; if (! gdb_py_int_as_long (newvalue, &value)) return -1; if (value != 0) { PyErr_SetString (PyExc_AttributeError, _("The value of `hit_count' must be zero.")); return -1; } } self_bp->bp->hit_count = 0; return 0; }
/* Python function to set the ignore count of a breakpoint. */ static int bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure) { breakpoint_object *self_bp = (breakpoint_object *) self; long value; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `ignore_count' attribute.")); return -1; } else if (! PyInt_Check (newvalue)) { PyErr_SetString (PyExc_TypeError, _("The value of `ignore_count' must be an integer.")); return -1; } if (! gdb_py_int_as_long (newvalue, &value)) return -1; if (value < 0) value = 0; set_ignore_count (self_bp->number, (int) value, 0); return 0; }
/* Python function to set the thread of a breakpoint. */ static int bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure) { gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; long id; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `thread' attribute.")); return -1; } else if (PyInt_Check (newvalue)) { if (! gdb_py_int_as_long (newvalue, &id)) return -1; if (! valid_thread_id (id)) { PyErr_SetString (PyExc_RuntimeError, _("Invalid thread ID.")); return -1; } } else if (newvalue == Py_None) id = -1; else { PyErr_SetString (PyExc_TypeError, _("The value of `thread' must be an integer or None.")); return -1; } breakpoint_set_thread (self_bp->bp, id); return 0; }
/* Python function to set the enabled state of a breakpoint. */ static int bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure) { gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; int cmp; volatile struct gdb_exception except; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `enabled' attribute.")); return -1; } else if (! PyBool_Check (newvalue)) { PyErr_SetString (PyExc_TypeError, _("The value of `enabled' must be a boolean.")); return -1; } cmp = PyObject_IsTrue (newvalue); if (cmp < 0) return -1; TRY_CATCH (except, RETURN_MASK_ALL) { if (cmp == 1) enable_breakpoint (self_bp->bp); else disable_breakpoint (self_bp->bp); } GDB_PY_SET_HANDLE_EXCEPTION (except); return 0; }
/* Python function to set the (Ada) task of a breakpoint. */ static int bppy_set_task (PyObject *self, PyObject *newvalue, void *closure) { breakpoint_object *self_bp = (breakpoint_object *) self; int id; BPPY_SET_REQUIRE_VALID (self_bp); if (newvalue == NULL) { PyErr_SetString (PyExc_TypeError, _("Cannot delete `task' attribute.")); return -1; } else if (PyInt_Check (newvalue)) { id = (int) PyInt_AsLong (newvalue); if (! valid_task_id (id)) { PyErr_SetString (PyExc_RuntimeError, _("Invalid task ID.")); return -1; } } else if (newvalue == Py_None) id = 0; else { PyErr_SetString (PyExc_TypeError, _("The value of `task' must be an integer or None.")); return -1; } self_bp->bp->task = id; return 0; }