+2015-03-07 Pedro Alves <palves@redhat.com>
+
+ * common/common-exceptions.c (struct catcher) <exception>: No
+ longer a pointer to volatile exception. Now an exception value.
+ <mask>: Delete field.
+ (exceptions_state_mc_init): Remove all parameters. Adjust.
+ (exceptions_state_mc): No longer pop the catcher here.
+ (exceptions_state_mc_catch): New function.
+ (throw_exception): Adjust.
+ * common/common-exceptions.h (exceptions_state_mc_init): Remove
+ all parameters.
+ (exceptions_state_mc_catch): Declare.
+ (TRY_CATCH): Rename to ...
+ (TRY): ... this. Remove EXCEPTION and MASK parameters.
+ (CATCH, END_CATCH): New.
+ All callers adjusted.
+
2015-03-07 Tom Tromey <tromey@redhat.com>
* top.c (quit_force): Inline and delete DO_TRY, DO_PRINT_EX.
struct value *
ada_tag_value_at_base_address (struct value *obj)
{
- volatile struct gdb_exception e;
struct value *val;
LONGEST offset_to_top = 0;
struct type *ptr_type, *obj_type;
see ada_tag_name for more details. We do not print the error
message for the same reason. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
offset_to_top = value_as_long (value_ind (value_ptradd (val, -2)));
}
- if (e.reason < 0)
- return obj;
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ return obj;
+ }
+ END_CATCH
/* If offset is null, nothing to do. */
const char *
ada_tag_name (struct value *tag)
{
- volatile struct gdb_exception e;
char *name = NULL;
if (!ada_is_tag_type (value_type (tag)))
We also do not print the error message either (which often is very
low-level (Eg: "Cannot read memory at 0x[...]"), but instead let
the caller print a more meaningful message if necessary. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
struct value *tsd = ada_get_tsd_from_tag (tag);
if (tsd != NULL)
name = ada_tag_name_from_tsd (tsd);
}
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
return name;
}
ada_exception_name_addr (enum ada_exception_catchpoint_kind ex,
struct breakpoint *b)
{
- volatile struct gdb_exception e;
CORE_ADDR result = 0;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
result = ada_exception_name_addr_1 (ex, b);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
warning (_("failed to get exception name: %s"), e.message);
return 0;
}
+ END_CATCH
return result;
}
if (!bl->shlib_disabled)
{
- volatile struct gdb_exception e;
const char *s;
s = cond_string;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
exp = parse_exp_1 (&s, bl->address,
block_for_pc (bl->address), 0);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
warning (_("failed to reevaluate internal exception condition "
"for catchpoint %d: %s"),
to NULL. */
exp = NULL;
}
+ END_CATCH
}
ada_loc->excep_cond_expr = exp;
struct ada_catchpoint *c = (struct ada_catchpoint *) bl->owner;
const struct ada_catchpoint_location *ada_loc
= (const struct ada_catchpoint_location *) bl;
- volatile struct gdb_exception ex;
int stop;
/* With no specific exception, should always stop. */
}
stop = 1;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
struct value *mark;
stop = value_true (evaluate_expression (ada_loc->excep_cond_expr));
value_free_to_mark (mark);
}
- if (ex.reason < 0)
- exception_fprintf (gdb_stderr, ex,
- _("Error in testing exception condition:\n"));
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_fprintf (gdb_stderr, ex,
+ _("Error in testing exception condition:\n"));
+ }
+ END_CATCH
+
return stop;
}
case TYPE_CODE_ENUM:
{
struct type *target_type;
- volatile struct gdb_exception e;
LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
+ int got_error = 0;
target_type = TYPE_TARGET_TYPE (type);
if (target_type == NULL)
target_type = type;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
lo = ada_discrete_type_low_bound (type);
hi = ada_discrete_type_high_bound (type);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
/* This can happen when the range is dynamic. Sometimes,
resolving dynamic property values requires us to have
when the user is using the "ptype" command on a type.
Print the range as an unbounded range. */
fprintf_filtered (stream, "<>");
+ got_error = 1;
}
- else
+ END_CATCH
+
+ if (!got_error)
{
ada_print_scalar (target_type, lo, stream);
fprintf_filtered (stream, " .. ");
const struct value *val,
const struct value_print_options *options)
{
- volatile struct gdb_exception except;
/* XXX: this catches QUIT/ctrl-c as well. Isn't that busted? */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ada_val_print_1 (type, valaddr, embedded_offset, address,
stream, recurse, val, options,
current_language);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
}
void
static struct amd64_frame_cache *
amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
{
- volatile struct gdb_exception ex;
struct amd64_frame_cache *cache;
if (*this_cache)
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
amd64_frame_cache_1 (this_frame, cache);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return cache;
}
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- volatile struct gdb_exception ex;
struct amd64_frame_cache *cache;
CORE_ADDR addr;
gdb_byte buf[8];
cache = amd64_alloc_frame_cache ();
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8;
cache->base_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
*this_cache = cache;
return cache;
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- volatile struct gdb_exception ex;
struct amd64_frame_cache *cache;
gdb_byte buf[8];
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
/* Cache base will be %esp plus cache->sp_offset (-8). */
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return cache;
}
struct exception_catchpoint *self
= (struct exception_catchpoint *) bs->breakpoint_at;
char *type_name = NULL;
- volatile struct gdb_exception e;
bkpt_breakpoint_ops.check_status (bs);
if (bs->stop == 0)
if (self->pattern == NULL)
return;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
struct value *typeinfo_arg;
char *canon;
type_name = canon;
}
}
- if (e.reason < 0)
- exception_print (gdb_stderr, e);
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, e);
+ }
+ END_CATCH
if (type_name != NULL)
{
{
struct symtabs_and_lines sals = {0};
struct symtabs_and_lines sals_end = {0};
- volatile struct gdb_exception e;
struct cleanup *cleanup;
enum exception_event_kind kind = classify_exception_breakpoint (self);
/* We first try to use the probe interface. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
char *spec = ASTRDUP (exception_functions[kind].probe);
sals = parse_probes (&spec, NULL);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
- volatile struct gdb_exception ex;
/* Using the probe interface failed. Let's fallback to the normal
catchpoint mode. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
char *spec = ASTRDUP (exception_functions[kind].function);
self->ops->decode_linespec (self, &spec, &sals);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
/* NOT_FOUND_ERROR just means the breakpoint will be
pending, so let it through. */
if (ex.error != NOT_FOUND_ERROR)
throw_exception (ex);
}
+ END_CATCH
}
+ END_CATCH
cleanup = make_cleanup (xfree, sals.sals);
update_breakpoint_locations (self, sals, sals_end);
parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
{
struct agent_expr *aexpr = NULL;
- volatile struct gdb_exception ex;
if (!cond)
return NULL;
/* We don't want to stop processing, so catch any errors
that may show up. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
aexpr = gen_eval_for_expr (scope, cond);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
/* If we got here, it means the condition could not be parsed to a valid
bytecode expression and thus can't be evaluated on the target's side.
It's no use iterating through the conditions. */
return NULL;
}
+ END_CATCH
/* We have a valid agent expression. */
return aexpr;
struct cleanup *old_cleanups = 0;
struct expression *expr, **argvec;
struct agent_expr *aexpr = NULL;
- volatile struct gdb_exception ex;
const char *cmdrest;
const char *format_start, *format_end;
struct format_piece *fpieces;
/* We don't want to stop processing, so catch any errors
that may show up. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
aexpr = gen_printf (scope, gdbarch, 0, 0,
format_start, format_end - format_start,
fpieces, nargs, argvec);
}
-
- do_cleanups (old_cleanups);
-
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
/* If we got here, it means the command could not be parsed to a valid
bytecode expression and thus can't be evaluated on the target's side.
It's no use iterating through the other commands. */
- return NULL;
+ aexpr = NULL;
}
+ END_CATCH
+
+ do_cleanups (old_cleanups);
/* We have a valid agent expression, return it. */
return aexpr;
{
enum errors bp_err = GDB_NO_ERROR;
const char *bp_err_message = NULL;
- volatile struct gdb_exception e;
if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
return 0;
|| !(section_is_overlay (bl->section)))
{
/* No overlay handling: just set the breakpoint. */
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int val;
if (val)
bp_err = GENERIC_ERROR;
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ALL)
{
bp_err = e.error;
bp_err_message = e.message;
}
+ END_CATCH
}
else
{
bl->overlay_target_info.reqstd_address = addr;
/* No overlay handling: just set the breakpoint. */
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int val;
if (val)
bp_err = GENERIC_ERROR;
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ALL)
{
bp_err = e.error;
bp_err_message = e.message;
}
+ END_CATCH
if (bp_err != GDB_NO_ERROR)
fprintf_unfiltered (tmp_error_stream,
if (section_is_mapped (bl->section))
{
/* Yes. This overlay section is mapped into memory. */
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int val;
if (val)
bp_err = GENERIC_ERROR;
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ALL)
{
bp_err = e.error;
bp_err_message = e.message;
}
+ END_CATCH
}
else
{
int from_tty, int enabled, int internal,
unsigned flags)
{
- volatile struct gdb_exception e;
char *copy_arg = NULL;
char *addr_start = arg;
struct linespec_result canonical;
init_linespec_result (&canonical);
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
ops->create_sals_from_address (&arg, &canonical, type_wanted,
addr_start, ©_arg);
}
-
- /* If caller is interested in rc value from parse, set value. */
- switch (e.reason)
+ CATCH (e, RETURN_MASK_ERROR)
{
- case GDB_NO_ERROR:
- if (VEC_empty (linespec_sals, canonical.sals))
- return 0;
- break;
- case RETURN_ERROR:
- switch (e.error)
+ /* If caller is interested in rc value from parse, set
+ value. */
+ if (e.error == NOT_FOUND_ERROR)
{
- case NOT_FOUND_ERROR:
-
/* If pending breakpoint support is turned off, throw
error. */
pending = 1;
VEC_safe_push (linespec_sals, canonical.sals, &lsal);
}
- break;
- default:
- throw_exception (e);
}
- break;
- default:
- throw_exception (e);
+ else
+ throw_exception (e);
}
+ END_CATCH
+
+ if (VEC_empty (linespec_sals, canonical.sals))
+ return 0;
/* Create a chain of things that always need to be cleaned up. */
old_chain = make_cleanup_destroy_linespec_result (&canonical);
watch_command_1 (const char *arg, int accessflag, int from_tty,
int just_location, int internal)
{
- volatile struct gdb_exception e;
struct breakpoint *b, *scope_breakpoint = NULL;
struct expression *exp;
const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
if (!just_location)
value_free_to_mark (mark);
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
/* Finally update the new watchpoint. This creates the locations
that should be inserted. */
update_watchpoint (w, 1);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ALL)
{
delete_breakpoint (b);
throw_exception (e);
}
+ END_CATCH
install_breakpoint (internal, b, 1);
do_cleanups (back_to);
static void
update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
{
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ERROR)
- update_global_location_list (insert_mode);
+ TRY
+ {
+ update_global_location_list (insert_mode);
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
/* Clear BKP from a BPS. */
if (b->cond_string != NULL)
{
const char *s;
- volatile struct gdb_exception e;
s = b->cond_string;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
new_loc->cond = parse_exp_1 (&s, sals.sals[i].pc,
block_for_pc (sals.sals[i].pc),
0);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
warning (_("failed to reevaluate condition "
"for breakpoint %d: %s"),
b->number, e.message);
new_loc->enabled = 0;
}
+ END_CATCH
}
if (sals_end.nelts)
{
char *s;
struct symtabs_and_lines sals = {0};
- volatile struct gdb_exception e;
+ struct gdb_exception exception = exception_none;
gdb_assert (b->ops != NULL);
s = addr_string;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
b->ops->decode_linespec (b, &s, &sals);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
int not_found_and_ok = 0;
+
+ exception = e;
+
/* For pending breakpoints, it's expected that parsing will
fail until the right shared library is loaded. User has
already told to create pending breakpoints and don't need
throw_exception (e);
}
}
+ END_CATCH
- if (e.reason == 0 || e.error != NOT_FOUND_ERROR)
+ if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
{
int i;
{
/* Initialize it just to avoid a GCC false warning. */
enum enable_state orig_enable_state = 0;
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
struct watchpoint *w = (struct watchpoint *) bpt;
bpt->enable_state = bp_enabled;
update_watchpoint (w, 1 /* reparse */);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ALL)
{
bpt->enable_state = orig_enable_state;
exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
bpt->number);
return;
}
+ END_CATCH
}
bpt->enable_state = bp_enabled;
if (tp->type != bp_dprintf && tp->commands)
{
- volatile struct gdb_exception ex;
fprintf_unfiltered (fp, " commands\n");
ui_out_redirect (current_uiout, fp);
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
print_command_lines (current_uiout, tp->commands->commands, 2);
}
ui_out_redirect (current_uiout, NULL);
- if (ex.reason < 0)
- throw_exception (ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ throw_exception (ex);
+ }
+ END_CATCH
fprintf_unfiltered (fp, " end\n");
}
static enum btrace_insn_class
ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- volatile struct gdb_exception error;
enum btrace_insn_class iclass;
iclass = BTRACE_INSN_OTHER;
- TRY_CATCH (error, RETURN_MASK_ERROR)
+ TRY
{
if (gdbarch_insn_is_call (gdbarch, pc))
iclass = BTRACE_INSN_CALL;
else if (gdbarch_insn_is_jump (gdbarch, pc))
iclass = BTRACE_INSN_JUMP;
}
+ CATCH (error, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
return iclass;
}
for (;;)
{
- volatile struct gdb_exception error;
struct btrace_insn insn;
int size;
level = min (level, end->level);
size = 0;
- TRY_CATCH (error, RETURN_MASK_ERROR)
- size = gdb_insn_length (gdbarch, pc);
+ TRY
+ {
+ size = gdb_insn_length (gdbarch, pc);
+ }
+ CATCH (error, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
insn.pc = pc;
insn.size = size;
{
if (value && *value)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*value = value_ind (*value);
}
- if (except.reason < 0)
- *value = NULL;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ *value = NULL;
+ }
+ END_CATCH
}
*type = target_type;
if (was_ptr)
value_struct_element_index (struct value *value, int type_index)
{
struct value *result = NULL;
- volatile struct gdb_exception e;
struct type *type = value_type (value);
type = check_typedef (type);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION);
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
if (field_is_static (&TYPE_FIELD (type, type_index)))
result = value_static_field (type, type_index);
else
result = value_primitive_field (value, 0, type_index, type);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
return NULL;
}
- else
- {
- return result;
- }
+ END_CATCH
+
+ return result;
}
/* Obtain the information about child INDEX of the variable
struct type *type = varobj_get_value_type (parent);
char *parent_expression = NULL;
int was_ptr;
- volatile struct gdb_exception except;
if (cname)
*cname = NULL;
{
int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*cvalue = value_subscript (value, real_index);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
if (ctype)
if (cvalue && value)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*cvalue = value_ind (value);
}
- if (except.reason < 0)
- *cvalue = NULL;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ *cvalue = NULL;
+ }
+ END_CATCH
}
/* Don't use get_target_type because it calls
static struct gdb_exception
safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
{
- volatile struct gdb_exception exception;
struct gdb_exception e = exception_none;
struct ui_out *saved_uiout;
saved_uiout = current_uiout;
current_uiout = command_uiout;
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
execute_command (command, from_tty);
}
- if (exception.reason < 0)
+ CATCH (exception, RETURN_MASK_ALL)
{
e = exception;
}
+ END_CATCH
/* Restore the global builder. */
current_uiout = saved_uiout;
if (validator)
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
validator ((*command)->line, closure);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
xfree (*command);
throw_exception (ex);
}
+ END_CATCH
}
/* Nothing special. */
interpreter_async = 0;
{
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
read_command_file (stream);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
/* Re-throw the error, but with the file name information
prepended. */
_("%s:%d: Error in sourced command file:\n%s"),
source_file_name, source_line_number, e.message);
}
+ END_CATCH
}
do_cleanups (old_cleanups);
/* Jump buffer pointing back at the exception handler. */
SIGJMP_BUF buf;
/* Status buffer belonging to the exception handler. */
- volatile struct gdb_exception *exception;
- /* Saved/current state. */
- int mask;
+ struct gdb_exception exception;
struct cleanup *saved_cleanup_chain;
/* Back link. */
struct catcher *prev;
}
SIGJMP_BUF *
-exceptions_state_mc_init (volatile struct gdb_exception *exception,
- return_mask mask)
+exceptions_state_mc_init (void)
{
struct catcher *new_catcher = XCNEW (struct catcher);
- /* Start with no exception, save it's address. */
- *exception = exception_none;
- new_catcher->exception = exception;
-
- new_catcher->mask = mask;
+ /* Start with no exception. */
+ new_catcher->exception = exception_none;
/* Prevent error/quit during FUNC from calling cleanups established
prior to here. */
switch (action)
{
case CATCH_ITER:
- /* No error/quit has occured. Just clean up. */
- catcher_pop ();
+ /* No error/quit has occured. */
return 0;
case CATCH_ITER_1:
current_catcher->state = CATCHER_RUNNING_1;
{
case CATCH_ITER:
/* The did a "break" from the inner while loop. */
- catcher_pop ();
return 0;
case CATCH_ITER_1:
current_catcher->state = CATCHER_RUNNING;
{
case CATCH_ITER:
{
- struct gdb_exception exception = *current_catcher->exception;
-
- if (current_catcher->mask & RETURN_MASK (exception.reason))
- {
- /* Exit normally if this catcher can handle this
- exception. The caller analyses the func return
- values. */
- catcher_pop ();
- return 0;
- }
- /* The caller didn't request that the event be caught,
- relay the event to the next containing
- catch_errors(). */
- catcher_pop ();
- throw_exception (exception);
+ /* Exit normally if this catcher can handle this
+ exception. The caller analyses the func return
+ values. */
+ return 0;
}
default:
internal_error (__FILE__, __LINE__, _("bad state"));
}
int
+exceptions_state_mc_catch (struct gdb_exception *exception,
+ int mask)
+{
+ *exception = current_catcher->exception;
+ catcher_pop ();
+
+ if (exception->reason < 0)
+ {
+ if (mask & RETURN_MASK (exception->reason))
+ {
+ /* Exit normally and let the called handle the
+ exception. */
+ return 1;
+ }
+
+ /* The caller didn't request that the event be caught, relay the
+ event to the next exception_catch/CATCH. */
+ throw_exception (*exception);
+ }
+
+ /* No exception was thrown. */
+ return 0;
+}
+
+int
exceptions_state_mc_action_iter (void)
{
return exceptions_state_mc (CATCH_ITER);
to that call via setjmp's return value. Note that REASON can't
be zero, by definition in defs.h. */
exceptions_state_mc (CATCH_THROWING);
- *current_catcher->exception = exception;
+ current_catcher->exception = exception;
SIGLONGJMP (current_catcher->buf, exception.reason);
}
/* Functions to drive the exceptions state machine. Though declared
here by necessity, these functions should be considered internal to
- the exceptions subsystem and not used other than via the TRY_CATCH
- macro defined below. */
+ the exceptions subsystem and not used other than via the TRY/CATCH
+ macros defined below. */
-extern SIGJMP_BUF *exceptions_state_mc_init (volatile struct
- gdb_exception *exception,
- return_mask mask);
+extern SIGJMP_BUF *exceptions_state_mc_init (void);
extern int exceptions_state_mc_action_iter (void);
extern int exceptions_state_mc_action_iter_1 (void);
+extern int exceptions_state_mc_catch (struct gdb_exception *, int);
/* Macro to wrap up standard try/catch behavior.
*INDENT-OFF*
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
}
- switch (e.reason)
+ CATCH (e, RETURN_MASK_ERROR)
{
- case RETURN_ERROR: ...
+ switch (e.reason)
+ {
+ case RETURN_ERROR: ...
+ }
}
+ END_CATCH
*/
-#define TRY_CATCH(EXCEPTION,MASK) \
+#define TRY \
{ \
SIGJMP_BUF *buf = \
- exceptions_state_mc_init (&(EXCEPTION), (MASK)); \
+ exceptions_state_mc_init (); \
SIGSETJMP (*buf); \
} \
while (exceptions_state_mc_action_iter ()) \
while (exceptions_state_mc_action_iter_1 ())
+#define CATCH(EXCEPTION, MASK) \
+ { \
+ struct gdb_exception EXCEPTION; \
+ if (exceptions_state_mc_catch (&(EXCEPTION), MASK))
+
+#define END_CATCH \
+ }
+
/* *INDENT-ON* */
/* Hook to allow client-specific actions to be performed prior to
{
struct compile_c_instance *context = datum;
domain_enum domain;
- volatile struct gdb_exception e;
int found = 0;
switch (request)
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
struct symbol *sym;
}
}
- if (e.reason < 0)
- C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+ }
+ END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdout,
const char *identifier)
{
struct compile_c_instance *context = datum;
- volatile struct gdb_exception e;
gcc_address result = 0;
int found = 0;
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
struct symbol *sym;
}
}
- if (e.reason < 0)
- C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+ }
+ END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdout,
CORE_ADDR pc,
struct symbol *sym)
{
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
if (is_dynamic_type (SYMBOL_TYPE (sym)))
{
}
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
if (compiler->symbol_err_map == NULL)
compiler->symbol_err_map = htab_create_alloc (10,
xfree);
insert_symbol_error (compiler->symbol_err_map, sym, e.message);
}
+ END_CATCH
}
/* See compile-internal.h. */
struct frame_id dummy_id;
struct cleanup *cleanups;
struct do_module_cleanup *data;
- volatile struct gdb_exception ex;
const char *objfile_name_s = objfile_name (module->objfile);
int dtor_found, executed = 0;
CORE_ADDR func_addr = module->func_addr;
xfree (module->source_file);
xfree (module);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
func_val = value_from_pointer
(builtin_type (target_gdbarch ())->builtin_func_ptr,
do_module_cleanup, data);
}
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
/* In the case of DTOR_FOUND or in the case of EXECUTED nothing
needs to be done. */
do_module_cleanup (data);
throw_exception (ex);
}
+ END_CATCH
dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
gdb_assert (!dtor_found && executed);
struct type *type = NULL;
char *fieldname;
const char *p;
- volatile struct gdb_exception except;
enum type_code code = TYPE_CODE_UNDEF;
/* Perform a tentative parse of the expression, to see whether a
field completion is required. */
fieldname = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
type = parse_expression_for_completion (text, &fieldname, &code);
}
- if (except.reason < 0)
- return NULL;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ return NULL;
+ }
+ END_CATCH
+
if (fieldname && type)
{
for (;;)
bfd *temp_bfd;
int scratch_chan;
int flags;
- volatile struct gdb_exception except;
char *filename;
target_preopen (from_tty);
may be a thread_stratum target loaded on top of target core by
now. The layer above should claim threads found in the BFD
sections. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
target_update_thread_list ();
}
- if (except.reason < 0)
- exception_print (gdb_stderr, except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
p = bfd_core_file_failing_command (core_bfd);
if (p)
anything about threads. That is why the test is >= 2. */
if (thread_count () >= 2)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
thread_command (NULL, from_tty);
}
- if (except.reason < 0)
- exception_print (gdb_stderr, except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
}
}
int embedded_offset, CORE_ADDR address,
const struct value *val)
{
- volatile struct gdb_exception ex;
int res = 0;
gdb_assert (current_cp_abi.baseclass_offset != NULL);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
res = (*current_cp_abi.baseclass_offset) (type, index, valaddr,
embedded_offset,
address, val);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
_("Cannot determine virtual baseclass offset "
"of incomplete object"));
}
+ END_CATCH
return res;
}
int *top, int *using_enc)
{
struct type *ret = NULL;
- volatile struct gdb_exception e;
if ((current_cp_abi.rtti_type) == NULL)
return NULL;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
ret = (*current_cp_abi.rtti_type) (v, full, top, using_enc);
}
- if (e.reason < 0)
- return NULL;
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ return NULL;
+ }
+ END_CATCH
+
return ret;
}
int i;
char *name;
struct symbol *sym;
- volatile struct gdb_exception except;
/* Copy the symbol's name from RET_COMP and look it up
in the symbol table. */
}
sym = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
- {
- sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
- }
- if (except.reason >= 0 && sym != NULL)
+ TRY
+ {
+ sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
+ }
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ return 0;
+ }
+ END_CATCH
+
+ if (sym != NULL)
{
struct type *otype = SYMBOL_TYPE (sym);
}
buf = mem_fileopen ();
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
type_print (type, "", buf, -1);
}
/* If type_print threw an exception, there is little point
in continuing, so just bow out gracefully. */
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
ui_file_delete (buf);
return 0;
}
+ END_CATCH
name = ui_file_obsavestring (buf, &info->obstack, &len);
ui_file_delete (buf);
if (local_name != NULL)
{
- struct symbol *sym;
- volatile struct gdb_exception except;
+ struct symbol *sym = NULL;
sym = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
xfree (local_name);
- if (except.reason >= 0 && sym != NULL)
+ if (sym != NULL)
{
struct type *otype = SYMBOL_TYPE (sym);
const char *new_name = (*finder) (otype, data);
}
else if (field_is_static (&TYPE_FIELD (type, i)))
{
- volatile struct gdb_exception ex;
struct value *v = NULL;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
v = value_static_field (type, i);
}
- if (ex.reason < 0)
- fprintf_filtered (stream,
- _("<error reading variable: %s>"),
- ex.message);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (stream,
+ _("<error reading variable: %s>"),
+ ex.message);
+ }
+ END_CATCH
+
cp_print_static_field (TYPE_FIELD_TYPE (type, i),
v, stream, recurse + 1,
options);
const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr = NULL;
const struct value *base_val = NULL;
- volatile struct gdb_exception ex;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
thisoffset = offset;
thistype = real_type;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
skip = -1;
else
skip = 1;
}
+ END_CATCH
if (skip == 0)
{
struct gdbarch *prev_gdbarch;
struct call_site_chain *chain = NULL;
struct tailcall_cache *cache;
- volatile struct gdb_exception except;
gdb_assert (*tailcall_cachep == NULL);
this_pc = get_frame_address_in_block (this_frame);
/* Catch any unwinding errors. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
int sp_regnum;
prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum);
prev_sp_p = 1;
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (entry_values_debug)
exception_print (gdb_stdout, except);
return;
}
+ END_CATCH
/* Ambiguous unwind or unambiguous unwind verified as matching. */
if (chain == NULL || chain->length == 0)
struct dwarf2_frame_cache *cache;
struct dwarf2_frame_state *fs;
struct dwarf2_fde *fde;
- volatile struct gdb_exception ex;
CORE_ADDR entry_pc;
const gdb_byte *instr;
execute_cfa_program (fde, instr, fde->end, gdbarch,
get_frame_address_in_block (this_frame), fs);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
/* Calculate the CFA. */
switch (fs->regs.cfa_how)
internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
}
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
throw_exception (ex);
}
+ END_CATCH
/* Initialize the register state. */
{
struct dwarf2_cie_table cie_table;
struct dwarf2_fde_table fde_table;
struct dwarf2_fde_table *fde_table2;
- volatile struct gdb_exception e;
cie_table.num_entries = 0;
cie_table.entries = NULL;
if (txt)
unit->tbase = txt->vma;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
EH_CIE_OR_FDE_TYPE_ID);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
warning (_("skipping .eh_frame info of %s: %s"),
objfile_name (objfile), e.message);
}
/* The cie_table is discarded by the next if. */
}
+ END_CATCH
if (cie_table.num_entries != 0)
{
{
int num_old_fde_entries = fde_table.num_entries;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
&cie_table, &fde_table,
EH_CIE_OR_FDE_TYPE_ID);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
warning (_("skipping .debug_frame info of %s: %s"),
objfile_name (objfile), e.message);
fde_table.num_entries = num_old_fde_entries;
/* The cie_table is discarded by the next if. */
}
+ END_CATCH
}
/* Discard the cie_table, it is no longer needed. */
call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
CORE_ADDR callee_pc)
{
- volatile struct gdb_exception e;
struct call_site_chain *retval = NULL;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
retval = call_site_find_chain_1 (gdbarch, caller_pc, callee_pc);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
if (e.error == NO_ENTRY_VALUE_ERROR)
{
else
throw_exception (e);
}
+ END_CATCH
+
return retval;
}
struct dwarf_expr_context *ctx;
struct cleanup *old_chain, *value_chain;
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
- volatile struct gdb_exception ex;
if (byte_offset < 0)
invalid_synthetic_pointer ();
ctx->baton = &baton;
ctx->funcs = &dwarf_expr_ctx_funcs;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
dwarf_expr_eval (ctx, data, size);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
else
throw_exception (ex);
}
+ END_CATCH
if (ctx->num_pieces > 0)
{
void
dwarf2_build_psymtabs (struct objfile *objfile)
{
- volatile struct gdb_exception except;
if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
{
init_psymbol_list (objfile, 1024);
}
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
dwarf2_build_psymtabs_hard (objfile);
discard_cleanups (cleanups);
}
- if (except.reason < 0)
- exception_print (gdb_stderr, except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
}
/* Return the total length of the CU described by HEADER. */
dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
if (dwarf2_per_objfile)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
write_psymtabs_to_index (objfile, arg);
}
- if (except.reason < 0)
- exception_fprintf (gdb_stderr, except,
- _("Error while writing index for `%s': "),
- objfile_name (objfile));
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, except,
+ _("Error while writing index for `%s': "),
+ objfile_name (objfile));
+ }
+ END_CATCH
}
}
}
int preserve_errors)
{
struct value *mark, *new_mark, *result;
- volatile struct gdb_exception ex;
*valp = NULL;
if (resultp)
mark = value_mark ();
result = NULL;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
result = evaluate_subexp (NULL_TYPE, exp, pc, EVAL_NORMAL);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Ignore memory errors if we want watchpoints pointing at
inaccessible memory to still be created; otherwise, throw the
break;
}
}
+ END_CATCH
new_mark = value_mark ();
if (mark == new_mark)
*valp = result;
else
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value_fetch_lazy (result);
*valp = result;
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
}
or reference to a base class and print object is on. */
{
- volatile struct gdb_exception except;
struct value *ret = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ret = value_of_variable (exp->elts[pc + 2].symbol,
exp->elts[pc + 1].block);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
else
throw_exception (except);
}
+ END_CATCH
return ret;
}
operator and continue evaluation. */
while (unop_user_defined_p (op, arg2))
{
- volatile struct gdb_exception except;
struct value *value = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = value_x_unop (arg2, op, noside);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
+ END_CATCH
+
arg2 = value;
}
}
arg1 with the value returned by evaluating operator->(). */
while (unop_user_defined_p (op, arg1))
{
- volatile struct gdb_exception except;
struct value *value = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = value_x_unop (arg1, op, noside);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
+ END_CATCH
+
arg1 = value;
}
processes it. */
while (1)
{
- volatile struct gdb_exception ex;
int result = 0;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
result = gdb_do_one_event ();
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
exception_print (gdb_stderr, ex);
/* Maybe better to set a flag to be checked somewhere as to
whether display the prompt or not. */
}
+ END_CATCH
+
if (result < 0)
break;
}
static void
async_disconnect (gdb_client_data arg)
{
- volatile struct gdb_exception exception;
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
quit_cover ();
}
- if (exception.reason < 0)
+ CATCH (exception, RETURN_MASK_ALL)
{
fputs_filtered ("Could not kill the program being debugged",
gdb_stderr);
exception_print (gdb_stderr, exception);
}
+ END_CATCH
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
pop_all_targets ();
}
+ CATCH (exception, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */
raise (SIGHUP);
char **gdberrmsg,
return_mask mask)
{
- volatile struct gdb_exception ex;
struct gdb_exception exception = exception_none;
volatile int val = 0;
struct ui_out *saved_uiout;
saved_uiout = current_uiout;
current_uiout = func_uiout;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
val = (*func) (current_uiout, func_args);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
exception = ex;
}
+ END_CATCH
/* Restore the global builder. */
current_uiout = saved_uiout;
catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
return_mask mask)
{
+ struct gdb_exception exception = exception_none;
volatile int val = 0;
- volatile struct gdb_exception exception;
struct ui_out *saved_uiout;
/* Save the global ``struct ui_out'' builder. */
saved_uiout = current_uiout;
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
val = func (func_args);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception = ex;
+ }
+ END_CATCH
/* Restore the global builder. */
current_uiout = saved_uiout;
for (index = 0; index < common->n_entries; index++)
{
struct value *val = NULL;
- volatile struct gdb_exception except;
printf_filtered ("%s = ",
SYMBOL_PRINT_NAME (common->contents[index]));
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
val = value_of_variable (common->contents[index], block);
value_print (val, gdb_stdout, &opts);
}
- if (except.reason < 0)
- printf_filtered ("<error reading variable: %s>", except.message);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ printf_filtered ("<error reading variable: %s>", except.message);
+ }
+ END_CATCH
+
putchar_filtered ('\n');
}
}
const struct frame_unwind *unwinder)
{
struct cleanup *old_cleanup;
- volatile struct gdb_exception ex;
int res = 0;
old_cleanup = frame_prepare_for_sniffer (this_frame, unwinder);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
res = unwinder->sniffer (unwinder, this_frame, this_cache);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
}
throw_exception (ex);
}
+ END_CATCH
if (res)
{
{
if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
{
- volatile struct gdb_exception ex;
struct gdbarch *prev_gdbarch;
CORE_ADDR pc = 0;
+ int pc_p = 0;
/* The right way. The `pure' way. The one true way. This
method depends solely on the register-unwind code to
different ways that a PC could be unwound. */
prev_gdbarch = frame_unwind_arch (this_frame);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+ pc_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
else
throw_exception (ex);
}
- else
+ END_CATCH
+
+ if (pc_p)
{
this_frame->prev_pc.value = pc;
this_frame->prev_pc.status = CC_VALUE;
struct frame_info *
get_prev_frame_always (struct frame_info *this_frame)
{
- volatile struct gdb_exception ex;
struct frame_info *prev_frame = NULL;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
prev_frame = get_prev_frame_always_1 (this_frame);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == MEMORY_ERROR)
{
else
throw_exception (ex);
}
+ END_CATCH
return prev_frame;
}
int
get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
{
- volatile struct gdb_exception ex;
gdb_assert (frame->next != NULL);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
*pc = frame_unwind_pc (frame->next);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
return 0;
else
throw_exception (ex);
}
+ END_CATCH
return 1;
}
get_frame_address_in_block_if_available (struct frame_info *this_frame,
CORE_ADDR *pc)
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
*pc = get_frame_address_in_block (this_frame);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
return 0;
throw_exception (ex);
}
+ END_CATCH
return 1;
}
void
write_gcore_file (bfd *obfd)
{
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
target_prepare_to_generate_core ();
- TRY_CATCH (except, RETURN_MASK_ALL)
- write_gcore_file_1 (obfd);
+ TRY
+ {
+ write_gcore_file_1 (obfd);
+ }
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ except = e;
+ }
+ END_CATCH
target_done_generating_core ();
+2015-03-07 Pedro Alves <palves@redhat.com>
+
+ Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
+ instead.
+
2015-03-06 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_insert_point): Use
static void
detach_or_kill_for_exit_cleanup (void *ignore)
{
- volatile struct gdb_exception exception;
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
detach_or_kill_for_exit ();
}
- if (exception.reason < 0)
+ CATCH (exception, RETURN_MASK_ALL)
{
fflush (stdout);
fprintf (stderr, "Detach or kill failed: %s\n", exception.message);
exit_code = 1;
}
+ END_CATCH
}
/* Main function. This is called by the real "main" function,
while (1)
{
- volatile struct gdb_exception exception;
noack_mode = 0;
multi_process = 0;
remote_open (port);
- TRY_CATCH (exception, RETURN_MASK_ERROR)
+ TRY
{
/* Wait for events. This will return when all event sources
are removed from the event loop. */
}
}
}
-
- if (exception.reason == RETURN_ERROR)
+ CATCH (exception, RETURN_MASK_ERROR)
{
if (response_needed)
{
putpkt (own_buf);
}
}
+ END_CATCH
}
}
int
main (int argc, char *argv[])
{
- volatile struct gdb_exception exception;
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
captured_main (argc, argv);
}
-
- /* captured_main should never return. */
- gdb_assert (exception.reason < 0);
-
- if (exception.reason == RETURN_ERROR)
+ CATCH (exception, RETURN_MASK_ALL)
{
- fflush (stdout);
- fprintf (stderr, "%s\n", exception.message);
- fprintf (stderr, "Exiting\n");
- exit_code = 1;
+ if (exception.reason == RETURN_ERROR)
+ {
+ fflush (stdout);
+ fprintf (stderr, "%s\n", exception.message);
+ fprintf (stderr, "Exiting\n");
+ exit_code = 1;
+ }
+
+ exit (exit_code);
}
+ END_CATCH
- exit (exit_code);
+ gdb_assert_not_reached ("captured_main should never return");
}
/* Skip PACKET until the next semi-colon (or end of string). */
{
struct ui_file *saved_gdb_stderr;
struct type *type = NULL; /* Initialize to keep gcc happy. */
- volatile struct gdb_exception except;
/* Suppress error messages. */
saved_gdb_stderr = gdb_stderr;
gdb_stderr = ui_file_new ();
/* Call parse_and_eval_type() without fear of longjmp()s. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
type = parse_and_eval_type (p, length);
}
- if (except.reason < 0)
- type = builtin_type (gdbarch)->builtin_void;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ type = builtin_type (gdbarch)->builtin_void;
+ }
+ END_CATCH
/* Stop suppressing error messages. */
ui_file_delete (gdb_stderr);
int
types_deeply_equal (struct type *type1, struct type *type2)
{
- volatile struct gdb_exception except;
int result = 0;
struct bcache *cache;
VEC (type_equality_entry_d) *worklist = NULL;
entry.type2 = type2;
VEC_safe_push (type_equality_entry_d, worklist, &entry);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = check_types_worklist (&worklist, cache);
}
bcache_xfree (cache);
VEC_free (type_equality_entry_d, worklist);
/* Rethrow if there was a problem. */
- if (except.reason < 0)
- throw_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ throw_exception (except);
+ }
+ END_CATCH
return result;
}
{
/* Initialize it just to avoid a GCC false warning. */
CORE_ADDR addr = 0;
+ int got_error = 0;
struct value *vfn;
- volatile struct gdb_exception ex;
printf_filtered ("[%d]: ", i);
if (gdbarch_vtable_function_descriptors (gdbarch))
vfn = value_addr (vfn);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
addr = value_as_address (vfn);
}
- if (ex.reason < 0)
- printf_filtered (_("<error: %s>"), ex.message);
- else
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ printf_filtered (_("<error: %s>"), ex.message);
+ got_error = 1;
+ }
+ END_CATCH
+
+ if (!got_error)
print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);
printf_filtered ("\n");
}
{
int from_tty_arg_pos = -1, to_string_arg_pos = -1;
int from_tty = 0, to_string = 0;
- volatile struct gdb_exception except;
const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F };
char *command;
char *result = NULL;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt",
command_scm, &command, rest,
executed. */
cleanups = make_cleanup (xfree, command);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *inner_cleanups;
do_cleanups (inner_cleanups);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
CORE_ADDR pc;
const struct block *block = NULL;
struct compunit_symtab *cust = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
block = block_for_pc (pc);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
{
{
breakpoint_smob *bp_smob
= bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
/* We only support registering breakpoints created with make-breakpoint. */
if (!bp_smob->is_scheme_bkpt)
pending_breakpoint_scm = self;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
char *location = bp_smob->spec.location;
int internal = bp_smob->spec.is_internal;
gdb_assert_not_reached ("invalid breakpoint type");
}
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
/* Ensure this gets reset, even if there's an error. */
pending_breakpoint_scm = SCM_BOOL_F;
GDBSCM_HANDLE_GDB_EXCEPTION (except);
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
delete_breakpoint (bp_smob->bp);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (gdbscm_is_true (newvalue))
enable_breakpoint (bp_smob->bp);
else
disable_breakpoint (bp_smob->bp);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
long value;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
if (value < 0)
value = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_ignore_count (bp_smob->number, (int) value, 0);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
long id;
int valid_id = 0;
- volatile struct gdb_exception except;
if (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX))
{
id = scm_to_long (newvalue);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
valid_id = valid_task_id (id);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (! valid_id)
{
else
SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
breakpoint_set_task (bp_smob->bp, id);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *exp;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
newvalue, SCM_ARG2, FUNC_NAME,
else
exp = gdbscm_scm_to_c_string (newvalue);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_breakpoint_condition (bp_smob->bp, exp ? exp : "", 0);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
xfree (exp);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct breakpoint *bp;
long length;
- volatile struct gdb_exception except;
struct ui_file *string_file;
struct cleanup *chain;
SCM result;
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);
gdbscm_throw_gdb_exception (except);
}
+ END_CATCH
cmdstr = ui_file_xstrdup (string_file, &length);
make_cleanup (xfree, cmdstr);
char *cmd_name, *pfx_name;
struct cmd_list_element **cmd_list;
struct cmd_list_element *cmd = NULL;
- volatile struct gdb_exception except;
if (cmdscm_is_valid (c_smob))
scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (c_smob->is_prefix)
{
NULL, c_smob->doc, cmd_list);
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Note: At this point the command exists in gdb.
So no more errors after this point. */
char *as = NULL;
struct ui_file *memfile = mem_fileopen ();
struct cleanup *cleanups = make_cleanup_ui_file_delete (memfile);
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (using_port)
{
else
insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
as = ui_file_xstrdup (memfile, NULL);
SCM f_scm;
htab_t htab;
eqable_gdb_smob **slot;
- volatile struct gdb_exception except;
struct frame_id frame_id = null_frame_id;
struct gdbarch *gdbarch = NULL;
int frame_id_is_next = 0;
if (*slot != NULL)
return (*slot)->containing_scm;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Try to get the previous frame, to determine if this is the last frame
in a corrupt stack. If so, we need to store the frame_id of the next
}
gdbarch = get_frame_arch (frame);
}
- if (except.reason < 0)
- return gdbscm_scm_from_gdb_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ return gdbscm_scm_from_gdb_exception (except);
+ }
+ END_CATCH
f_scm = frscm_make_frame_smob ();
f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (frame != NULL);
}
enum language lang = language_minimal;
struct frame_info *frame = NULL;
SCM result;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
find_frame_funname (frame, &name, &lang, NULL);
}
- if (except.reason < 0)
- xfree (name);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
+ xfree (name);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
if (frame == NULL)
frame_smob *f_smob;
enum frame_type type = NORMAL_FRAME;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
type = get_frame_type (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
enum unwind_stop_reason stop_reason;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
CORE_ADDR pc = 0;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
pc = get_frame_pc (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
const struct block *block = NULL, *fn_block;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
block = get_frame_block (frame, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
struct symbol *sym = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
sym = find_pc_function (get_frame_address_in_block (frame));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
struct frame_info *prev = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
prev = get_prev_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
struct frame_info *next = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
next = get_next_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
frame_smob *f_smob;
struct symtab_and_line sal;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
find_frame_sal (frame, &sal);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
struct frame_info *frame = NULL;
struct symbol *var = NULL;
struct value *value = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
char *var_name;
const struct block *block = NULL;
struct cleanup *cleanup;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
if (! SCM_UNBNDP (block_scm))
{
/* N.B. Between here and the call to do_cleanups, don't do anything
to cause a Scheme exception without performing the cleanup. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (block == NULL)
block = get_frame_block (frame, NULL);
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
}
- if (except.reason < 0)
- do_cleanups (cleanup);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
+ do_cleanups (cleanup);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
if (var == NULL)
_("gdb:symbol or string"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = read_var_value (var, frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
select_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
gdbscm_newest_frame (void)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_current_frame ();
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
gdbscm_selected_frame (void)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_selected_frame (_("No frame is currently selected"));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
SCM ls_scm = lsscm_get_lazy_string_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (ls_scm);
struct value *value = NULL;
- volatile struct gdb_exception except;
if (ls_smob->address == 0)
{
_("cannot create a value from NULL")));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_at_lazy (ls_smob->type, ls_smob->address);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
{
lazy_string_smob *ls_smob;
struct value *value = NULL;
- volatile struct gdb_exception except;
gdb_assert (lsscm_is_lazy_string (string));
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_at_lazy (ls_smob->type, ls_smob->address);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
*except_scmp = gdbscm_scm_from_gdb_exception (except);
return NULL;
}
+ END_CATCH
return value;
}
struct value *res_val = NULL;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (opcode)
{
gdb_assert_not_reached ("unsupported operation");
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
struct value *res_val = NULL;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (opcode)
{
gdb_assert_not_reached ("unsupported operation");
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
int result = 0;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (op)
{
gdb_assert_not_reached ("invalid <gdb:value> comparison");
}
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
{
struct value *value = NULL;
SCM except_scm = SCM_BOOL_F;
- volatile struct gdb_exception except;
if (type == NULL)
{
*except_scmp = SCM_BOOL_F;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (vlscm_is_value (obj))
{
value = NULL;
}
}
- if (except.reason < 0)
- except_scm = gdbscm_scm_from_gdb_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ except_scm = gdbscm_scm_from_gdb_exception (except);
+ }
+ END_CATCH
if (gdbscm_is_true (except_scm))
{
= pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *cmd_name;
struct cmd_list_element **set_list, **show_list;
- volatile struct gdb_exception except;
if (pascm_is_valid (p_smob))
scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
_("parameter exists, \"show\" command is already defined"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
p_smob->cmd_name, p_smob,
set_list, show_list,
&p_smob->set_command, &p_smob->show_command);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Note: At this point the parameter exists in gdb.
So no more errors after this point. */
const char *arg;
char *newarg;
int found = -1;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
if (name == NULL)
gdbscm_throw (except_scm);
newarg = concat ("show ", name, (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 (name);
xfree (newarg);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
static void
ioscm_write (SCM port, const void *data, size_t size)
{
- volatile struct gdb_exception except;
/* If we're called on stdin, punt. */
if (scm_is_eq (port, input_port_scm))
return;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (scm_is_eq (port, error_port_scm))
fputsn_filtered (data, size, gdb_stderr);
else
fputsn_filtered (data, size, gdb_stdout);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
}
/* Flush gdb's stdout or stderr. */
struct gdbarch *gdbarch,
const struct language_defn *language)
{
- volatile struct gdb_exception except;
SCM result = SCM_BOOL_F;
*out_value = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
int rc;
pretty_printer_worker_smob *w_smob
(_("invalid result from pretty-printer to-string"), result);
}
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
return result;
}
symbol_smob *s_smob
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct symbol *symbol = s_smob->symbol;
- volatile struct gdb_exception except;
int result = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = symbol_read_needs_frame (symbol);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
frame_smob *f_smob = NULL;
struct frame_info *frame_info = NULL;
struct value *value = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
rest, &frame_pos, &frame_scm);
_("cannot get the value of a typedef"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (f_smob != NULL)
{
value = read_var_value (symbol, frame_info);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
int block_arg_pos = -1, domain_arg_pos = -1;
struct field_of_this_result is_a_field_of_this;
struct symbol *symbol = NULL;
- volatile struct gdb_exception except;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
name_scm, &name, rest,
{
struct frame_info *selected_frame;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
selected_frame = get_selected_frame (_("no frame selected"));
block = get_frame_block (selected_frame, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
int domain_arg_pos = -1;
int domain = VAR_DOMAIN;
struct symbol *symbol = NULL;
- volatile struct gdb_exception except;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
name_scm, &name, rest,
cleanups = make_cleanup (xfree, name);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_global_symbol (name, NULL, domain);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
{
ULONGEST pc_ull;
struct symtab_and_line sal;
- volatile struct gdb_exception except;
init_sal (&sal); /* -Wall */
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CORE_ADDR pc = (CORE_ADDR) pc_ull;
sal = find_pc_line (pc, 0);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return stscm_scm_from_sal (sal);
}
tyscm_type_name (struct type *type, SCM *excp)
{
char *name = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *old_chain;
struct ui_file *stb;
name = ui_file_xstrdup (stb, NULL);
do_cleanups (old_chain);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
*excp = gdbscm_scm_from_gdb_exception (except);
return NULL;
}
+ END_CATCH
return name;
}
type_smob *type1_smob, *type2_smob;
struct type *type1, *type2;
int result = 0;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (tyscm_is_type (type1_scm), type1_scm, SCM_ARG1, FUNC_NAME,
type_smob_name);
type1 = type1_smob->type;
type2 = type2_smob->type;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = types_deeply_equal (type1, type2);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
check_typedef (type);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
/* Ignore exceptions. */
return scm_from_long (TYPE_LENGTH (type));
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
static struct type *
tyscm_get_composite (struct type *type)
{
- volatile struct gdb_exception except;
for (;;)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
struct type *type = t_smob->type;
long n1, n2 = 0;
struct type *array = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l",
n1_scm, &n1, n2_scm, &n2);
_("Array length must not be negative"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
array = lookup_array_range_type (type, n1, n2);
if (is_vector)
make_vector_type (array);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (array);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_pointer_type (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_reference_type (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (1, 0, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 1, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 0, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
tyscm_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (startswith (type_name, "struct "))
type = lookup_struct (type_name + 7, NULL);
type = lookup_typename (current_language, get_current_arch (),
type_name, block, 0);
}
- if (except.reason < 0)
- return NULL;
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ return NULL;
+ }
+ END_CATCH
return type;
}
value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
char *s = NULL;
struct value_print_options opts;
- volatile struct gdb_exception except;
if (pstate->writingp)
gdbscm_printf (port, "#<%s ", value_smob_name);
instead of writingp. */
opts.raw = !!pstate->writingp;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
do_cleanups (old_chain);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (s != NULL)
{
const value_smob *v1_smob = (value_smob *) SCM_SMOB_DATA (v1);
const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
int result = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = value_equal (v1_smob->value, v2_smob->value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
struct value *value = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME);
type = tyscm_type_smob_type (t_smob);
/* There's no (current) need to wrap this in a TRY_CATCH, but for consistency
and future-proofing we do. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_from_contents_and_address (type, NULL, address);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (value);
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_optimized_out (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (opt);
}
struct cleanup *cleanup
= make_cleanup_value_free_to_mark (value_mark ());
SCM address;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = value_addr (value);
}
- if (except.reason < 0)
- address = SCM_BOOL_F;
- else
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ address = SCM_BOOL_F;
+ }
+ END_CATCH
+
+ if (res_val != NULL)
address = vlscm_scm_from_value (res_val);
do_cleanups (cleanup);
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = value_ind (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (res_val);
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (TYPE_CODE (check_typedef (value_type (value))))
{
" neither a pointer nor a reference"));
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (res_val);
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
struct type *type = NULL;
- volatile struct gdb_exception except;
if (! SCM_UNBNDP (v_smob->type))
return v_smob->dynamic_type;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup
= make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (cleanup);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (type == NULL)
v_smob->dynamic_type = gdbscm_value_type (self);
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (op == UNOP_DYNAMIC_CAST)
res_val = value_dynamic_cast (type, value);
res_val = value_cast (type, value);
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
struct value *res_val = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
_("string"));
field = gdbscm_scm_to_c_string (field_scm);
make_cleanup (xfree, field);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = value;
res_val = value_struct_elt (&tmp, NULL, field, NULL, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
struct gdbarch *gdbarch;
SCM result, except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = value;
res_val = value_subscript (tmp, value_as_long (index));
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
long args_count;
struct value **vargs = NULL;
SCM result = SCM_BOOL_F;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ftype = check_typedef (value_type (function));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
gdb_assert (gdbscm_is_true (scm_null_p (args)));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
struct value *return_value;
result = vlscm_scm_from_value (return_value);
do_cleanups (cleanup);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (gdbscm_is_exception (result))
gdbscm_throw (result);
size_t length = 0;
const gdb_byte *contents = NULL;
SCM bv;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
length = TYPE_LENGTH (type);
contents = value_contents (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
bv = scm_c_make_bytevector (length);
memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
struct value *value = v_smob->value;
struct type *type;
LONGEST l = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (l != 0);
}
struct value *value = v_smob->value;
struct type *type;
LONGEST l = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_UNSIGNED (type))
return gdbscm_scm_from_ulongest (l);
struct value *value = v_smob->value;
struct type *type;
DOUBLEST d = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
self, SCM_ARG1, FUNC_NAME, _("number"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
d = value_as_double (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* TODO: Is there a better way to check if the value fits? */
if (d != (double) d)
struct type *char_type = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
/* We don't assume anything about the result of scm_port_conversion_strategy.
From this point on, if errors is not 'errors, use 'substitute. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
/* If errors is "error" scm_from_stringn may throw a Scheme exception.
Make sure we don't leak. This is done via scm_dynwind_begin, et.al. */
int length = -1;
SCM result = SCM_BOOL_F; /* -Wall */
struct cleanup *cleanups;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
cleanups = make_cleanup (xfree, encoding);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *inner_cleanup
= make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (inner_cleanup);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (value_lazy (value))
value_fetch_lazy (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
struct value_print_options opts;
char *s = NULL;
SCM result;
- volatile struct gdb_exception except;
get_user_print_options (&opts);
opts.deref_ref = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
do_cleanups (old_chain);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Use SCM_FAILED_CONVERSION_QUESTION_MARK to ensure this doesn't
throw an error if the encoding fails.
struct value *res_val = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
cleanups = make_cleanup_value_free_to_mark (value_mark ());
make_cleanup (xfree, expr_str);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = parse_and_eval (expr_str);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
{
int i;
struct value *res_val = NULL; /* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = access_value_history (i);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (res_val);
}
int res_index = -1;
struct value *v;
value_smob *v_smob;
- volatile struct gdb_exception except;
v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
v = v_smob->value;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_index = record_latest_value (v);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_int (res_index);
}
static struct i386_frame_cache *
i386_frame_cache (struct frame_info *this_frame, void **this_cache)
{
- volatile struct gdb_exception ex;
struct i386_frame_cache *cache;
if (*this_cache)
cache = i386_alloc_frame_cache ();
*this_cache = cache;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
i386_frame_cache_1 (this_frame, cache);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return cache;
}
static struct i386_frame_cache *
i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
{
- volatile struct gdb_exception ex;
struct i386_frame_cache *cache;
CORE_ADDR sp;
cache = i386_alloc_frame_cache ();
*this_cache = cache;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
cache->pc = get_frame_func (this_frame);
cache->base_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return cache;
}
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- volatile struct gdb_exception ex;
struct i386_frame_cache *cache;
CORE_ADDR addr;
gdb_byte buf[4];
cache = i386_alloc_frame_cache ();
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
cache->base_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
*this_cache = cache;
return cache;
error status. If an error occurs while getting an event from
the target, just cancel the current command. */
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
fetch_inferior_event (client_data);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
bpstat_clear_actions ();
do_all_intermediate_continuations (1);
throw_exception (ex);
}
+ END_CATCH
}
break;
are only run when the command list is all done. */
if (interpreter_async)
{
- volatile struct gdb_exception e;
check_frame_language_change ();
/* Don't propagate breakpoint commands errors. Either we're
stopping or some command resumes the inferior. The user will
be informed. */
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
bpstat_do_actions ();
}
- exception_print (gdb_stderr, e);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, e);
+ }
+ END_CATCH
}
break;
static struct gdb_exception
run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
{
- volatile struct gdb_exception e;
+ struct gdb_exception caught_error = exception_none;
int saved_in_infcall = call_thread->control.in_infcall;
ptid_t call_thread_ptid = call_thread->ptid;
int saved_sync_execution = sync_execution;
/* We want stop_registers, please... */
call_thread->control.proceed_to_finish = 1;
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int was_sync = sync_execution;
async_disable_stdin ();
}
}
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ caught_error = e;
+ }
+ END_CATCH
/* At this point the current thread may have changed. Refresh
CALL_THREAD as it could be invalid if its thread has exited. */
If all error()s out of proceed ended up calling normal_stop
(and perhaps they should; it already does in the special case
of error out of resume()), then we wouldn't need this. */
- if (e.reason < 0)
+ if (caught_error.reason < 0)
{
if (call_thread != NULL)
breakpoint_auto_delete (call_thread->control.stop_bpstat);
sync_execution = saved_sync_execution;
- return e;
+ return caught_error;
}
/* A cleanup function that calls delete_std_terminate_breakpoint. */
void
post_create_inferior (struct target_ops *target, int from_tty)
{
- volatile struct gdb_exception ex;
/* Be sure we own the terminal in case write operations are performed. */
target_terminal_ours ();
if the PC is unavailable (e.g., we're opening a core file with
missing registers info), ignore it. */
stop_pc = 0;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
stop_pc = regcache_read_pc (get_current_regcache ());
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
if (exec_bfd)
{
if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
{
- volatile struct gdb_exception ex;
struct value *func;
func = read_var_value (a->function, get_current_frame ());
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
/* print_return_value can throw an exception in some
circumstances. We need to catch this so that we still
delete the breakpoint. */
print_return_value (func, value_type);
}
- if (ex.reason < 0)
- exception_print (gdb_stdout, ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stdout, ex);
+ }
+ END_CATCH
}
}
struct frame_info *frame,
struct symbol *sym)
{
- volatile struct gdb_exception e;
-
- /* We want to ignore errors here. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
struct symbol *vsym;
struct value *value;
inferior_thread ()->control.exception_resume_breakpoint = bp;
}
}
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ /* We want to ignore errors here. */
+ }
+ END_CATCH
}
/* A helper for check_exception_resume that sets an
check_exception_resume (struct execution_control_state *ecs,
struct frame_info *frame)
{
- volatile struct gdb_exception e;
struct bound_probe probe;
struct symbol *func;
if (!func)
return;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
const struct block *b;
struct block_iterator iter;
}
}
}
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
static void
}
else
{
- volatile struct gdb_exception e;
struct regcache *regcache = get_current_regcache ();
int remove_bp;
int remove_wps;
clear_step_over_info ();
/* Stop stepping if inserting breakpoints fails. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
insert_breakpoints ();
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
exception_print (gdb_stderr, e);
stop_waiting (ecs);
return;
}
+ END_CATCH
ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
int status;
jit_dbg_reader_data priv_data;
struct gdb_reader_funcs *funcs;
- volatile struct gdb_exception e;
struct gdb_symbol_callbacks callbacks =
{
jit_object_open_impl,
gdb_mem = xmalloc (code_entry->symfile_size);
status = 1;
- TRY_CATCH (e, RETURN_MASK_ALL)
- if (target_read_memory (code_entry->symfile_addr, gdb_mem,
- code_entry->symfile_size))
+ TRY
+ {
+ if (target_read_memory (code_entry->symfile_addr, gdb_mem,
+ code_entry->symfile_size))
+ status = 0;
+ }
+ CATCH (e, RETURN_MASK_ALL)
+ {
status = 0;
- if (e.reason < 0)
- status = 0;
+ }
+ END_CATCH
if (status)
{
if (token.type == LSTOKEN_COLON)
{
char *user_filename;
- volatile struct gdb_exception ex;
/* Get the current token again and extract the filename. */
token = linespec_lexer_lex_one (parser);
user_filename = copy_token_string (token);
/* Check if the input is a filename. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
PARSER_RESULT (parser)->file_symtabs
= symtabs_from_filename (user_filename);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
file_exception = ex;
}
+ END_CATCH
if (file_exception.reason >= 0)
{
struct cleanup *cleanup;
char *canon;
const char *lookup_name;
- volatile struct gdb_exception except;
cleanup = demangle_for_lookup (name, state->language->la_language,
&lookup_name);
if (!VEC_empty (symbolp, classes))
{
/* Now locate a list of suitable methods named METHOD. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
find_method (state, file_symtabs, klass, method, classes,
symbols, minsyms);
/* If successful, we're done. If NOT_FOUND_ERROR
was not thrown, rethrow the exception that we did get. */
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error != NOT_FOUND_ERROR)
throw_exception (except);
}
+ END_CATCH
}
}
struct lwp_info *lp;
int status;
ptid_t ptid;
- volatile struct gdb_exception ex;
/* Make sure we report all signals during attach. */
linux_nat_pass_signals (ops, 0, NULL);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
linux_ops->to_attach (ops, args, from_tty);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
pid_t pid = parse_pid_to_attach (args);
struct buffer buffer;
else
throw_error (ex.error, "%s", message);
}
+ END_CATCH
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
char *note_data = NULL;
gdb_byte *auxv;
int auxv_len;
- volatile struct gdb_exception e;
if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
return NULL;
}
/* Thread register information. */
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
update_thread_list ();
}
- if (e.reason < 0)
- exception_print (gdb_stderr, e);
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, e);
+ }
+ END_CATCH
+
thread_args.gdbarch = gdbarch;
thread_args.pid = ptid_get_pid (inferior_ptid);
thread_args.obfd = obfd;
static int
thread_db_find_new_threads_silently (ptid_t ptid)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
thread_db_find_new_threads_2 (ptid, 1);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (libthread_db_debug)
exception_fprintf (gdb_stdlog, except,
return 1;
}
}
+ END_CATCH
+
return 0;
}
find_new_threads_once (struct thread_db_info *info, int iteration,
td_err_e *errp)
{
- volatile struct gdb_exception except;
struct callback_data data;
td_err_e err = TD_ERR;
/* See comment in thread_db_update_thread_list. */
gdb_assert (!target_has_execution || thread_db_use_events ());
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
/* Iterate over all user-space threads to discover new threads. */
err = info->td_ta_thr_iter_p (info->thread_agent,
if (libthread_db_debug)
{
- if (except.reason < 0)
- exception_fprintf (gdb_stdlog, except,
- "Warning: find_new_threads_once: ");
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stdlog, except,
+ "Warning: find_new_threads_once: ");
+ }
+ END_CATCH
fprintf_unfiltered (gdb_stdlog,
_("Found %d new threads in iteration %d.\n"),
catch_command_errors (catch_command_errors_ftype *command,
char *arg, int from_tty)
{
- volatile struct gdb_exception e;
-
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int was_sync = sync_execution;
maybe_wait_sync_command_done (was_sync);
}
- return handle_command_errors (e);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ return handle_command_errors (e);
+ }
+ END_CATCH
+
+ return 1;
}
/* Type of the command callback passed to catch_command_errors_const. */
catch_command_errors_const (catch_command_errors_const_ftype *command,
const char *arg, int from_tty)
{
- volatile struct gdb_exception e;
-
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
int was_sync = sync_execution;
maybe_wait_sync_command_done (was_sync);
}
- return handle_command_errors (e);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ return handle_command_errors (e);
+ }
+ END_CATCH
+
+ return 1;
}
/* Type of this option. */
if (arg->val || arg->error)
{
- volatile struct gdb_exception except;
+ const char *error_message = NULL;
if (arg->error)
- except.message = arg->error;
+ error_message = arg->error;
else
{
- /* TRY_CATCH has two statements, wrap it in a block. */
-
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
struct value_print_options opts;
common_val_print (arg->val, stb, 0, &opts,
language_def (SYMBOL_LANGUAGE (arg->sym)));
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ error_message = except.message;
+ }
+ END_CATCH
}
- if (except.message)
+ if (error_message != NULL)
fprintf_filtered (stb, _("<error reading variable: %s>"),
- except.message);
+ error_message);
ui_out_field_stream (uiout, "value", stb);
}
{
struct mi_interp *mi = top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
- volatile struct gdb_exception e;
if (mi_suppress_notification.breakpoint)
return;
breakpoint_created notifications. So, we use
ui_out_redirect. */
ui_out_redirect (mi_uiout, mi->event_channel);
- TRY_CATCH (e, RETURN_MASK_ERROR)
- gdb_breakpoint_query (mi_uiout, b->number, NULL);
+ TRY
+ {
+ gdb_breakpoint_query (mi_uiout, b->number, NULL);
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
+
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
{
struct mi_interp *mi = top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
- volatile struct gdb_exception e;
if (mi_suppress_notification.breakpoint)
return;
breakpoint_created notifications. So, we use
ui_out_redirect. */
ui_out_redirect (mi_uiout, mi->event_channel);
- TRY_CATCH (e, RETURN_MASK_ERROR)
- gdb_breakpoint_query (mi_uiout, b->number, NULL);
+ TRY
+ {
+ gdb_breakpoint_query (mi_uiout, b->number, NULL);
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
+
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
{
char *token;
struct mi_parse *command = NULL;
- volatile struct gdb_exception exception;
/* This is to handle EOF (^D). We just quit gdb. */
/* FIXME: we should call some API function here. */
target_log_command (cmd);
- TRY_CATCH (exception, RETURN_MASK_ALL)
+ TRY
{
command = mi_parse (cmd, &token);
}
- if (exception.reason < 0)
+ CATCH (exception, RETURN_MASK_ALL)
{
mi_print_exception (token, exception);
xfree (token);
}
- else
+ END_CATCH
+
+ if (command != NULL)
{
- volatile struct gdb_exception result;
ptid_t previous_ptid = inferior_ptid;
command->token = token;
timestamp (command->cmd_start);
}
- TRY_CATCH (result, RETURN_MASK_ALL)
+ TRY
{
captured_mi_execute_command (current_uiout, command);
}
- if (result.reason < 0)
+ CATCH (result, RETURN_MASK_ALL)
{
/* The command execution failed and error() was called
somewhere. */
mi_print_exception (command->token, result);
mi_out_rewind (current_uiout);
}
+ END_CATCH
bpstat_do_actions ();
const char *basename = type_name_no_tag (baseclass);
const gdb_byte *base_valaddr = NULL;
int thisoffset;
- volatile struct gdb_exception ex;
int skip = 0;
if (BASETYPE_VIA_VIRTUAL (type, i))
thisoffset = offset;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
skip = -1;
else
skip = 1;
}
+ END_CATCH
if (skip == 0)
{
const struct block *block,
int comma, int void_context_p, int *out_subexp)
{
- volatile struct gdb_exception except;
struct cleanup *old_chain, *inner_chain;
const struct language_defn *lang = NULL;
struct parser_state ps;
inner_chain = make_cleanup_restore_current_language ();
set_language (lang->la_language);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (lang->la_parser (&ps))
lang->la_error (NULL);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
if (! parse_completion)
{
throw_exception (except);
}
}
+ END_CATCH
reallocate_expout (&ps);
struct expression *exp = NULL;
struct value *val;
int subexp;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
parse_completion = 1;
exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
/* Nothing, EXP remains NULL. */
}
+ END_CATCH
parse_completion = 0;
if (exp == NULL)
if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
{
struct target_ops *target = ¤t_target;
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
/* We do not call target_translate_tls_address here, because
svr4_fetch_objfile_link_map may invalidate the frame chain,
spe_context_cache_ptid = inferior_ptid;
}
- if (ex.reason < 0)
- return 0;
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ return 0;
+ }
+ END_CATCH
}
/* Read variable value. */
if (d->exp == NULL)
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
innermost_block = NULL;
d->exp = parse_expression (d->exp_string);
d->block = innermost_block;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Can't re-parse the expression. Disable this display item. */
d->enabled_p = 0;
d->exp_string, ex.message);
return;
}
+ END_CATCH
}
if (d->block)
printf_filtered (": ");
if (d->format.size)
{
- volatile struct gdb_exception ex;
annotate_display_format ();
annotate_display_value ();
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
struct value *val;
CORE_ADDR addr;
addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
do_examine (d->format, d->exp->gdbarch, addr);
}
- if (ex.reason < 0)
- fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+ }
+ END_CATCH
}
else
{
struct value_print_options opts;
- volatile struct gdb_exception ex;
annotate_display_format ();
get_formatted_print_options (&opts, d->format.format);
opts.raw = d->format.raw;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
struct value *val;
val = evaluate_expression (d->exp);
print_formatted (val, d->format.size, &opts, gdb_stdout);
}
- if (ex.reason < 0)
- fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ }
+ END_CATCH
+
printf_filtered ("\n");
}
struct frame_info *frame,
struct ui_file *stream, int indent)
{
- volatile struct gdb_exception except;
if (!name)
name = SYMBOL_PRINT_NAME (var);
fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
struct value *val;
struct value_print_options opts;
function. */
frame = NULL;
}
- if (except.reason < 0)
- fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
- except.message);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
+ except.message);
+ }
+ END_CATCH
+
fprintf_filtered (stream, "\n");
}
char *as = NULL;
struct ui_file *memfile = mem_fileopen ();
PyObject *insn_dict = PyDict_New ();
- volatile struct gdb_exception except;
if (insn_dict == NULL)
{
return NULL; /* PyList_Append Sets the exception. */
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
Py_DECREF (result_list);
ui_file_delete (memfile);
gdbpy_convert_exception (except);
return NULL;
}
+ END_CATCH
as = ui_file_xstrdup (memfile, NULL);
if (PyDict_SetItemString (insn_dict, "addr",
gdb_py_ulongest pc;
const struct block *block = NULL;
struct compunit_symtab *cust = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
block = block_for_pc (pc);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
{
{
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
int cmp;
- volatile struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp);
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;
}
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 (! 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)
{
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;
}
{
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
long value;
- volatile struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp);
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;
}
{
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);
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);
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;
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);
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,
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);
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;
int cmdtype;
int completetype = -1;
char *docstring = NULL;
- volatile struct gdb_exception except;
struct cmd_list_element **cmd_list;
char *cmd_name, *pfx_name;
static char *keywords[] = { "name", "command_class", "completer_class",
Py_INCREF (self);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cmd_list_element *cmd;
set_cmd_completer_handle_brkchars (cmd,
cmdpy_completer_handle_brkchars);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (cmd_name);
xfree (docstring);
"%s", except.message);
return -1;
}
+ END_CATCH
+
return 0;
}
{
struct finish_breakpoint_object *self_finishbp =
(struct finish_breakpoint_object *) bp_obj;
- volatile struct gdb_exception except;
/* Can compute return_value only once. */
gdb_assert (!self_finishbp->return_value);
if (!self_finishbp->return_type)
return;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *function =
value_object_to_value (self_finishbp->function_value);
self_finishbp->return_value = Py_None;
}
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
+ END_CATCH
}
/* Triggered when gdbpy_should_stop has triggered the `stop' callback
void
bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Can't delete it here, but it will be removed at the next stop. */
disable_breakpoint (bp_obj->bp);
gdb_assert (bp_obj->bp->disposition == disp_del);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
+ END_CATCH
}
/* Python function to create a new breakpoint. */
PyObject *internal = NULL;
int internal_bp = 0;
CORE_ADDR finish_pc, pc;
- volatile struct gdb_exception except;
char *addr_str, small_buf[100];
struct symbol *function;
&frame_obj, &internal))
return -1;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Default frame to newest frame if necessary. */
if (frame_obj == NULL)
}
}
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
return -1;
}
- else if (PyErr_Occurred ())
+ END_CATCH
+
+ if (PyErr_Occurred ())
return -1;
thread = pid_to_thread_id (inferior_ptid);
self_bpfinish->return_type = NULL;
self_bpfinish->function_value = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (get_frame_pc_if_available (frame, &pc))
{
}
}
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
/* Just swallow. Either the return type or the function value
remain NULL. */
}
+ END_CATCH
if (self_bpfinish->return_type == NULL || self_bpfinish->function_value == NULL)
{
bppy_pending_object->number = -1;
bppy_pending_object->bp = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Set a breakpoint on the return address. */
finish_pc = get_frame_pc (prev_frame);
&bkpt_breakpoint_ops,
0, 1, internal_bp, 0);
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
self_bpfinish->py_bp.bp->frame_id = frame_id;
self_bpfinish->py_bp.is_finish_bp = 1;
static int
bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
{
- volatile struct gdb_exception except;
struct breakpoint *bp_stopped = (struct breakpoint *) args;
PyObject *py_bp = (PyObject *) b->py_bp_object;
struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
/* Check scope if not currently stopped at the FinishBreakpoint. */
if (b != bp_stopped)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (b->pspace == current_inferior ()->pspace
&& (!target_has_registers
|| frame_find_by_id (b->frame_id) == NULL))
bpfinishpy_out_of_scope (finish_bp);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
+ END_CATCH
}
}
frapy_is_valid (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frame_object_to_frame_info (self);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
Py_RETURN_FALSE;
char *name = NULL;
enum language lang;
PyObject *result;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
find_frame_funname (frame, &name, &lang, NULL);
}
-
- if (except.reason < 0)
- xfree (name);
-
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ xfree (name);
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (name)
{
{
struct frame_info *frame;
enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
type = get_frame_type (frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return PyInt_FromLong (type);
}
{
struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
frame_object *obj = (frame_object *) self;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdbarch_to_arch_object (obj->gdbarch);
}
frapy_unwind_stop_reason (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
enum unwind_stop_reason stop_reason;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
stop_reason = get_frame_unwind_stop_reason (frame);
{
CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
struct frame_info *frame;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
pc = get_frame_pc (frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdb_py_long_from_ulongest (pc);
}
static PyObject *
frapy_read_register (PyObject *self, PyObject *args)
{
- volatile struct gdb_exception except;
const char *regnum_str;
struct value *val = NULL;
if (!PyArg_ParseTuple (args, "s", ®num_str))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct frame_info *frame;
int regnum;
if (val == NULL)
PyErr_SetString (PyExc_ValueError, _("Unknown register."));
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return val == NULL ? NULL : value_to_value_object (val);
}
{
struct frame_info *frame;
const struct block *block = NULL, *fn_block;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
block = get_frame_block (frame, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
for (fn_block = block;
fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
{
struct symbol *sym = NULL;
struct frame_info *frame;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
sym = find_pc_function (get_frame_address_in_block (frame));
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (sym)
return symbol_to_symbol_object (sym);
frame_info_to_frame_object (struct frame_info *frame)
{
frame_object *frame_obj;
- volatile struct gdb_exception except;
frame_obj = PyObject_New (frame_object, &frame_object_type);
if (frame_obj == NULL)
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Try to get the previous frame, to determine if this is the last frame
}
frame_obj->gdbarch = get_frame_arch (frame);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
Py_DECREF (frame_obj);
gdbpy_convert_exception (except);
return NULL;
}
+ END_CATCH
+
return (PyObject *) frame_obj;
}
frapy_older (PyObject *self, PyObject *args)
{
struct frame_info *frame, *prev = NULL;
- volatile struct gdb_exception except;
PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
prev = get_prev_frame (frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (prev)
prev_obj = (PyObject *) frame_info_to_frame_object (prev);
frapy_newer (PyObject *self, PyObject *args)
{
struct frame_info *frame, *next = NULL;
- volatile struct gdb_exception except;
PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
next = get_next_frame (frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (next)
next_obj = (PyObject *) frame_info_to_frame_object (next);
{
struct frame_info *frame;
struct symtab_and_line sal;
- volatile struct gdb_exception except;
PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
find_frame_sal (frame, &sal);
sal_obj = 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 sal_obj;
}
PyObject *sym_obj, *block_obj = NULL;
struct symbol *var = NULL; /* gcc-4.3.2 false warning. */
struct value *val = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, "O|O", &sym_obj, &block_obj))
return NULL;
char *var_name;
const struct block *block = NULL;
struct cleanup *cleanup;
- volatile struct gdb_exception except;
var_name = python_string_to_target_string (sym_obj);
if (!var_name)
}
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
block = get_frame_block (frame, NULL);
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
do_cleanups (cleanup);
gdbpy_convert_exception (except);
return NULL;
}
+ END_CATCH
if (!var)
{
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, frame);
val = read_var_value (var, frame);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (val);
}
frapy_select (PyObject *self, PyObject *args)
{
struct frame_info *fi;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
FRAPY_REQUIRE_VALID (self, fi);
select_frame (fi);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
gdbpy_newest_frame (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_current_frame ();
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return frame_info_to_frame_object (frame);
}
gdbpy_selected_frame (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_selected_frame ("No frame is currently selected.");
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return frame_info_to_frame_object (frame);
}
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);
{
int n;
char *p = NULL, *q;
- volatile struct gdb_exception except;
-
- TRY_CATCH (except, RETURN_MASK_ALL)
- p = command_line_input (prompt, 0, "python");
-
- /* Detect user interrupt (Ctrl-C). */
- if (except.reason == RETURN_QUIT)
- return NULL;
+ TRY
+ {
+ p = command_line_input (prompt, 0, "python");
+ }
/* Handle errors by raising Python exceptions. */
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
+ /* Detect user interrupt (Ctrl-C). */
+ if (except.reason == RETURN_QUIT)
+ return NULL;
+
/* The thread state is nulled during gdbpy_readline_wrapper,
with the original value saved in the following undocumented
variable (see Python's Parser/myreadline.c and
PyEval_SaveThread ();
return NULL;
}
+ END_CATCH
/* Detect EOF (Ctrl-D). */
if (p == NULL)
struct threadlist_entry *entry;
inferior_object *inf_obj = (inferior_object *) self;
PyObject *tuple;
- volatile struct gdb_exception except;
INFPY_REQUIRE_VALID (inf_obj);
- TRY_CATCH (except, RETURN_MASK_ALL)
- update_thread_list ();
- GDB_PY_HANDLE_EXCEPTION (except);
+ TRY
+ {
+ update_thread_list ();
+ }
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
tuple = PyTuple_New (inf_obj->nthreads);
if (!tuple)
void *buffer = NULL;
membuf_object *membuf_obj;
PyObject *addr_obj, *length_obj, *result;
- volatile struct gdb_exception except;
static char *keywords[] = { "address", "length", NULL };
if (! PyArg_ParseTupleAndKeywords (args, kw, "OO", keywords,
|| get_addr_from_python (length_obj, &length) < 0)
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
buffer = xmalloc (length);
read_memory (addr, buffer, length);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (buffer);
GDB_PY_HANDLE_EXCEPTION (except);
}
+ END_CATCH
membuf_obj = PyObject_New (membuf_object, &membuf_object_type);
if (membuf_obj == NULL)
static PyObject *
infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
{
+ struct gdb_exception except = exception_none;
Py_ssize_t buf_len;
const char *buffer;
CORE_ADDR addr, length;
PyObject *addr_obj, *length_obj = NULL;
- volatile struct gdb_exception except;
static char *keywords[] = { "address", "buffer", "length", NULL };
#ifdef IS_PY3K
Py_buffer pybuf;
else if (get_addr_from_python (length_obj, &length) < 0)
goto fail;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
write_memory_with_notification (addr, (gdb_byte *) buffer, length);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
#ifdef IS_PY3K
PyBuffer_Release (&pybuf);
#endif
static PyObject *
infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
{
+ struct gdb_exception except = exception_none;
CORE_ADDR start_addr, length;
static char *keywords[] = { "address", "length", "pattern", NULL };
PyObject *start_addr_obj, *length_obj;
- volatile struct gdb_exception except;
Py_ssize_t pattern_size;
const void *buffer;
CORE_ADDR found_addr;
goto fail;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
found = target_search_memory (start_addr, length,
buffer, pattern_size,
&found_addr);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
#ifdef IS_PY3K
PyBuffer_Release (&pybuf);
#endif
thpy_switch (PyObject *self, PyObject *args)
{
thread_object *thread_obj = (thread_object *) self;
- volatile struct gdb_exception except;
THPY_REQUIRE_VALID (thread_obj);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch_to_thread (thread_obj->thread->ptid);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
{
lazy_string_object *self_string = (lazy_string_object *) self;
struct value *val = NULL;
- volatile struct gdb_exception except;
if (self_string->address == 0)
{
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val = value_at_lazy (self_string->type, self_string->address);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (val);
}
linetable_entry_object *result;
VEC (CORE_ADDR) *pcs = NULL;
PyObject *tuple;
- volatile struct gdb_exception except;
LTPY_REQUIRE_VALID (self, symtab);
if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
tuple = build_line_table_tuple_from_pcs (py_line, pcs);
VEC_free (CORE_ADDR, pcs);
objfile_object *obj = (objfile_object *) self;
struct objfile *objfile = obj->objfile;
const struct elf_build_id *build_id = NULL;
- volatile struct gdb_exception except;
OBJFPY_REQUIRE_VALID (obj);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
build_id = build_id_bfd_get (objfile->obfd);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (build_id != NULL)
{
objfile_object *obj = (objfile_object *) self;
const char *file_name;
int symfile_flags = 0;
- volatile struct gdb_exception except;
OBJFPY_REQUIRE_VALID (obj);
if (!PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
bfd *abfd = symfile_bfd_open (file_name);
symbol_file_add_separate (abfd, file_name, symfile_flags, obj->objfile);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
int parmclass, cmdtype;
PyObject *enum_values = NULL;
struct cmd_list_element **set_list, **show_list;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass,
&enum_values))
Py_INCREF (self);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
add_setshow_generic (parmclass, (enum command_class) cmdtype,
cmd_name, obj,
set_doc, show_doc,
doc, set_list, show_list);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (cmd_name);
xfree (set_doc);
"%s", except.message);
return -1;
}
+ END_CATCH
+
return 0;
}
static PyObject *
pretty_print_one_value (PyObject *printer, struct value **out_value)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
*out_value = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
if (result)
}
}
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
return result;
}
{
PyObject *val_obj;
PyObject *pretty_printer = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_copy (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
val_obj = value_to_value_object (value);
if (! val_obj)
sympy_needs_frame (PyObject *self, void *closure)
{
struct symbol *symbol = NULL;
- volatile struct gdb_exception except;
int result = 0;
SYMPY_REQUIRE_VALID (self, symbol);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = symbol_read_needs_frame (symbol);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (result)
Py_RETURN_TRUE;
struct frame_info *frame_info = NULL;
PyObject *frame_obj = NULL;
struct value *value = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, "|O", &frame_obj))
return NULL;
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (frame_obj != NULL)
{
value = read_var_value (symbol, frame_info);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (value);
}
struct symbol *symbol = NULL;
PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
const struct block *block = NULL;
- volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
&block_object_type, &block_obj, &domain))
else
{
struct frame_info *selected_frame;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
selected_frame = get_selected_frame (_("No frame selected."));
block = get_frame_block (selected_frame, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
ret_tuple = PyTuple_New (2);
if (!ret_tuple)
static char *keywords[] = { "name", "domain", NULL };
struct symbol *symbol = NULL;
PyObject *sym_obj;
- volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
&domain))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_global_symbol (name, NULL, domain);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (symbol)
{
{
PyObject *py_type = self;
PyObject *result = NULL, *iter = NULL;
- volatile struct gdb_exception except;
struct type *type = ((type_object *) py_type)->type;
struct type *checked_type = type;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (checked_type);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (checked_type != type)
py_type = type_to_type_object (checked_type);
typy_strip_typedefs (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
static struct type *
typy_get_composite (struct type *type)
{
- volatile struct gdb_exception except;
for (;;)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
PyObject *n2_obj = NULL;
struct type *array = NULL;
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "l|O", &n1, &n2_obj))
return NULL;
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
array = lookup_array_range_type (type, n1, n2);
if (is_vector)
make_vector_type (array);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (array);
}
typy_pointer (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_pointer_type (type);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
typy_reference (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_reference_type (type);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
typy_const (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (1, 0, type, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
typy_volatile (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 1, type, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
typy_unqualified (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 0, type, NULL);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type_to_type_object (type);
}
typy_get_sizeof (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
check_typedef (type);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
/* Ignore exceptions. */
return gdb_py_long_from_longest (TYPE_LENGTH (type));
typy_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (startswith (type_name, "struct "))
type = lookup_struct (type_name + 7, NULL);
type = lookup_typename (python_language, python_gdbarch,
type_name, block, 0);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return type;
}
struct type *type, *rtype = NULL;
char *type_name = NULL;
enum demangle_component_type demangled_type;
- volatile struct gdb_exception except;
/* Save the type: typy_lookup_type() may (indirectly) overwrite
memory pointed by demangled. */
if (! type)
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* If the demangled_type matches with one of the types
below, run the corresponding function and save the type
break;
}
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
}
/* If we have a type from the switch statement above, just return
const char *err;
struct type *argtype;
struct cleanup *cleanup;
- volatile struct gdb_exception except;
if (TYPE_NAME (type) == NULL)
{
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Note -- this is not thread-safe. */
info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (! info)
{
PyObject *block_obj = NULL;
struct symbol *sym;
struct value *val = NULL;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "i|O", &argno, &block_obj))
return NULL;
}
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
if (TYPE_CODE (type) == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
/* We might not have DW_TAG_template_*, so try to parse the type's
name. This is inefficient if we do not have a template type --
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val = value_of_variable (sym, block);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (val);
}
static PyObject *
typy_str (PyObject *self)
{
- volatile struct gdb_exception except;
char *thetype = NULL;
long length = 0;
PyObject *result;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *old_chain;
struct ui_file *stb;
thetype = ui_file_xstrdup (stb, &length);
do_cleanups (old_chain);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (thetype);
GDB_PY_HANDLE_EXCEPTION (except);
}
+ END_CATCH
result = PyUnicode_Decode (thetype, length, host_charset (), NULL);
xfree (thetype);
int result = Py_NE;
struct type *type1 = type_object_to_type (self);
struct type *type2 = type_object_to_type (other);
- volatile struct gdb_exception except;
/* We can only compare ourselves to another Type object, and only
for equality or inequality. */
result = Py_EQ;
else
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = types_deeply_equal (type1, type2);
}
- /* If there is a GDB exception, a comparison is not capable
- (or trusted), so exit. */
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ /* If there is a GDB exception, a comparison is not capable
+ (or trusted), so exit. */
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
}
if (op == (result ? Py_EQ : Py_NE))
{
if (gdbpy_is_value_object (obj))
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
*addr = value_as_address (value_object_to_value (obj));
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
}
else
{
static PyObject *
valpy_dereference (PyObject *self, PyObject *args)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
static PyObject *
valpy_referenced_value (PyObject *self, PyObject *args)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *self_val, *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
valpy_get_address (PyObject *self, void *closure)
{
value_object *val_obj = (value_object *) self;
- volatile struct gdb_exception except;
if (!val_obj->address)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *res_val;
struct cleanup *cleanup
val_obj->address = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
val_obj->address = Py_None;
Py_INCREF (Py_None);
}
+ END_CATCH
}
Py_XINCREF (val_obj->address);
valpy_get_dynamic_type (PyObject *self, void *closure)
{
value_object *obj = (value_object *) self;
- volatile struct gdb_exception except;
struct type *type = NULL;
if (obj->dynamic_type != NULL)
return obj->dynamic_type;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *val = obj->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (type == NULL)
obj->dynamic_type = valpy_get_type (self, NULL);
const char *user_encoding = NULL;
static char *keywords[] = { "encoding", "length", NULL };
PyObject *str_obj = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
&user_encoding, &length))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return str_obj;
}
int length = -1;
gdb_byte *buffer;
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
PyObject *unicode;
const char *encoding = NULL;
const char *errors = NULL;
&user_encoding, &errors, &length))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
unicode = PyUnicode_Decode ((const char *) buffer,
{
PyObject *type_obj, *result = NULL;
struct type *type;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "O", &type_obj))
return NULL;
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *val = ((value_object *) self)->value;
struct value *res_val;
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
struct type *parent_type, *val_type;
enum type_code type_code;
PyObject *type_object = PyObject_GetAttrString (field, "parent_type");
- volatile struct gdb_exception except;
int has_field = 0;
if (type_object == NULL)
return -1;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val_type = value_type (v);
val_type = check_typedef (val_type);
else
has_field = 0;
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return has_field;
}
static PyObject *
valpy_getitem (PyObject *self, PyObject *key)
{
+ struct gdb_exception except = exception_none;
value_object *self_value = (value_object *) self;
char *field = NULL;
struct type *base_class_type = NULL, *field_type = NULL;
long bitpos = -1;
- volatile struct gdb_exception except;
PyObject *result = NULL;
if (gdbpy_is_string (key))
}
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = self_value->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
xfree (field);
GDB_PY_HANDLE_EXCEPTION (except);
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
{
Py_ssize_t args_count;
- volatile struct gdb_exception except;
struct value *function = ((value_object *) self)->value;
struct value **vargs = NULL;
struct type *ftype = NULL;
struct value *mark = value_mark ();
PyObject *result = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ftype = check_typedef (value_type (function));
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
{
}
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
struct value *return_value;
result = value_to_value_object (return_value);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
char *s = NULL;
PyObject *result;
struct value_print_options opts;
- volatile struct gdb_exception except;
get_user_print_options (&opts);
opts.deref_ref = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
do_cleanups (old_chain);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
xfree (s);
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_optimized_out (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (opt)
Py_RETURN_TRUE;
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_lazy (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (opt)
Py_RETURN_TRUE;
valpy_fetch_lazy (PyObject *self, PyObject *args)
{
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (value_lazy (value))
value_fetch_lazy (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
static PyObject *
valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *arg1, *arg2;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
static PyObject *
valpy_negative (PyObject *self)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Perhaps overkill, but consistency has some virtue. */
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
result = value_to_value_object (val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
valpy_absolute (PyObject *self)
{
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
int isabs = 1;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (isabs)
return valpy_positive (self);
static int
valpy_nonzero (PyObject *self)
{
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
value_object *self_value = (value_object *) self;
struct type *type;
int nonzero = 0; /* Appease GCC warning. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (value_type (self_value->value));
/* All other values are True. */
nonzero = 1;
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
/* This is not documented in the Python documentation, but if this
function fails, return -1 as slot_nb_nonzero does (the default
Python nonzero function). */
valpy_invert (PyObject *self)
{
struct value *val = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val = value_complement (((value_object *) self)->value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (val);
}
valpy_richcompare (PyObject *self, PyObject *other, int op)
{
int result = 0;
- volatile struct gdb_exception except;
if (other == Py_None)
/* Comparing with None is special. From what I can tell, in Python
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *value_other, *mark = value_mark ();
struct cleanup *cleanup;
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
/* In this case, the Python exception has already been set. */
if (result < 0)
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (!is_integral_type (type))
error (_("Cannot convert value to int."));
l = value_as_long (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdb_py_object_from_longest (l);
}
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
l = value_as_long (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdb_py_long_from_longest (l);
}
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
double d = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
d = value_as_double (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return PyFloat_FromDouble (d);
}
convert_value_from_python (PyObject *obj)
{
struct value *value = NULL; /* -Wall */
- volatile struct gdb_exception except;
int cmp;
gdb_assert (obj != NULL);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (PyBool_Check (obj))
{
PyString_AsString (PyObject_Str (obj)));
#endif
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
PyErr_Format (except.reason == RETURN_QUIT
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
"%s", except.message);
return NULL;
}
+ END_CATCH
return value;
}
{
int i;
struct value *res_val = NULL; /* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, "i", &i))
return NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = access_value_history (i);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (res_val);
}
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);
static void
record_btrace_enable_warn (struct thread_info *tp)
{
- volatile struct gdb_exception error;
-
- TRY_CATCH (error, RETURN_MASK_ERROR)
- btrace_enable (tp, &record_btrace_conf);
-
- if (error.message != NULL)
- warning ("%s", error.message);
+ TRY
+ {
+ btrace_enable (tp, &record_btrace_conf);
+ }
+ CATCH (error, RETURN_MASK_ERROR)
+ {
+ warning ("%s", error.message);
+ }
+ END_CATCH
}
/* Callback function to disable branch tracing for one thread. */
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- volatile struct gdb_exception except;
const char *old;
int ret;
replay_memory_access = replay_memory_access_read_write;
ret = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
- ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ TRY
+ {
+ ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ }
replay_memory_access = old;
- if (except.reason < 0)
- throw_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ throw_exception (except);
+ }
+ END_CATCH
return ret;
}
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- volatile struct gdb_exception except;
const char *old;
int ret;
replay_memory_access = replay_memory_access_read_write;
ret = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
- ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ TRY
+ {
+ ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ }
replay_memory_access = old;
- if (except.reason < 0)
- throw_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ throw_exception (except);
+ }
+ END_CATCH
return ret;
}
static struct btrace_insn_iterator *
record_btrace_start_replaying (struct thread_info *tp)
{
- volatile struct gdb_exception except;
struct btrace_insn_iterator *replay;
struct btrace_thread_info *btinfo;
int executing;
Since frames are computed differently when we're replaying, we need to
recompute those stored frames and fix them up so we can still detect
subroutines after we started replaying. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct frame_info *frame;
struct frame_id frame_id;
/* Restore the previous execution state. */
set_executing (tp->ptid, executing);
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
xfree (btinfo->replay);
btinfo->replay = NULL;
throw_exception (except);
}
+ END_CATCH
return replay;
}
static void
cmd_record_btrace_bts_start (char *args, int from_tty)
{
- volatile struct gdb_exception exception;
if (args != NULL && *args != 0)
error (_("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_BTS;
- TRY_CATCH (exception, RETURN_MASK_ALL)
- execute_command ("target record-btrace", from_tty);
-
- if (exception.error != 0)
+ TRY
+ {
+ execute_command ("target record-btrace", from_tty);
+ }
+ CATCH (exception, RETURN_MASK_ALL)
{
record_btrace_conf.format = BTRACE_FORMAT_NONE;
throw_exception (exception);
}
+ END_CATCH
}
/* Alias for "target record". */
static void
cmd_record_btrace_start (char *args, int from_tty)
{
- volatile struct gdb_exception exception;
if (args != NULL && *args != 0)
error (_("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_BTS;
- TRY_CATCH (exception, RETURN_MASK_ALL)
- execute_command ("target record-btrace", from_tty);
-
- if (exception.error == 0)
- return;
-
- record_btrace_conf.format = BTRACE_FORMAT_NONE;
- throw_exception (exception);
+ TRY
+ {
+ execute_command ("target record-btrace", from_tty);
+ }
+ CATCH (exception, RETURN_MASK_ALL)
+ {
+ record_btrace_conf.format = BTRACE_FORMAT_NONE;
+ throw_exception (exception);
+ }
+ END_CATCH
}
/* The "set record btrace" command. */
CORE_ADDR from, to, org_to;
char *p, *pp;
int adjusted_size = 0;
- volatile struct gdb_exception ex;
int relocated = 0;
p = buf + strlen ("qRelocInsn:");
org_to = to;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
gdbarch_relocate_instruction (target_gdbarch (), &to, from);
relocated = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
if (ex.error == MEMORY_ERROR)
{
}
putpkt ("E01");
}
+ END_CATCH
if (relocated)
{
all the ``target ....'' commands to share a common callback
function. See cli-dump.c. */
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
remote_start_remote (from_tty, target, extended_p);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Pop the partially set up target - unless something else did
already before throwing the exception. */
wait_forever_enabled_p = 1;
throw_exception (ex);
}
+ END_CATCH
}
remote_btrace_reset ();
static void
remote_kill (struct target_ops *ops)
{
- volatile struct gdb_exception ex;
/* Catch errors so the user can quit from gdb even when we
aren't on speaking terms with the remote system. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
putpkt ("k");
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == TARGET_CLOSE_ERROR)
{
user or higher layers decide what to do. */
throw_exception (ex);
}
+ END_CATCH
/* We've killed the remote end, we get to mourn it. Since this is
target remote, single-process, mourning the inferior also
char *p = NULL;
/* FIXME we need to get register block size some other way. */
extern int trace_regblock_size;
- volatile struct gdb_exception ex;
enum packet_result result;
if (packet_support (PACKET_qTStatus) == PACKET_DISABLE)
putpkt ("qTStatus");
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
p = remote_get_noisy_reply (&target_buf, &target_buf_size);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != TARGET_CLOSE_ERROR)
{
}
throw_exception (ex);
}
+ END_CATCH
result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]);
struct remote_state *rs = get_remote_state ();
char *buf = rs->buf;
char *endbuf = rs->buf + get_remote_packet_size ();
- volatile struct gdb_exception err;
if (packet_config_support (packet) != PACKET_ENABLE)
error (_("Target does not support branch tracing."));
/* If we fail to read the configuration, we lose some information, but the
tracing itself is not impacted. */
- TRY_CATCH (err, RETURN_MASK_ERROR)
- btrace_read_config (&tinfo->conf);
-
- if (err.message != NULL)
- warning ("%s", err.message);
+ TRY
+ {
+ btrace_read_config (&tinfo->conf);
+ }
+ CATCH (err, RETURN_MASK_ERROR)
+ {
+ if (err.message != NULL)
+ warning ("%s", err.message);
+ }
+ END_CATCH
return tinfo;
}
{
CORE_ADDR pc = 0;
struct obj_section *pc_section;
- volatile struct gdb_exception e;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
/* An error occured during reading. Probably a memory error
due to the section not being loaded yet. This address
cannot be a function descriptor. */
return addr;
}
+ END_CATCH
+
pc_section = find_pc_section (pc);
if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
static struct rs6000_frame_cache *
rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
{
- volatile struct gdb_exception ex;
struct rs6000_frame_cache *cache;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
/* At this point the stack looks as if we just entered the
function, and the return address is stored in LR. */
trad_frame_set_value (cache->saved_regs,
gdbarch_pc_regnum (gdbarch), lr);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return cache;
}
s390_frame_unwind_cache (struct frame_info *this_frame,
void **this_prologue_cache)
{
- volatile struct gdb_exception ex;
struct s390_unwind_cache *info;
if (*this_prologue_cache)
info->frame_base = -1;
info->local_base = -1;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
/* Try to use prologue analysis to fill the unwind cache.
If this fails, fall back to reading the stack backchain. */
if (!s390_prologue_frame_unwind_cache (this_frame, info))
s390_backchain_frame_unwind_cache (this_frame, info);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
+ END_CATCH
return info;
}
CORE_ADDR addr;
gdb_byte addr_buf[TIC6X_PTR_SIZE];
struct int_elf32_dsbt_loadmap *ldm;
- volatile struct gdb_exception ex;
int ret;
/* Read the contents of the .interp section into a local buffer;
loaded so that we can load its symbols and place a breakpoint
in the dynamic linker itself. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
tmp_bfd = solib_bfd_open (buf);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
if (tmp_bfd == NULL)
{
enable_break_failure_warning ();
CORE_ADDR addr, interp_loadmap_addr;
gdb_byte addr_buf[FRV_PTR_SIZE];
struct int_elf32_fdpic_loadmap *ldm;
- volatile struct gdb_exception ex;
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
tmp_bfd = solib_bfd_open (buf);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
if (tmp_bfd == NULL)
{
enable_break_failure_warning ();
int
ia64_hpux_at_dld_breakpoint_p (ptid_t ptid)
{
- volatile struct gdb_exception e;
ptid_t saved_ptid = inferior_ptid;
int result = 0;
inferior_ptid = ptid;
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
result = ia64_hpux_at_dld_breakpoint_1_p (ptid);
}
inferior_ptid = saved_ptid;
- if (e.reason < 0)
- warning (_("error while checking for dld breakpoint: %s"), e.message);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ warning (_("error while checking for dld breakpoint: %s"), e.message);
+ }
+ END_CATCH
return result;
}
void
ia64_hpux_handle_dld_breakpoint (ptid_t ptid)
{
- volatile struct gdb_exception e;
ptid_t saved_ptid = inferior_ptid;
inferior_ptid = ptid;
- TRY_CATCH (e, RETURN_MASK_ALL)
+ TRY
{
ia64_hpux_handle_dld_breakpoint_1 (ptid);
}
inferior_ptid = saved_ptid;
- if (e.reason < 0)
- warning (_("error detected while handling dld breakpoint: %s"), e.message);
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ warning (_("error detected while handling dld breakpoint: %s"), e.message);
+ }
+ END_CATCH
}
/* Find the address of the code and data segments in ABFD, and update
{
enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)?
BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
CORE_ADDR data =
read_memory_unsigned_integer (*ocl_program_addr_base,
link_ptr = &newobj->next;
}
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Ignore memory errors. */
switch (ex.error)
break;
}
}
+ END_CATCH
}
}
}
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
CORE_ADDR addr = 0;
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
ptr_type);
}
- if (ex.reason < 0)
- exception_print (gdb_stderr, ex);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
+
return addr;
}
struct so_list *so;
bfd *tmp_bfd = NULL;
struct target_ops *tmp_bfd_target;
- volatile struct gdb_exception ex;
sym_addr = 0;
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
tmp_bfd = solib_bfd_open (interp_name);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
if (tmp_bfd == NULL)
goto bkpt_at_symbol;
}
else
{
- volatile struct gdb_exception e;
flags |= current_inferior ()->symfile_flags;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
struct section_addr_info *sap;
NULL);
so->objfile->addr_low = so->addr_low;
free_section_addr_info (sap);
+
+ so->symbols_loaded = 1;
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, e, _("Error while reading shared"
+ " library symbols for %s:\n"),
+ so->so_name);
}
+ END_CATCH
- if (e.reason < 0)
- exception_fprintf (gdb_stderr, e, _("Error while reading shared"
- " library symbols for %s:\n"),
- so->so_name);
- else
- so->symbols_loaded = 1;
return 1;
}
/* Fill in the rest of each of the `struct so_list' nodes. */
for (i = inferior; i; i = i->next)
{
- volatile struct gdb_exception e;
i->pspace = current_program_space;
VEC_safe_push (so_list_ptr, current_program_space->added_solibs, i);
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
/* Fill in the rest of the `struct so_list' node. */
if (!solib_map_sections (i))
}
}
- if (e.reason < 0)
- exception_fprintf (gdb_stderr, e,
- _("Error while mapping shared "
- "library sections:\n"));
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, e,
+ _("Error while mapping shared "
+ "library sections:\n"));
+ }
+ END_CATCH
/* Notify any observer that the shared object has been
loaded now that we've added it to GDB's tables. */
&& (!was_loaded
|| filename_cmp (found_pathname, so->so_name) != 0))
{
- volatile struct gdb_exception e;
+ int got_error = 0;
- TRY_CATCH (e, RETURN_MASK_ERROR)
- solib_map_sections (so);
+ TRY
+ {
+ solib_map_sections (so);
+ }
+
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, e,
+ _("Error while mapping "
+ "shared library sections:\n"));
+ got_error = 1;
+ }
+ END_CATCH
- if (e.reason < 0)
- exception_fprintf (gdb_stderr, e,
- _("Error while mapping "
- "shared library sections:\n"));
- else if (auto_solib_add || was_loaded || libpthread_solib_p (so))
- solib_read_symbols (so, flags);
+ if (!got_error
+ && (auto_solib_add || was_loaded || libpthread_solib_p (so)))
+ solib_read_symbols (so, flags);
}
}
enum print_what print_what,
int set_current_sal)
{
- volatile struct gdb_exception e;
/* For mi, alway print location and address. */
if (ui_out_is_mi_like_p (current_uiout))
print_what = LOC_AND_ADDRESS;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
print_frame_info (frame, print_level, print_what, 1 /* print_args */,
set_current_sal);
if (set_current_sal)
set_current_sal_from_frame (frame);
}
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
/* Print nameless arguments of frame FRAME on STREAM, where START is
print_frame_arg (const struct frame_arg *arg)
{
struct ui_out *uiout = current_uiout;
- volatile struct gdb_exception except;
struct cleanup *old_chain;
struct ui_file *stb;
+ const char *error_message = NULL;
stb = mem_fileopen ();
old_chain = make_cleanup_ui_file_delete (stb);
else
{
if (arg->error)
- except.message = arg->error;
+ error_message = arg->error;
else
{
- /* TRY_CATCH has two statements, wrap it in a block. */
-
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
const struct language_defn *language;
struct value_print_options opts;
common_val_print (arg->val, stb, 2, &opts, language);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ error_message = except.message;
+ }
+ END_CATCH
}
- if (except.message)
+ if (error_message != NULL)
fprintf_filtered (stb, _("<error reading variable: %s>"),
- except.message);
+ error_message);
}
ui_out_field_stream (uiout, "value", stb);
read_frame_local (struct symbol *sym, struct frame_info *frame,
struct frame_arg *argp)
{
- volatile struct gdb_exception except;
struct value *val = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ argp->sym = sym;
+ argp->val = NULL;
+ argp->error = NULL;
+
+ TRY
{
- val = read_var_value (sym, frame);
+ argp->val = read_var_value (sym, frame);
}
-
- argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
- argp->sym = sym;
- argp->val = val;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ argp->error = xstrdup (except.message);
+ }
+ END_CATCH
}
/* Read in inferior function parameter SYM at FRAME into ARGP. Caller is
struct value *val = NULL, *entryval = NULL;
char *val_error = NULL, *entryval_error = NULL;
int val_equal = 0;
- volatile struct gdb_exception except;
if (print_entry_values != print_entry_values_only
&& print_entry_values != print_entry_values_preferred)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
val = read_var_value (sym, frame);
}
- if (!val)
+ CATCH (except, RETURN_MASK_ERROR)
{
val_error = alloca (strlen (except.message) + 1);
strcpy (val_error, except.message);
}
+ END_CATCH
}
if (SYMBOL_COMPUTED_OPS (sym) != NULL
&& (print_entry_values != print_entry_values_if_needed
|| !val || value_optimized_out (val)))
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
const struct symbol_computed_ops *ops;
ops = SYMBOL_COMPUTED_OPS (sym);
entryval = ops->read_variable_at_entry (sym, frame);
}
- if (!entryval)
+ CATCH (except, RETURN_MASK_ERROR)
{
- entryval_error = alloca (strlen (except.message) + 1);
- strcpy (entryval_error, except.message);
+ if (except.error != NO_ENTRY_VALUE_ERROR)
+ {
+ entryval_error = (char *) alloca (strlen (except.message) + 1);
+ strcpy (entryval_error, except.message);
+ }
}
+ END_CATCH
- if (except.error == NO_ENTRY_VALUE_ERROR
- || (entryval && value_optimized_out (entryval)))
- {
- entryval = NULL;
- entryval_error = NULL;
- }
+ if (entryval != NULL && value_optimized_out (entryval))
+ entryval = NULL;
if (print_entry_values == print_entry_values_compact
|| print_entry_values == print_entry_values_default)
dereferenced DW_AT_GNU_call_site_data_value does not
differ. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
struct type *type_deref;
TYPE_LENGTH (type_deref)))
val_equal = 1;
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ /* If the dereferenced content could not be
+ fetched do not display anything. */
+ if (except.error == NO_ENTRY_VALUE_ERROR)
+ val_equal = 1;
+ else if (except.message != NULL)
+ {
+ entryval_error = (char *) alloca (strlen (except.message) + 1);
+ strcpy (entryval_error, except.message);
+ }
+ }
+ END_CATCH
/* Value was not a reference; and its content matches. */
if (val == val_deref)
val_equal = 1;
- /* If the dereferenced content could not be fetched do not
- display anything. */
- else if (except.error == NO_ENTRY_VALUE_ERROR)
- val_equal = 1;
- else if (except.message)
- {
- entryval_error = alloca (strlen (except.message) + 1);
- strcpy (entryval_error, except.message);
- }
if (val_equal)
entryval = NULL;
{
if (print_entry_values == print_entry_values_preferred)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ gdb_assert (val == NULL);
+
+ TRY
{
val = read_var_value (sym, frame);
}
- if (!val)
+ CATCH (except, RETURN_MASK_ERROR)
{
val_error = alloca (strlen (except.message) + 1);
strcpy (val_error, except.message);
}
+ END_CATCH
}
if (print_entry_values == print_entry_values_only
|| print_entry_values == print_entry_values_both
do_gdb_disassembly (struct gdbarch *gdbarch,
int how_many, CORE_ADDR low, CORE_ADDR high)
{
- volatile struct gdb_exception exception;
- TRY_CATCH (exception, RETURN_MASK_ERROR)
+ TRY
{
gdb_disassembly (gdbarch, current_uiout, 0,
DISASSEMBLY_RAW_INSN, how_many,
low, high);
}
- if (exception.reason < 0)
+ CATCH (exception, RETURN_MASK_ERROR)
{
/* If an exception was thrown while doing the disassembly, print
the error message, to give the user a clue of what happened. */
exception_print (gdb_stderr, exception);
}
+ END_CATCH
}
/* Print information about frame FRAME. The output is format according
struct gdbarch *gdbarch = get_frame_arch (frame);
int numargs;
struct cleanup *args_list_chain;
- volatile struct gdb_exception e;
if (gdbarch_frame_num_args_p (gdbarch))
{
numargs = -1;
args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
print_frame_args (func, frame, numargs, gdb_stdout);
}
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
+
/* FIXME: ARGS must be a list. If one argument is a string it
will have " that will not be properly escaped. */
/* Invoke ui_out_tuple_end. */
int frame_pc_p;
/* Initialize it to avoid "may be used uninitialized" warning. */
CORE_ADDR caller_pc = 0;
- volatile struct gdb_exception ex;
+ int caller_pc_p = 0;
fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
gdbarch = get_frame_arch (fi);
wrap_here (" ");
printf_filtered ("saved %s = ", pc_regname);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
caller_pc = frame_unwind_caller_pc (fi);
+ caller_pc_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
switch (ex.error)
{
break;
}
}
- else
+ END_CATCH
+
+ if (caller_pc_p)
fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
printf_filtered ("\n");
if (frame)
{
- volatile struct gdb_exception ex;
CORE_ADDR pc = 0;
+ int pc_p = 0;
/* We determine the current frame language by looking up its
associated symtab. To retrieve this symtab, we use the frame
a PC that is guaranteed to be inside the frame's code
block. */
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
pc = get_frame_address_in_block (frame);
+ pc_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
- else
+ END_CATCH
+
+ if (pc_p)
{
struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
enum type_code code)
{
struct cleanup *back_to;
- volatile struct gdb_exception except;
return_val = NULL;
back_to = make_cleanup (do_free_completion_list, &return_val);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
default_make_symbol_completion_list_break_on_1 (text, word,
break_on, code);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
throw_exception (except);
}
+ END_CATCH
discard_cleanups (back_to);
return return_val;
if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
{
ptid_t ptid = inferior_ptid;
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
CORE_ADDR lm_addr;
}
/* If an error occurred, print TLS related messages here. Otherwise,
throw the error to some higher catcher. */
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
int objfile_is_library = (objfile->flags & OBJF_SHARED);
break;
}
}
+ END_CATCH
}
/* It wouldn't be wrong here to try a gdbarch method, too; finding
TLS is an ABI-specific thing. But we don't do that yet. */
{
int exit_code = 0;
struct qt_args qt;
- volatile struct gdb_exception ex;
/* An optional expression may be used to cause gdb to terminate with the
value of that expression. */
/* We want to handle any quit errors and exit regardless. */
/* Get out of tfind mode, and kill or detach all inferiors. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
disconnect_tracing ();
iterate_over_inferiors (kill_or_detach, &qt);
}
- if (ex.reason < 0)
- exception_print (gdb_stderr, ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
/* Give all pushed targets a chance to do minimal cleanup, and pop
them all out. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
pop_all_targets ();
}
- if (ex.reason < 0)
- exception_print (gdb_stderr, ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
/* Save the history information if it is appropriate to do so. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
if (write_history_p && history_filename
&& input_from_terminal_p ())
gdb_safe_append_history ();
}
- if (ex.reason < 0)
- exception_print (gdb_stderr, ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
/* Do any final cleanups before exiting. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
do_final_cleanups (all_cleanups ());
}
- if (ex.reason < 0)
- exception_print (gdb_stderr, ex);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
exit (exit_code);
}
static void
tfile_open (const char *arg, int from_tty)
{
- volatile struct gdb_exception ex;
char *temp;
struct cleanup *old_chain;
int flags;
ts->disconnected_tracing = 0;
ts->circular_buffer = 0;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
/* Read through a section of newline-terminated lines that
define things like tracepoints. */
if (trace_regblock_size == 0)
error (_("No register block size recorded in trace file"));
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Remove the partially set up target. */
unpush_target (&tfile_ops);
throw_exception (ex);
}
+ END_CATCH
inferior_appeared (current_inferior (), TFILE_PID);
inferior_ptid = pid_to_ptid (TFILE_PID);
static int
tui_rl_switch_mode (int notused1, int notused2)
{
- volatile struct gdb_exception ex;
/* Don't let exceptions escape. We're in the middle of a readline
callback that isn't prepared for that. */
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
if (tui_active)
{
tui_enable ();
}
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
exception_print (gdb_stderr, ex);
if (!tui_active)
rl_prep_terminal (0);
}
+ END_CATCH
/* Clear the readline in case switching occurred in middle of
something. */
char *s = NULL;
struct ui_file *stb;
struct cleanup *old_chain;
- volatile struct gdb_exception except;
stb = mem_fileopen ();
old_chain = make_cleanup_ui_file_delete (stb);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type_print (type, "", stb, -1);
s = ui_file_xstrdup (stb, NULL);
}
- if (except.reason < 0)
- s = NULL;
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ s = NULL;
+ }
+ END_CATCH
do_cleanups (old_chain);
target = coerce_ref (v);
else if (TYPE_CODE (type) == TYPE_CODE_PTR)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
target = value_ind (v);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error == MEMORY_ERROR)
{
}
throw_exception (except);
}
+ END_CATCH
}
else
return NULL;
value_of_this_silent (const struct language_defn *lang)
{
struct value *ret = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ret = value_of_this (lang);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
return ret;
}
const struct value_print_options *options,
const struct language_defn *language)
{
- volatile struct gdb_exception except;
int ret = 0;
struct value_print_options local_opts = *options;
struct type *real_type = check_typedef (type);
return;
}
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
language->la_val_print (type, valaddr, embedded_offset, address,
stream, recurse, val,
&local_opts);
}
- if (except.reason < 0)
- fprintf_filtered (stream, _("<error reading variable>"));
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (stream, _("<error reading variable>"));
+ }
+ END_CATCH
}
/* Check whether the value VAL is printable. Return 1 if it is;
get_user_print_options (&opts);
for (var = internalvars; var; var = var->next)
{
- volatile struct gdb_exception ex;
if (!varseen)
{
}
printf_filtered (("$%s = "), var->name);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
struct value *val;
val = value_of_internalvar (gdbarch, var);
value_print (val, gdb_stdout, &opts);
}
- if (ex.reason < 0)
- fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ }
+ END_CATCH
+
printf_filtered (("\n"));
}
if (!varseen)
const struct block *block;
const char *p;
struct value *value = NULL;
- volatile struct gdb_exception except;
CORE_ADDR pc;
/* Parse and evaluate the expression, filling in as much of the
innermost_block = NULL;
/* Wrap the call to parse expression, so we can
return a sensible error. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
var->root->exp = parse_exp_1 (&p, pc, block, 0);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
do_cleanups (old_chain);
return NULL;
}
+ END_CATCH
/* Don't allow variables to be created for types. */
if (var->root->exp->elts[0].opcode == OP_TYPE
/* We definitely need to catch errors here.
If evaluate_expression succeeds we got the value we wanted.
But if it fails, we still go on with a call to evaluate_type(). */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = evaluate_expression (var->root->exp);
}
-
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
/* Error getting the value. Try to at least get the
right type. */
var->type = value_type (type_only_value);
}
- else
- {
- int real_type_found = 0;
+ END_CATCH
- var->type = value_actual_type (value, 0, &real_type_found);
- if (real_type_found)
- value = value_cast (var->type, value);
- }
+ if (value != NULL)
+ {
+ int real_type_found = 0;
+
+ var->type = value_actual_type (value, 0, &real_type_found);
+ if (real_type_found)
+ value = value_cast (var->type, value);
+ }
/* Set language info */
var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
struct value *value = NULL; /* Initialize to keep gcc happy. */
int saved_input_radix = input_radix;
const char *s = expression;
- volatile struct gdb_exception except;
gdb_assert (varobj_editable_p (var));
input_radix = 10; /* ALWAYS reset to decimal temporarily. */
exp = parse_exp_1 (&s, 0, 0, 0);
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = evaluate_expression (exp);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
/* We cannot proceed without a valid expression. */
xfree (exp);
return 0;
}
+ END_CATCH
/* All types that are editable must also be changeable. */
gdb_assert (varobj_value_is_changeable_p (var));
/* The new value may be lazy. value_assign, or
rather value_contents, will take care of this. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
val = value_assign (var->value, value);
}
- if (except.reason < 0)
- return 0;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ return 0;
+ }
+ END_CATCH
/* If the value has changed, record it, so that next -var-update can
report this change. If a variable had a value of '1', we've set it
}
else
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value_fetch_lazy (value);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
/* Set the value to NULL, so that for the next -var-update,
we don't try to compare the new value with this value,
that we couldn't even read. */
value = NULL;
}
+ END_CATCH
}
}
if (within_scope)
{
- volatile struct gdb_exception except;
/* We need to catch errors here, because if evaluate
expression fails we want to just return NULL. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
new_val = evaluate_expression (var->root->exp);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
do_cleanups (back_to);
const XML_Char **attrs)
{
struct gdb_xml_parser *parser = data;
- volatile struct gdb_exception ex;
if (parser->error.reason < 0)
return;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
gdb_xml_start_element (data, name, attrs);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
parser->error = ex;
#ifdef HAVE_XML_STOPPARSER
XML_StopParser (parser->expat_parser, XML_FALSE);
#endif
}
+ END_CATCH
}
/* Handle the end of an element. DATA is our local XML parser, and
gdb_xml_end_element_wrapper (void *data, const XML_Char *name)
{
struct gdb_xml_parser *parser = data;
- volatile struct gdb_exception ex;
if (parser->error.reason < 0)
return;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
gdb_xml_end_element (data, name);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
parser->error = ex;
#ifdef HAVE_XML_STOPPARSER
XML_StopParser (parser->expat_parser, XML_FALSE);
#endif
}
+ END_CATCH
}
/* Free a parser and all its associated state. */