/* 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; } }
int get_addr_from_python (PyObject *obj, CORE_ADDR *addr) { if (gdbpy_is_value_object (obj)) { TRY { *addr = value_as_address (value_object_to_value (obj)); } CATCH (except, RETURN_MASK_ALL) { GDB_PY_SET_HANDLE_EXCEPTION (except); } END_CATCH }
/* 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; }