aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c57
1 files changed, 37 insertions, 20 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 7807e4e..dcf1d5a 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -114,7 +114,6 @@ 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);
@@ -136,14 +135,18 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
if (cmp < 0)
return -1;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (cmp == 1)
enable_breakpoint (self_bp->bp);
else
disable_breakpoint (self_bp->bp);
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return 0;
}
@@ -227,7 +230,6 @@ 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);
@@ -242,11 +244,15 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
if (! gdb_py_int_as_long (newvalue, &id))
return -1;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
valid_id = valid_task_id (id);
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (! valid_id)
{
@@ -278,15 +284,18 @@ static PyObject *
bppy_delete_breakpoint (PyObject *self, PyObject *args)
{
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
- volatile struct gdb_exception except;
BPPY_REQUIRE_VALID (self_bp);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
delete_breakpoint (self_bp->bp);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
@@ -298,7 +307,6 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
{
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
long value;
- volatile struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp);
@@ -321,11 +329,15 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
if (value < 0)
value = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_ignore_count (self_bp->number, (int) value, 0);
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return 0;
}
@@ -429,7 +441,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
{
char *exp;
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
BPPY_SET_REQUIRE_VALID (self_bp);
@@ -448,10 +460,15 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
return -1;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_breakpoint_condition (self_bp->bp, exp, 0);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
if (newvalue != Py_None)
xfree (exp);
@@ -468,7 +485,6 @@ bppy_get_commands (PyObject *self, void *closure)
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
struct breakpoint *bp = self_bp->bp;
long length;
- volatile struct gdb_exception except;
struct ui_file *string_file;
struct cleanup *chain;
PyObject *result;
@@ -483,17 +499,18 @@ bppy_get_commands (PyObject *self, void *closure)
chain = make_cleanup_ui_file_delete (string_file);
ui_out_redirect (current_uiout, string_file);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
}
ui_out_redirect (current_uiout, NULL);
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
do_cleanups (chain);
gdbpy_convert_exception (except);
return NULL;
}
+ END_CATCH
cmdstr = ui_file_xstrdup (string_file, &length);
make_cleanup (xfree, cmdstr);
@@ -619,7 +636,6 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
PyObject *temporary = NULL;
int internal_bp = 0;
int temporary_bp = 0;
- volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiOO", keywords,
&spec, &type, &access_type,
@@ -644,7 +660,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
bppy_pending_object->number = -1;
bppy_pending_object->bp = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
char *copy = xstrdup (spec);
struct cleanup *cleanup = make_cleanup (xfree, copy);
@@ -681,13 +697,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
do_cleanups (cleanup);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
PyErr_Format (except.reason == RETURN_QUIT
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
"%s", except.message);
return -1;
}
+ END_CATCH
BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
return 0;