static enum ext_lang_bt_status
py_print_type (struct ui_out *out, struct value *val)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct type *type;
struct ui_file *stb;
ui_out_field_stream (out, "type", stb);
do_cleanups (cleanup);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
return EXT_LANG_BT_OK;
}
const struct language_defn *language)
{
int should_print = 0;
- volatile struct gdb_exception except;
int local_indent = (4 * indent);
/* Never set an indent level for common_val_print if MI. */
{
struct type *type = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (value_type (val));
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
if (args_type == MI_PRINT_ALL_VALUES)
should_print = 1;
if (should_print)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb;
struct cleanup *cleanup;
ui_out_field_stream (out, "value", stb);
do_cleanups (cleanup);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
return EXT_LANG_BT_OK;
const struct language_defn *language)
{
struct value *val;
- volatile struct gdb_exception except;
enum ext_lang_bt_status retval = EXT_LANG_BT_OK;
if (fa != NULL)
else
val = fv;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
do_cleanups (cleanups);
}
- if (except.reason < 0)
- gdbpy_convert_exception (except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ gdbpy_convert_exception (except);
+ }
+ END_CATCH
return retval;
}
{
PyObject *item;
struct value_print_options opts;
- volatile struct gdb_exception except;
get_user_print_options (&opts);
opts.deref_ref = 1;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
annotate_frame_args ();
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
/* Collect the first argument outside of the loop, so output of
commas in the argument output is correct. At the end of the
goto error;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
read_frame_arg (sym, frame, &arg, &entryarg);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (sym_name);
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
/* The object has not provided a value, so this is a frame
argument to be read by GDB. In this case we have to
{
if (arg.entry_kind != print_entry_values_only)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ui_out_text (out, ", ");
ui_out_wrap_hint (out, " ");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (arg.error);
xfree (entryarg.error);
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
}
if (py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
item = PyIter_Next (iter);
if (item != NULL)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ui_out_text (out, ", ");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
Py_DECREF (item);
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
}
else if (PyErr_Occurred ())
goto error;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
annotate_arg_end ();
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
Py_DECREF (item);
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
}
return EXT_LANG_BT_OK;
struct value *val;
enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
struct symbol *sym;
- volatile struct gdb_exception except;
int local_indent = 8 + (8 * indent);
struct cleanup *locals_cleanups;
/* If the object did not provide a value, read it. */
if (val == NULL)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
val = read_var_value (sym, frame);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (locals_cleanups);
goto error;
}
+ END_CATCH
}
/* With PRINT_NO_VALUES, MI does not emit a tuple normally as
if (print_args_field || args_type != NO_VALUES)
make_cleanup_ui_out_tuple_begin_end (out, NULL);
}
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
if (! ui_out_is_mi_like_p (out))
{
if (! ui_out_is_mi_like_p (out))
ui_out_text (out, " = ");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (locals_cleanups);
goto error;
}
+ END_CATCH
if (args_type == MI_PRINT_SIMPLE_VALUES)
{
do_cleanups (locals_cleanups);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ui_out_text (out, "\n");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
goto error;
}
+ END_CATCH
}
if (item == NULL && PyErr_Occurred ())
{
PyObject *args_iter = get_py_iter_from_func (filter, "frame_args");
struct cleanup *old_chain = make_cleanup_py_xdecref (args_iter);
- volatile struct gdb_exception except;
if (args_iter == NULL)
goto args_error;
make_cleanup_ui_out_list_begin_end (out, "args");
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
annotate_frame_args ();
if (! ui_out_is_mi_like_p (out))
ui_out_text (out, " (");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
goto args_error;
}
+ END_CATCH
if (args_iter != Py_None)
if (enumerate_args (args_iter, out, args_type, 0, frame)
== EXT_LANG_BT_ERROR)
goto args_error;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (! ui_out_is_mi_like_p (out))
ui_out_text (out, ")");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
goto args_error;
}
+ END_CATCH
do_cleanups (old_chain);
return EXT_LANG_BT_OK;
struct value_print_options opts;
PyObject *py_inf_frame;
int print_level, print_frame_info, print_args, print_locals;
- volatile struct gdb_exception except;
/* Extract print settings from FLAGS. */
print_level = (flags & PRINT_LEVEL) ? 1 : 0;
if (frame == NULL)
return EXT_LANG_BT_ERROR;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
gdbarch = get_frame_arch (frame);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
/* stack-list-variables. */
if (print_locals && print_args && ! print_frame_info)
and are printed with indention. */
if (indent > 0)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ui_out_spaces (out, indent*4);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
/* The address is required for frame annotations, and also for
{
struct frame_info **slot;
int level;
- volatile struct gdb_exception except;
slot = (struct frame_info **) htab_find_slot (levels_printed,
frame, INSERT);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
level = frame_relative_level (frame);
level);
}
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
if (print_frame_info)
print nothing. */
if (opts.addressprint && has_addr)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
annotate_frame_address ();
ui_out_field_core_addr (out, "addr", gdbarch, address);
annotate_frame_address_end ();
ui_out_text (out, " in ");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
/* Print frame function name. */
return EXT_LANG_BT_ERROR;
}
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
annotate_frame_function_name ();
if (function == NULL)
else
ui_out_field_string (out, "func", function);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
+
do_cleanups (py_func_cleanup);
}
}
/* File name/source/line number information. */
if (print_frame_info)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
annotate_frame_source_begin ();
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
if (PyObject_HasAttrString (filter, "filename"))
{
}
make_cleanup (xfree, filename);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ui_out_wrap_hint (out, " ");
ui_out_text (out, " at ");
ui_out_field_string (out, "file", filename);
annotate_frame_source_file_end ();
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
do_cleanups (py_fn_cleanup);
}
if (py_line != Py_None)
{
line = PyLong_AsLong (py_line);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ui_out_text (out, ":");
annotate_frame_source_line ();
ui_out_field_int (out, "line", line);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
do_cleanups (py_line_cleanup);
}
elided frames, so if MI output detected do not send newline. */
if (! ui_out_is_mi_like_p (out))
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
annotate_frame_end ();
ui_out_text (out, "\n");
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
gdbpy_convert_exception (except);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
+ END_CATCH
}
if (print_locals)
struct cleanup *cleanups;
enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
PyObject *iterable;
- volatile struct gdb_exception except;
PyObject *item;
htab_t levels_printed;
if (!gdb_python_initialized)
return EXT_LANG_BT_NO_FILTERS;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
gdbarch = get_frame_arch (frame);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
/* Let gdb try to print the stack trace. */
return EXT_LANG_BT_NO_FILTERS;
}
+ END_CATCH
cleanups = ensure_python_env (gdbarch, current_language);