PyObject *
gdbpy_parameter (PyObject *self, PyObject *args)
{
+ struct gdb_exception except = exception_none;
struct cmd_list_element *alias, *prefix, *cmd;
const char *arg;
char *newarg;
int found = -1;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "s", &arg))
return NULL;
newarg = concat ("show ", arg, (char *) NULL);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
xfree (newarg);
GDB_PY_HANDLE_EXCEPTION (except);
if (!found)
const char *arg;
PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
int from_tty, to_string;
- volatile struct gdb_exception except;
static char *keywords[] = {"command", "from_tty", "to_string", NULL };
char *result = NULL;
to_string = cmp;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Copy the argument text in case the command modifies it. */
char *copy = xstrdup (arg);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
/* Do any commands attached to breakpoint we stopped at. */
bpstat_do_actions ();
static PyObject *
gdbpy_decode_line (PyObject *self, PyObject *args)
{
+ struct gdb_exception except = exception_none;
struct symtabs_and_lines sals = { NULL, 0 }; /* Initialize to
appease gcc. */
struct symtab_and_line sal;
PyObject *result = NULL;
PyObject *return_result = NULL;
PyObject *unparsed = NULL;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "|s", &arg))
return NULL;
cleanups = make_cleanup (null_cleanup, NULL);
sals.sals = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+
+ TRY
{
if (arg)
{
sals.nelts = 1;
}
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
if (sals.sals != NULL && sals.sals != &sal)
{
{
const char *expr_str;
struct value *result = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, "s", &expr_str))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = parse_and_eval (expr_str);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (result);
}
gdbpy_find_pc_line (PyObject *self, PyObject *args)
{
gdb_py_ulongest pc_llu;
- volatile struct gdb_exception except;
PyObject *result = NULL; /* init for gcc -Wall */
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc_llu))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct symtab_and_line sal;
CORE_ADDR pc;
sal = find_pc_line (pc, 0);
result = symtab_and_line_to_sal_object (sal);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
const char *arg;
static char *keywords[] = {"text", "stream", NULL };
int stream_type = 0;
- volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
&stream_type))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (stream_type)
{
fprintf_filtered (gdb_stdout, "%s", arg);
}
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
void
gdbpy_print_stack (void)
{
- volatile struct gdb_exception except;
/* Print "none", just clear exception. */
if (gdbpy_should_print_stack == python_excp_none)
/* PyErr_Print doesn't necessarily end output with a newline.
This works because Python's stdout/stderr is fed through
printf_filtered. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
begin_line ();
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
}
/* Print "message", just error print message. */
else
msg = gdbpy_exception_to_string (ptype, pvalue);
type = gdbpy_obj_to_string (ptype);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (msg == NULL)
{
fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
type, msg);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
Py_XDECREF (ptype);
Py_XDECREF (pvalue);