mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-30 23:40:24 +00:00
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from this: ~~~ volatile gdb_exception ex; TRY_CATCH (ex, RETURN_MASK_ERROR) { } if (ex.reason < 0) { } ~~~ to this: ~~~ TRY { } CATCH (ex, RETURN_MASK_ERROR) { } END_CATCH ~~~ Thus, we'll be getting rid of the local volatile exception object, and declaring the caught exception in the catch block. This allows reimplementing TRY/CATCH in terms of C++ exceptions when building in C++ mode, while still allowing to build GDB in C mode (using setjmp/longjmp), as a transition step. TBC, after this patch, is it _not_ valid to have code between the TRY and the CATCH blocks, like: TRY { } // some code here. CATCH (ex, RETURN_MASK_ERROR) { } END_CATCH Just like it isn't valid to do that with C++'s native try/catch. By switching to creating the exception object inside the CATCH block scope, we can get rid of all the explicitly allocated volatile exception objects all over the tree, and map the CATCH block more directly to C++'s catch blocks. The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was done with a script, rerun from scratch at every rebase, no manual editing involved. After the mechanical conversion, a few places needed manual intervention, to fix preexisting cases where we were using the exception object outside of the TRY_CATCH block, and cases where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH after this patch]. The result was folded into this patch so that GDB still builds at each incremental step. END_CATCH is necessary for two reasons: First, because we name the exception object in the CATCH block, which requires creating a scope, which in turn must be closed somewhere. Declaring the exception variable in the initializer field of a for block, like: #define CATCH(EXCEPTION, mask) \ for (struct gdb_exception EXCEPTION; \ exceptions_state_mc_catch (&EXCEPTION, MASK); \ EXCEPTION = exception_none) would avoid needing END_CATCH, but alas, in C mode, we build with C90, which doesn't allow mixed declarations and code. Second, because when TRY/CATCH are wired to real C++ try/catch, as long as we need to handle cleanup chains, even if there's no CATCH block that wants to catch the exception, we need for stop at every frame in the unwind chain and run cleanups, then rethrow. That will be done in END_CATCH. After we require C++, we'll still need TRY/CATCH/END_CATCH until cleanups are completely phased out -- TRY/CATCH in C++ mode will save/restore the current cleanup chain, like in C mode, and END_CATCH catches otherwise uncaugh exceptions, runs cleanups and rethrows, so that C++ cleanups and exceptions can coexist. IMO, this still makes the TRY/CATCH code look a bit more like a newcomer would expect, so IMO worth it even if we weren't considering C++. gdb/ChangeLog. 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. gdb/gdbserver/ChangeLog: 2015-03-07 Pedro Alves <palves@redhat.com> Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH instead.
This commit is contained in:
parent
ece957c859
commit
492d29ea1c
@ -1,3 +1,20 @@
|
||||
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.
|
||||
|
@ -6479,7 +6479,6 @@ type_from_tag (struct value *tag)
|
||||
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;
|
||||
@ -6514,13 +6513,16 @@ ada_tag_value_at_base_address (struct value *obj)
|
||||
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. */
|
||||
|
||||
@ -6632,7 +6634,6 @@ ada_tag_name_from_tsd (struct value *tsd)
|
||||
const char *
|
||||
ada_tag_name (struct value *tag)
|
||||
{
|
||||
volatile struct gdb_exception e;
|
||||
char *name = NULL;
|
||||
|
||||
if (!ada_is_tag_type (value_type (tag)))
|
||||
@ -6647,13 +6648,17 @@ ada_tag_name (struct value *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;
|
||||
}
|
||||
@ -11817,19 +11822,19 @@ static CORE_ADDR
|
||||
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;
|
||||
}
|
||||
@ -11929,16 +11934,15 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
|
||||
|
||||
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"),
|
||||
@ -11951,6 +11955,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
|
||||
to NULL. */
|
||||
exp = NULL;
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
ada_loc->excep_cond_expr = exp;
|
||||
@ -12014,7 +12019,6 @@ should_stop_exception (const struct bp_location *bl)
|
||||
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. */
|
||||
@ -12029,7 +12033,7 @@ should_stop_exception (const struct bp_location *bl)
|
||||
}
|
||||
|
||||
stop = 1;
|
||||
TRY_CATCH (ex, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct value *mark;
|
||||
|
||||
@ -12037,9 +12041,13 @@ should_stop_exception (const struct bp_location *bl)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -159,19 +159,19 @@ print_range (struct type *type, struct ui_file *stream,
|
||||
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
|
||||
@ -179,8 +179,11 @@ print_range (struct type *type, struct ui_file *stream,
|
||||
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, " .. ");
|
||||
|
@ -1159,15 +1159,18 @@ ada_val_print (struct type *type, const gdb_byte *valaddr,
|
||||
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
|
||||
|
@ -2466,7 +2466,6 @@ amd64_frame_cache_1 (struct frame_info *this_frame,
|
||||
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)
|
||||
@ -2475,15 +2474,16 @@ amd64_frame_cache (struct frame_info *this_frame, void **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;
|
||||
}
|
||||
@ -2582,7 +2582,6 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_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];
|
||||
@ -2593,7 +2592,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
@ -2607,11 +2606,12 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
@ -2758,7 +2758,6 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_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];
|
||||
|
||||
@ -2768,7 +2767,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
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);
|
||||
@ -2786,11 +2785,12 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -163,7 +163,6 @@ check_status_exception_catchpoint (struct bpstats *bs)
|
||||
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)
|
||||
@ -172,7 +171,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
|
||||
if (self->pattern == NULL)
|
||||
return;
|
||||
|
||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
struct value *typeinfo_arg;
|
||||
char *canon;
|
||||
@ -187,8 +186,11 @@ check_status_exception_catchpoint (struct bpstats *bs)
|
||||
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)
|
||||
{
|
||||
@ -206,38 +208,38 @@ re_set_exception_catchpoint (struct breakpoint *self)
|
||||
{
|
||||
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);
|
||||
|
116
gdb/breakpoint.c
116
gdb/breakpoint.c
@ -2221,25 +2221,25 @@ static struct agent_expr *
|
||||
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;
|
||||
@ -2361,7 +2361,6 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
|
||||
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;
|
||||
@ -2420,22 +2419,22 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
|
||||
|
||||
/* 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;
|
||||
@ -2572,7 +2571,6 @@ insert_bp_location (struct bp_location *bl,
|
||||
{
|
||||
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;
|
||||
@ -2675,7 +2673,7 @@ insert_bp_location (struct bp_location *bl,
|
||||
|| !(section_is_overlay (bl->section)))
|
||||
{
|
||||
/* No overlay handling: just set the breakpoint. */
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -2683,11 +2681,12 @@ insert_bp_location (struct bp_location *bl,
|
||||
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
|
||||
{
|
||||
@ -2710,7 +2709,7 @@ insert_bp_location (struct bp_location *bl,
|
||||
bl->overlay_target_info.reqstd_address = addr;
|
||||
|
||||
/* No overlay handling: just set the breakpoint. */
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -2719,11 +2718,12 @@ insert_bp_location (struct bp_location *bl,
|
||||
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,
|
||||
@ -2736,7 +2736,7 @@ insert_bp_location (struct bp_location *bl,
|
||||
if (section_is_mapped (bl->section))
|
||||
{
|
||||
/* Yes. This overlay section is mapped into memory. */
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -2744,11 +2744,12 @@ insert_bp_location (struct bp_location *bl,
|
||||
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
|
||||
{
|
||||
@ -10004,7 +10005,6 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
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;
|
||||
@ -10018,24 +10018,17 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
|
||||
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. */
|
||||
|
||||
@ -10066,14 +10059,14 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
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);
|
||||
@ -11343,7 +11336,6 @@ static void
|
||||
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;
|
||||
@ -11655,17 +11647,18 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
|
||||
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);
|
||||
@ -13011,10 +13004,15 @@ breakpoint_retire_moribund (void)
|
||||
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. */
|
||||
@ -14485,22 +14483,22 @@ update_breakpoint_locations (struct breakpoint *b,
|
||||
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)
|
||||
@ -14564,18 +14562,21 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
|
||||
{
|
||||
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
|
||||
@ -14602,8 +14603,9 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
|
||||
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;
|
||||
|
||||
@ -15094,9 +15096,8 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
|
||||
{
|
||||
/* 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;
|
||||
|
||||
@ -15104,13 +15105,14 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
|
||||
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;
|
||||
@ -15924,19 +15926,21 @@ save_breakpoints (char *filename, int from_tty,
|
||||
|
||||
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");
|
||||
}
|
||||
|
18
gdb/btrace.c
18
gdb/btrace.c
@ -549,11 +549,10 @@ ftrace_update_insns (struct btrace_function *bfun,
|
||||
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;
|
||||
@ -562,6 +561,10 @@ ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
else if (gdbarch_insn_is_jump (gdbarch, pc))
|
||||
iclass = BTRACE_INSN_JUMP;
|
||||
}
|
||||
CATCH (error, RETURN_MASK_ERROR)
|
||||
{
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return iclass;
|
||||
}
|
||||
@ -598,7 +601,6 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
|
||||
|
||||
for (;;)
|
||||
{
|
||||
volatile struct gdb_exception error;
|
||||
struct btrace_insn insn;
|
||||
int size;
|
||||
|
||||
@ -628,8 +630,14 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
|
||||
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;
|
||||
|
@ -91,15 +91,17 @@ adjust_value_for_child_access (struct value **value,
|
||||
{
|
||||
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)
|
||||
@ -245,7 +247,6 @@ static struct value *
|
||||
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);
|
||||
@ -253,21 +254,20 @@ value_struct_element_index (struct value *value, int type_index)
|
||||
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
|
||||
@ -290,7 +290,6 @@ c_describe_child (const struct varobj *parent, int index,
|
||||
struct type *type = varobj_get_value_type (parent);
|
||||
char *parent_expression = NULL;
|
||||
int was_ptr;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (cname)
|
||||
*cname = NULL;
|
||||
@ -319,10 +318,14 @@ c_describe_child (const struct varobj *parent, int index,
|
||||
{
|
||||
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)
|
||||
@ -391,13 +394,16 @@ c_describe_child (const struct varobj *parent, int index,
|
||||
|
||||
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
|
||||
|
@ -179,7 +179,6 @@ cli_interpreter_exec (void *data, const char *command_str)
|
||||
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;
|
||||
|
||||
@ -187,14 +186,15 @@ safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
|
||||
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;
|
||||
|
@ -1111,17 +1111,17 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
|
||||
|
||||
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. */
|
||||
@ -1700,13 +1700,12 @@ script_from_file (FILE *stream, const char *file)
|
||||
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. */
|
||||
@ -1714,6 +1713,7 @@ script_from_file (FILE *stream, const char *file)
|
||||
_("%s:%d: Error in sourced command file:\n%s"),
|
||||
source_file_name, source_line_number, e.message);
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
do_cleanups (old_cleanups);
|
||||
|
@ -46,9 +46,7 @@ struct catcher
|
||||
/* 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;
|
||||
@ -74,16 +72,12 @@ catcher_list_size (void)
|
||||
}
|
||||
|
||||
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. */
|
||||
@ -134,8 +128,7 @@ exceptions_state_mc (enum catcher_action action)
|
||||
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;
|
||||
@ -152,7 +145,6 @@ exceptions_state_mc (enum catcher_action action)
|
||||
{
|
||||
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;
|
||||
@ -169,21 +161,10 @@ exceptions_state_mc (enum catcher_action action)
|
||||
{
|
||||
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"));
|
||||
@ -193,6 +174,31 @@ exceptions_state_mc (enum catcher_action action)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -218,7 +224,7 @@ throw_exception (struct gdb_exception exception)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -118,14 +118,13 @@ struct gdb_exception
|
||||
|
||||
/* 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.
|
||||
|
||||
@ -138,26 +137,37 @@ extern int exceptions_state_mc_action_iter_1 (void);
|
||||
|
||||
*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
|
||||
|
@ -424,7 +424,6 @@ gcc_convert_symbol (void *datum,
|
||||
{
|
||||
struct compile_c_instance *context = datum;
|
||||
domain_enum domain;
|
||||
volatile struct gdb_exception e;
|
||||
int found = 0;
|
||||
|
||||
switch (request)
|
||||
@ -444,7 +443,7 @@ gcc_convert_symbol (void *datum,
|
||||
|
||||
/* 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;
|
||||
|
||||
@ -467,8 +466,11 @@ gcc_convert_symbol (void *datum,
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@ -484,13 +486,12 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
|
||||
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;
|
||||
|
||||
@ -527,8 +528,11 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@ -643,9 +647,8 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
|
||||
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)))
|
||||
{
|
||||
@ -699,7 +702,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
|
||||
}
|
||||
}
|
||||
|
||||
if (e.reason < 0)
|
||||
CATCH (e, RETURN_MASK_ERROR)
|
||||
{
|
||||
if (compiler->symbol_err_map == NULL)
|
||||
compiler->symbol_err_map = htab_create_alloc (10,
|
||||
@ -710,6 +713,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
|
||||
xfree);
|
||||
insert_symbol_error (compiler->symbol_err_map, sym, e.message);
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
/* See compile-internal.h. */
|
||||
|
@ -87,7 +87,6 @@ compile_object_run (struct compile_module *module)
|
||||
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;
|
||||
@ -101,7 +100,7 @@ compile_object_run (struct compile_module *module)
|
||||
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,
|
||||
@ -121,7 +120,7 @@ compile_object_run (struct compile_module *module)
|
||||
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. */
|
||||
@ -133,6 +132,7 @@ compile_object_run (struct compile_module *module)
|
||||
do_module_cleanup (data);
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
|
||||
gdb_assert (!dtor_found && executed);
|
||||
|
@ -395,18 +395,21 @@ expression_completer (struct cmd_list_element *ignore,
|
||||
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 (;;)
|
||||
|
@ -278,7 +278,6 @@ core_open (const char *arg, int from_tty)
|
||||
bfd *temp_bfd;
|
||||
int scratch_chan;
|
||||
int flags;
|
||||
volatile struct gdb_exception except;
|
||||
char *filename;
|
||||
|
||||
target_preopen (from_tty);
|
||||
@ -411,13 +410,16 @@ core_open (const char *arg, int 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)
|
||||
@ -462,12 +464,15 @@ core_open (const char *arg, int from_tty)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
17
gdb/cp-abi.c
17
gdb/cp-abi.c
@ -69,18 +69,17 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
|
||||
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);
|
||||
@ -89,6 +88,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
|
||||
_("Cannot determine virtual baseclass offset "
|
||||
"of incomplete object"));
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -109,16 +109,19 @@ value_rtti_type (struct value *v, int *full,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,6 @@ inspect_type (struct demangle_parse_info *info,
|
||||
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. */
|
||||
@ -173,12 +172,18 @@ inspect_type (struct demangle_parse_info *info,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -241,18 +246,19 @@ inspect_type (struct demangle_parse_info *info,
|
||||
}
|
||||
|
||||
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);
|
||||
@ -446,17 +452,21 @@ replace_typedefs (struct demangle_parse_info *info,
|
||||
|
||||
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);
|
||||
|
@ -313,18 +313,21 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||
}
|
||||
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);
|
||||
@ -486,7 +489,6 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||
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))
|
||||
{
|
||||
@ -506,17 +508,18 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||
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)
|
||||
{
|
||||
|
@ -368,7 +368,6 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
|
||||
struct gdbarch *prev_gdbarch;
|
||||
struct call_site_chain *chain = NULL;
|
||||
struct tailcall_cache *cache;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
gdb_assert (*tailcall_cachep == NULL);
|
||||
|
||||
@ -377,7 +376,7 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
|
||||
this_pc = get_frame_address_in_block (this_frame);
|
||||
|
||||
/* Catch any unwinding errors. */
|
||||
TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
int sp_regnum;
|
||||
|
||||
@ -397,12 +396,13 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
|
||||
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)
|
||||
|
@ -1025,7 +1025,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
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;
|
||||
|
||||
@ -1102,7 +1101,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
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)
|
||||
@ -1126,7 +1125,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
|
||||
}
|
||||
}
|
||||
if (ex.reason < 0)
|
||||
CATCH (ex, RETURN_MASK_ERROR)
|
||||
{
|
||||
if (ex.error == NOT_AVAILABLE_ERROR)
|
||||
{
|
||||
@ -1138,6 +1137,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
/* Initialize the register state. */
|
||||
{
|
||||
@ -2269,7 +2269,6 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
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;
|
||||
@ -2311,7 +2310,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
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)
|
||||
@ -2320,7 +2319,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
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);
|
||||
@ -2333,6 +2332,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
}
|
||||
/* The cie_table is discarded by the next if. */
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (cie_table.num_entries != 0)
|
||||
{
|
||||
@ -2352,7 +2352,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
{
|
||||
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)
|
||||
@ -2360,7 +2360,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
&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);
|
||||
@ -2383,6 +2383,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
|
||||
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. */
|
||||
|
@ -983,14 +983,13 @@ struct call_site_chain *
|
||||
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)
|
||||
{
|
||||
@ -1002,6 +1001,8 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
|
||||
else
|
||||
throw_exception (e);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -2183,7 +2184,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
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 ();
|
||||
@ -2206,11 +2206,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
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)
|
||||
{
|
||||
@ -2229,6 +2229,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
else
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (ctx->num_pieces > 0)
|
||||
{
|
||||
|
@ -4221,14 +4221,13 @@ dwarf2_initialize_objfile (struct objfile *objfile)
|
||||
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,
|
||||
@ -4238,8 +4237,11 @@ dwarf2_build_psymtabs (struct objfile *objfile)
|
||||
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. */
|
||||
@ -23171,16 +23173,18 @@ save_gdb_index_command (char *arg, int from_tty)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
gdb/eval.c
33
gdb/eval.c
@ -212,7 +212,6 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
|
||||
int preserve_errors)
|
||||
{
|
||||
struct value *mark, *new_mark, *result;
|
||||
volatile struct gdb_exception ex;
|
||||
|
||||
*valp = NULL;
|
||||
if (resultp)
|
||||
@ -224,11 +223,11 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
|
||||
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
|
||||
@ -243,6 +242,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
|
||||
break;
|
||||
}
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
new_mark = value_mark ();
|
||||
if (mark == new_mark)
|
||||
@ -258,13 +258,16 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
|
||||
*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
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,16 +765,15 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
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),
|
||||
@ -779,6 +781,7 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
else
|
||||
throw_exception (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1446,20 +1449,21 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1863,20 +1867,21 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -326,14 +326,13 @@ start_event_loop (void)
|
||||
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);
|
||||
|
||||
@ -356,6 +355,8 @@ start_event_loop (void)
|
||||
/* Maybe better to set a flag to be checked somewhere as to
|
||||
whether display the prompt or not. */
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (result < 0)
|
||||
break;
|
||||
}
|
||||
|
@ -935,24 +935,28 @@ handle_sighup (int sig)
|
||||
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);
|
||||
|
@ -174,7 +174,6 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
|
||||
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;
|
||||
@ -183,14 +182,15 @@ catch_exceptions_with_msg (struct ui_out *func_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;
|
||||
@ -228,17 +228,22 @@ int
|
||||
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;
|
||||
|
@ -443,19 +443,22 @@ info_common_command_for_block (const struct block *block, const char *comname,
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -96,16 +96,15 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
|
||||
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)
|
||||
{
|
||||
@ -118,6 +117,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
|
||||
}
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
29
gdb/frame.c
29
gdb/frame.c
@ -784,9 +784,9 @@ frame_unwind_pc (struct frame_info *this_frame)
|
||||
{
|
||||
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
|
||||
@ -806,11 +806,12 @@ frame_unwind_pc (struct frame_info *this_frame)
|
||||
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)
|
||||
{
|
||||
@ -835,7 +836,9 @@ frame_unwind_pc (struct frame_info *this_frame)
|
||||
else
|
||||
throw_exception (ex);
|
||||
}
|
||||
else
|
||||
END_CATCH
|
||||
|
||||
if (pc_p)
|
||||
{
|
||||
this_frame->prev_pc.value = pc;
|
||||
this_frame->prev_pc.status = CC_VALUE;
|
||||
@ -1963,14 +1966,13 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
|
||||
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)
|
||||
{
|
||||
@ -1994,6 +1996,7 @@ get_prev_frame_always (struct frame_info *this_frame)
|
||||
else
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return prev_frame;
|
||||
}
|
||||
@ -2222,21 +2225,21 @@ get_frame_pc (struct frame_info *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;
|
||||
}
|
||||
@ -2307,18 +2310,18 @@ int
|
||||
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;
|
||||
}
|
||||
|
13
gdb/gcore.c
13
gdb/gcore.c
@ -114,12 +114,19 @@ write_gcore_file_1 (bfd *obfd)
|
||||
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 ();
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -3144,19 +3144,19 @@ static int exit_code;
|
||||
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,
|
||||
@ -3385,7 +3385,6 @@ captured_main (int argc, char *argv[])
|
||||
|
||||
while (1)
|
||||
{
|
||||
volatile struct gdb_exception exception;
|
||||
|
||||
noack_mode = 0;
|
||||
multi_process = 0;
|
||||
@ -3397,7 +3396,7 @@ captured_main (int argc, char *argv[])
|
||||
|
||||
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. */
|
||||
@ -3450,8 +3449,7 @@ captured_main (int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exception.reason == RETURN_ERROR)
|
||||
CATCH (exception, RETURN_MASK_ERROR)
|
||||
{
|
||||
if (response_needed)
|
||||
{
|
||||
@ -3459,6 +3457,7 @@ captured_main (int argc, char *argv[])
|
||||
putpkt (own_buf);
|
||||
}
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
}
|
||||
|
||||
@ -3467,25 +3466,26 @@ captured_main (int argc, char *argv[])
|
||||
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);
|
||||
exit (exit_code);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
gdb_assert_not_reached ("captured_main should never return");
|
||||
}
|
||||
|
||||
/* Skip PACKET until the next semi-colon (or end of string). */
|
||||
|
@ -2299,20 +2299,22 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
|
||||
{
|
||||
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);
|
||||
@ -3235,7 +3237,6 @@ check_types_worklist (VEC (type_equality_entry_d) **worklist,
|
||||
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;
|
||||
@ -3253,7 +3254,7 @@ types_deeply_equal (struct type *type1, struct type *type2)
|
||||
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);
|
||||
}
|
||||
@ -3264,8 +3265,11 @@ types_deeply_equal (struct type *type1, struct type *type2)
|
||||
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;
|
||||
}
|
||||
|
@ -904,8 +904,8 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
|
||||
{
|
||||
/* 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);
|
||||
|
||||
@ -916,13 +916,18 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
|
||||
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");
|
||||
}
|
||||
|
@ -310,11 +310,11 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
|
||||
{
|
||||
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,
|
||||
@ -325,7 +325,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
|
||||
executed. */
|
||||
cleanups = make_cleanup (xfree, command);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct cleanup *inner_cleanups;
|
||||
|
||||
@ -346,6 +346,12 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
|
||||
|
||||
do_cleanups (inner_cleanups);
|
||||
}
|
||||
CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
except = ex;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
do_cleanups (cleanups);
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
|
||||
|
@ -678,18 +678,21 @@ gdbscm_lookup_block (SCM pc_scm)
|
||||
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)
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ gdbscm_register_breakpoint_x (SCM self)
|
||||
{
|
||||
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)
|
||||
@ -418,7 +418,7 @@ gdbscm_register_breakpoint_x (SCM self)
|
||||
|
||||
pending_breakpoint_scm = self;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
char *location = bp_smob->spec.location;
|
||||
int internal = bp_smob->spec.is_internal;
|
||||
@ -455,6 +455,12 @@ gdbscm_register_breakpoint_x (SCM self)
|
||||
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);
|
||||
@ -473,13 +479,16 @@ gdbscm_delete_breakpoint_x (SCM self)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -565,19 +574,22 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -600,16 +612,19 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -634,7 +649,6 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
|
||||
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"));
|
||||
@ -643,11 +657,15 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
|
||||
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;
|
||||
}
|
||||
@ -755,17 +773,20 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
|
||||
= 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)
|
||||
{
|
||||
@ -778,11 +799,15 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
|
||||
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;
|
||||
}
|
||||
@ -855,7 +880,7 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
|
||||
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,
|
||||
@ -866,10 +891,16 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
|
||||
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);
|
||||
|
||||
@ -936,7 +967,6 @@ gdbscm_breakpoint_commands (SCM self)
|
||||
= 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;
|
||||
@ -951,16 +981,17 @@ gdbscm_breakpoint_commands (SCM self)
|
||||
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);
|
||||
|
@ -762,7 +762,6 @@ gdbscm_register_command_x (SCM self)
|
||||
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);
|
||||
@ -772,7 +771,7 @@ gdbscm_register_command_x (SCM self)
|
||||
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
|
||||
xfree (cmd_name);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (c_smob->is_prefix)
|
||||
{
|
||||
@ -790,7 +789,11 @@ gdbscm_register_command_x (SCM self)
|
||||
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. */
|
||||
|
@ -283,9 +283,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
|
||||
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)
|
||||
{
|
||||
@ -295,7 +294,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
|
||||
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);
|
||||
|
||||
|
@ -220,7 +220,6 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
|
||||
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;
|
||||
@ -234,7 +233,7 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
|
||||
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
|
||||
@ -253,8 +252,11 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
|
||||
}
|
||||
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);
|
||||
@ -396,15 +398,18 @@ gdbscm_frame_valid_p (SCM self)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -421,18 +426,23 @@ gdbscm_frame_name (SCM self)
|
||||
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)
|
||||
@ -461,17 +471,20 @@ gdbscm_frame_type (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -490,15 +503,18 @@ gdbscm_frame_arch (SCM self)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -517,16 +533,19 @@ gdbscm_frame_unwind_stop_reason (SCM self)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -548,17 +567,20 @@ gdbscm_frame_pc (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -578,17 +600,20 @@ gdbscm_frame_block (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -626,17 +651,20 @@ gdbscm_frame_function (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -660,17 +688,20 @@ gdbscm_frame_older (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -694,17 +725,20 @@ gdbscm_frame_newer (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -727,17 +761,20 @@ gdbscm_frame_sal (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -767,15 +804,18 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
|
||||
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)
|
||||
{
|
||||
@ -797,7 +837,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
|
||||
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))
|
||||
{
|
||||
@ -815,14 +855,19 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
|
||||
/* 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)
|
||||
@ -841,11 +886,15 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
|
||||
_("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);
|
||||
}
|
||||
@ -858,17 +907,20 @@ gdbscm_frame_select (SCM self)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -886,13 +938,16 @@ static SCM
|
||||
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 ());
|
||||
}
|
||||
@ -904,13 +959,16 @@ static SCM
|
||||
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 ());
|
||||
}
|
||||
|
@ -234,7 +234,6 @@ gdbscm_lazy_string_to_value (SCM self)
|
||||
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)
|
||||
{
|
||||
@ -242,11 +241,15 @@ gdbscm_lazy_string_to_value (SCM self)
|
||||
_("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);
|
||||
}
|
||||
@ -268,7 +271,6 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
|
||||
{
|
||||
lazy_string_smob *ls_smob;
|
||||
struct value *value = NULL;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
gdb_assert (lsscm_is_lazy_string (string));
|
||||
|
||||
@ -283,15 +285,16 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
|
||||
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;
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
|
||||
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 ());
|
||||
|
||||
@ -95,7 +94,7 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
|
||||
gdbscm_throw (except_scm);
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
@ -128,7 +127,11 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
|
||||
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);
|
||||
@ -156,7 +159,6 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
|
||||
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 ());
|
||||
|
||||
@ -175,7 +177,7 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
|
||||
gdbscm_throw (except_scm);
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
@ -264,7 +266,11 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
|
||||
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);
|
||||
@ -441,7 +447,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
|
||||
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 ());
|
||||
|
||||
@ -460,7 +466,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
|
||||
gdbscm_throw (except_scm);
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
@ -487,6 +493,12 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
|
||||
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);
|
||||
|
||||
@ -742,7 +754,6 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
|
||||
{
|
||||
struct value *value = NULL;
|
||||
SCM except_scm = SCM_BOOL_F;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (type == NULL)
|
||||
{
|
||||
@ -752,7 +763,7 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
|
||||
|
||||
*except_scmp = SCM_BOOL_F;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (vlscm_is_value (obj))
|
||||
{
|
||||
@ -859,8 +870,11 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
|
||||
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))
|
||||
{
|
||||
|
@ -990,7 +990,6 @@ gdbscm_register_parameter_x (SCM self)
|
||||
= 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);
|
||||
@ -1014,7 +1013,7 @@ gdbscm_register_parameter_x (SCM self)
|
||||
_("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,
|
||||
@ -1026,7 +1025,11 @@ gdbscm_register_parameter_x (SCM self)
|
||||
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. */
|
||||
@ -1063,16 +1066,22 @@ gdbscm_parameter_value (SCM self)
|
||||
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);
|
||||
|
@ -263,20 +263,23 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream)
|
||||
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. */
|
||||
|
@ -529,11 +529,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
|
||||
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
|
||||
@ -568,6 +567,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
|
||||
(_("invalid result from pretty-printer to-string"), result);
|
||||
}
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -483,14 +483,17 @@ gdbscm_symbol_needs_frame_p (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -523,7 +526,6 @@ gdbscm_symbol_value (SCM self, SCM rest)
|
||||
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);
|
||||
@ -536,7 +538,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
|
||||
_("cannot get the value of a typedef"));
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (f_smob != NULL)
|
||||
{
|
||||
@ -550,7 +552,11 @@ gdbscm_symbol_value (SCM self, SCM rest)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -571,8 +577,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
|
||||
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,
|
||||
@ -597,18 +603,28 @@ gdbscm_lookup_symbol (SCM name_scm, SCM 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);
|
||||
|
||||
@ -630,8 +646,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
|
||||
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,
|
||||
@ -639,10 +655,16 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM 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);
|
||||
|
||||
|
@ -590,19 +590,22 @@ gdbscm_find_pc_line (SCM pc_scm)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -108,9 +108,8 @@ static char *
|
||||
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;
|
||||
@ -123,11 +122,12 @@ tyscm_type_name (struct type *type, SCM *excp)
|
||||
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;
|
||||
}
|
||||
@ -239,7 +239,6 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
|
||||
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);
|
||||
@ -250,11 +249,15 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
|
||||
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);
|
||||
}
|
||||
@ -628,12 +631,16 @@ gdbscm_type_sizeof (SCM self)
|
||||
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));
|
||||
@ -648,13 +655,16 @@ gdbscm_type_strip_typedefs (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -665,15 +675,18 @@ gdbscm_type_strip_typedefs (SCM self)
|
||||
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)
|
||||
@ -702,7 +715,6 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
|
||||
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);
|
||||
@ -721,13 +733,17 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
|
||||
_("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);
|
||||
}
|
||||
@ -773,13 +789,16 @@ gdbscm_type_pointer (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -832,13 +851,16 @@ gdbscm_type_reference (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -867,13 +889,16 @@ gdbscm_type_const (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -887,13 +912,16 @@ gdbscm_type_volatile (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -907,13 +935,16 @@ gdbscm_type_unqualified (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -1212,9 +1243,8 @@ static struct 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);
|
||||
@ -1226,8 +1256,11 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
|
||||
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;
|
||||
}
|
||||
|
@ -143,7 +143,6 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
|
||||
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);
|
||||
@ -157,7 +156,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
|
||||
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);
|
||||
@ -167,7 +166,11 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
|
||||
|
||||
do_cleanups (old_chain);
|
||||
}
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (s != NULL)
|
||||
{
|
||||
@ -192,13 +195,16 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
|
||||
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);
|
||||
}
|
||||
@ -360,7 +366,6 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
|
||||
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);
|
||||
@ -372,11 +377,15 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -396,13 +405,16 @@ gdbscm_value_optimized_out_p (SCM self)
|
||||
= 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);
|
||||
}
|
||||
@ -423,15 +435,18 @@ gdbscm_value_address (SCM self)
|
||||
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);
|
||||
@ -457,15 +472,18 @@ gdbscm_value_dereference (SCM 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
|
||||
{
|
||||
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);
|
||||
|
||||
@ -495,11 +513,10 @@ gdbscm_value_referenced_value (SCM 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
|
||||
{
|
||||
switch (TYPE_CODE (check_typedef (value_type (value))))
|
||||
{
|
||||
@ -514,7 +531,11 @@ gdbscm_value_referenced_value (SCM self)
|
||||
" 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);
|
||||
|
||||
@ -550,12 +571,11 @@ gdbscm_value_dynamic_type (SCM self)
|
||||
= 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 ());
|
||||
@ -594,7 +614,11 @@ gdbscm_value_dynamic_type (SCM self)
|
||||
|
||||
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);
|
||||
@ -619,11 +643,10 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
|
||||
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);
|
||||
@ -635,7 +658,11 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
|
||||
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);
|
||||
@ -686,7 +713,6 @@ gdbscm_value_field (SCM self, SCM field_scm)
|
||||
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"));
|
||||
@ -696,13 +722,17 @@ gdbscm_value_field (SCM self, SCM field_scm)
|
||||
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);
|
||||
@ -730,7 +760,6 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
|
||||
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. */
|
||||
@ -749,7 +778,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
|
||||
gdbscm_throw (except_scm);
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct value *tmp = value;
|
||||
|
||||
@ -765,7 +794,11 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
|
||||
|
||||
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);
|
||||
@ -792,13 +825,16 @@ gdbscm_value_call (SCM self, SCM args)
|
||||
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,
|
||||
@ -832,7 +868,7 @@ gdbscm_value_call (SCM self, SCM args)
|
||||
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;
|
||||
@ -841,7 +877,11 @@ gdbscm_value_call (SCM self, SCM args)
|
||||
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);
|
||||
@ -861,17 +901,20 @@ gdbscm_value_to_bytevector (SCM self)
|
||||
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);
|
||||
@ -902,27 +945,34 @@ gdbscm_value_to_bool (SCM self)
|
||||
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);
|
||||
}
|
||||
@ -938,27 +988,34 @@ gdbscm_value_to_integer (SCM self)
|
||||
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);
|
||||
@ -977,24 +1034,31 @@ gdbscm_value_to_real (SCM self)
|
||||
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)
|
||||
@ -1045,7 +1109,6 @@ gdbscm_value_to_string (SCM self, SCM rest)
|
||||
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. */
|
||||
@ -1081,11 +1144,15 @@ gdbscm_value_to_string (SCM self, SCM rest)
|
||||
/* 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. */
|
||||
@ -1131,7 +1198,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
|
||||
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. */
|
||||
@ -1142,7 +1209,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
|
||||
|
||||
cleanups = make_cleanup (xfree, encoding);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct cleanup *inner_cleanup
|
||||
= make_cleanup_value_free_to_mark (value_mark ());
|
||||
@ -1155,6 +1222,12 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
|
||||
|
||||
do_cleanups (inner_cleanup);
|
||||
}
|
||||
CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
except = ex;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
do_cleanups (cleanups);
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
|
||||
@ -1184,14 +1257,17 @@ gdbscm_value_fetch_lazy_x (SCM self)
|
||||
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;
|
||||
}
|
||||
@ -1207,12 +1283,11 @@ gdbscm_value_print (SCM self)
|
||||
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);
|
||||
@ -1222,7 +1297,11 @@ gdbscm_value_print (SCM self)
|
||||
|
||||
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.
|
||||
@ -1246,7 +1325,6 @@ gdbscm_parse_and_eval (SCM expr_scm)
|
||||
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. */
|
||||
@ -1257,11 +1335,15 @@ gdbscm_parse_and_eval (SCM expr_scm)
|
||||
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);
|
||||
@ -1282,15 +1364,18 @@ gdbscm_history_ref (SCM index)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -1304,16 +1389,19 @@ gdbscm_history_append_x (SCM value)
|
||||
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);
|
||||
}
|
||||
|
@ -2049,7 +2049,6 @@ i386_frame_cache_1 (struct frame_info *this_frame,
|
||||
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)
|
||||
@ -2058,15 +2057,16 @@ i386_frame_cache (struct frame_info *this_frame, void **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;
|
||||
}
|
||||
@ -2216,7 +2216,6 @@ i386_epilogue_frame_sniffer (const struct frame_unwind *self,
|
||||
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;
|
||||
|
||||
@ -2226,7 +2225,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
cache = i386_alloc_frame_cache ();
|
||||
*this_cache = cache;
|
||||
|
||||
TRY_CATCH (ex, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
cache->pc = get_frame_func (this_frame);
|
||||
|
||||
@ -2240,11 +2239,12 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
}
|
||||
@ -2402,7 +2402,6 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_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];
|
||||
@ -2412,7 +2411,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
@ -2436,11 +2435,12 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
|
||||
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;
|
||||
|
@ -50,13 +50,12 @@ inferior_event_handler (enum inferior_event_type event_type,
|
||||
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);
|
||||
@ -64,6 +63,7 @@ inferior_event_handler (enum inferior_event_type event_type,
|
||||
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
break;
|
||||
|
||||
@ -111,18 +111,21 @@ inferior_event_handler (enum inferior_event_type event_type,
|
||||
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;
|
||||
|
||||
|
@ -383,7 +383,7 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
|
||||
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;
|
||||
@ -401,7 +401,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
|
||||
/* We want stop_registers, please... */
|
||||
call_thread->control.proceed_to_finish = 1;
|
||||
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
int was_sync = sync_execution;
|
||||
|
||||
@ -423,6 +423,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
|
||||
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. */
|
||||
@ -435,7 +440,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
|
||||
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);
|
||||
@ -446,7 +451,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
|
||||
|
||||
sync_execution = saved_sync_execution;
|
||||
|
||||
return e;
|
||||
return caught_error;
|
||||
}
|
||||
|
||||
/* A cleanup function that calls delete_std_terminate_breakpoint. */
|
||||
|
16
gdb/infcmd.c
16
gdb/infcmd.c
@ -411,7 +411,6 @@ strip_bg_char (const char *args, int *bg_char_p)
|
||||
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 ();
|
||||
@ -426,15 +425,16 @@ post_create_inferior (struct target_ops *target, int from_tty)
|
||||
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)
|
||||
{
|
||||
@ -1669,19 +1669,21 @@ finish_command_continuation (void *arg, int err)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
23
gdb/infrun.c
23
gdb/infrun.c
@ -6030,10 +6030,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||
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;
|
||||
@ -6062,6 +6059,11 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||
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
|
||||
@ -6102,7 +6104,6 @@ static void
|
||||
check_exception_resume (struct execution_control_state *ecs,
|
||||
struct frame_info *frame)
|
||||
{
|
||||
volatile struct gdb_exception e;
|
||||
struct bound_probe probe;
|
||||
struct symbol *func;
|
||||
|
||||
@ -6121,7 +6122,7 @@ check_exception_resume (struct execution_control_state *ecs,
|
||||
if (!func)
|
||||
return;
|
||||
|
||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
const struct block *b;
|
||||
struct block_iterator iter;
|
||||
@ -6158,6 +6159,10 @@ check_exception_resume (struct execution_control_state *ecs,
|
||||
}
|
||||
}
|
||||
}
|
||||
CATCH (e, RETURN_MASK_ERROR)
|
||||
{
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6200,7 +6205,6 @@ keep_going (struct execution_control_state *ecs)
|
||||
}
|
||||
else
|
||||
{
|
||||
volatile struct gdb_exception e;
|
||||
struct regcache *regcache = get_current_regcache ();
|
||||
int remove_bp;
|
||||
int remove_wps;
|
||||
@ -6240,16 +6244,17 @@ keep_going (struct execution_control_state *ecs)
|
||||
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);
|
||||
|
||||
|
16
gdb/jit.c
16
gdb/jit.c
@ -816,7 +816,6 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
|
||||
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,
|
||||
@ -839,12 +838,17 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
|
||||
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)
|
||||
{
|
||||
|
@ -2260,22 +2260,22 @@ parse_linespec (linespec_parser *parser, const char **argptr)
|
||||
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)
|
||||
{
|
||||
@ -3106,7 +3106,6 @@ find_linespec_symbols (struct linespec_state *state,
|
||||
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);
|
||||
@ -3194,7 +3193,7 @@ find_linespec_symbols (struct linespec_state *state,
|
||||
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);
|
||||
@ -3202,11 +3201,12 @@ find_linespec_symbols (struct linespec_state *state,
|
||||
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,16 +1202,15 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
|
||||
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;
|
||||
@ -1232,6 +1231,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
|
||||
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. */
|
||||
|
@ -1545,7 +1545,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
||||
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;
|
||||
@ -1572,12 +1571,16 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
@ -611,14 +611,13 @@ enable_thread_event_reporting (void)
|
||||
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,
|
||||
@ -648,6 +647,8 @@ thread_db_find_new_threads_silently (ptid_t ptid)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1681,7 +1682,6 @@ static int
|
||||
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;
|
||||
|
||||
@ -1691,7 +1691,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
|
||||
/* 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,
|
||||
@ -1705,9 +1705,12 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
|
||||
|
||||
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"),
|
||||
|
24
gdb/main.c
24
gdb/main.c
@ -364,9 +364,7 @@ static int
|
||||
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;
|
||||
|
||||
@ -374,7 +372,13 @@ catch_command_errors (catch_command_errors_ftype *command,
|
||||
|
||||
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. */
|
||||
@ -387,9 +391,7 @@ static int
|
||||
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;
|
||||
|
||||
@ -397,7 +399,13 @@ catch_command_errors_const (catch_command_errors_const_ftype *command,
|
||||
|
||||
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. */
|
||||
|
@ -537,15 +537,13 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
||||
|
||||
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;
|
||||
|
||||
@ -554,10 +552,15 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,6 @@ mi_breakpoint_created (struct breakpoint *b)
|
||||
{
|
||||
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;
|
||||
@ -827,8 +826,15 @@ mi_breakpoint_created (struct breakpoint *b)
|
||||
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);
|
||||
@ -862,7 +868,6 @@ mi_breakpoint_modified (struct breakpoint *b)
|
||||
{
|
||||
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;
|
||||
@ -881,8 +886,15 @@ mi_breakpoint_modified (struct breakpoint *b)
|
||||
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);
|
||||
|
@ -2080,7 +2080,6 @@ mi_execute_command (const char *cmd, int from_tty)
|
||||
{
|
||||
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. */
|
||||
@ -2089,18 +2088,19 @@ mi_execute_command (const char *cmd, int from_tty)
|
||||
|
||||
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;
|
||||
@ -2112,17 +2112,18 @@ mi_execute_command (const char *cmd, int from_tty)
|
||||
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 ();
|
||||
|
||||
|
@ -725,7 +725,6 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||
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))
|
||||
@ -745,17 +744,18 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||
|
||||
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)
|
||||
{
|
||||
|
12
gdb/parse.c
12
gdb/parse.c
@ -1133,7 +1133,6 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
||||
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;
|
||||
@ -1215,12 +1214,12 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
||||
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)
|
||||
{
|
||||
@ -1228,6 +1227,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
||||
throw_exception (except);
|
||||
}
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
reallocate_expout (&ps);
|
||||
|
||||
@ -1283,17 +1283,17 @@ parse_expression_for_completion (const char *string, char **name,
|
||||
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)
|
||||
|
@ -1231,9 +1231,8 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
|
||||
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,
|
||||
@ -1248,8 +1247,11 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
|
||||
spe_context_cache_ptid = inferior_ptid;
|
||||
}
|
||||
|
||||
if (ex.reason < 0)
|
||||
return 0;
|
||||
CATCH (ex, RETURN_MASK_ERROR)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
/* Read variable value. */
|
||||
|
@ -1692,15 +1692,14 @@ do_one_display (struct display *d)
|
||||
|
||||
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;
|
||||
@ -1708,6 +1707,7 @@ do_one_display (struct display *d)
|
||||
d->exp_string, ex.message);
|
||||
return;
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
if (d->block)
|
||||
@ -1731,7 +1731,6 @@ do_one_display (struct display *d)
|
||||
printf_filtered (": ");
|
||||
if (d->format.size)
|
||||
{
|
||||
volatile struct gdb_exception ex;
|
||||
|
||||
annotate_display_format ();
|
||||
|
||||
@ -1755,7 +1754,7 @@ do_one_display (struct display *d)
|
||||
|
||||
annotate_display_value ();
|
||||
|
||||
TRY_CATCH (ex, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
struct value *val;
|
||||
CORE_ADDR addr;
|
||||
@ -1766,13 +1765,15 @@ do_one_display (struct display *d)
|
||||
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 ();
|
||||
|
||||
@ -1791,15 +1792,19 @@ do_one_display (struct display *d)
|
||||
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");
|
||||
}
|
||||
|
||||
@ -1975,13 +1980,12 @@ print_variable_and_value (const char *name, struct symbol *var,
|
||||
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;
|
||||
@ -1995,9 +1999,13 @@ print_variable_and_value (const char *name, struct symbol *var,
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,6 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
char *as = NULL;
|
||||
struct ui_file *memfile = mem_fileopen ();
|
||||
PyObject *insn_dict = PyDict_New ();
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (insn_dict == NULL)
|
||||
{
|
||||
@ -217,11 +216,11 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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);
|
||||
@ -229,6 +228,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
as = ui_file_xstrdup (memfile, NULL);
|
||||
if (PyDict_SetItemString (insn_dict, "addr",
|
||||
|
@ -373,19 +373,22 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
|
||||
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)
|
||||
{
|
||||
|
@ -114,7 +114,6 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
|
||||
{
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
int cmp;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
BPPY_SET_REQUIRE_VALID (self_bp);
|
||||
|
||||
@ -136,14 +135,18 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
|
||||
if (cmp < 0)
|
||||
return -1;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (cmp == 1)
|
||||
enable_breakpoint (self_bp->bp);
|
||||
else
|
||||
disable_breakpoint (self_bp->bp);
|
||||
}
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -227,7 +230,6 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
long id;
|
||||
int valid_id = 0;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
BPPY_SET_REQUIRE_VALID (self_bp);
|
||||
|
||||
@ -242,11 +244,15 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
|
||||
if (! gdb_py_int_as_long (newvalue, &id))
|
||||
return -1;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
valid_id = valid_task_id (id);
|
||||
}
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (! valid_id)
|
||||
{
|
||||
@ -278,15 +284,18 @@ static PyObject *
|
||||
bppy_delete_breakpoint (PyObject *self, PyObject *args)
|
||||
{
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
BPPY_REQUIRE_VALID (self_bp);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
delete_breakpoint (self_bp->bp);
|
||||
}
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@ -298,7 +307,6 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
|
||||
{
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
long value;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
BPPY_SET_REQUIRE_VALID (self_bp);
|
||||
|
||||
@ -321,11 +329,15 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
set_ignore_count (self_bp->number, (int) value, 0);
|
||||
}
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_SET_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -429,7 +441,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
|
||||
{
|
||||
char *exp;
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
volatile struct gdb_exception except;
|
||||
struct gdb_exception except = exception_none;
|
||||
|
||||
BPPY_SET_REQUIRE_VALID (self_bp);
|
||||
|
||||
@ -448,10 +460,15 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
|
||||
return -1;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
set_breakpoint_condition (self_bp->bp, exp, 0);
|
||||
}
|
||||
CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
except = ex;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (newvalue != Py_None)
|
||||
xfree (exp);
|
||||
@ -468,7 +485,6 @@ bppy_get_commands (PyObject *self, void *closure)
|
||||
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
|
||||
struct breakpoint *bp = self_bp->bp;
|
||||
long length;
|
||||
volatile struct gdb_exception except;
|
||||
struct ui_file *string_file;
|
||||
struct cleanup *chain;
|
||||
PyObject *result;
|
||||
@ -483,17 +499,18 @@ bppy_get_commands (PyObject *self, void *closure)
|
||||
chain = make_cleanup_ui_file_delete (string_file);
|
||||
|
||||
ui_out_redirect (current_uiout, string_file);
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
|
||||
}
|
||||
ui_out_redirect (current_uiout, NULL);
|
||||
if (except.reason < 0)
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
do_cleanups (chain);
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
cmdstr = ui_file_xstrdup (string_file, &length);
|
||||
make_cleanup (xfree, cmdstr);
|
||||
@ -619,7 +636,6 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
PyObject *temporary = NULL;
|
||||
int internal_bp = 0;
|
||||
int temporary_bp = 0;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiOO", keywords,
|
||||
&spec, &type, &access_type,
|
||||
@ -644,7 +660,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
bppy_pending_object->number = -1;
|
||||
bppy_pending_object->bp = NULL;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
char *copy = xstrdup (spec);
|
||||
struct cleanup *cleanup = make_cleanup (xfree, copy);
|
||||
@ -681,13 +697,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
if (except.reason < 0)
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
PyErr_Format (except.reason == RETURN_QUIT
|
||||
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
|
||||
"%s", except.message);
|
||||
return -1;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
|
||||
return 0;
|
||||
|
@ -537,7 +537,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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",
|
||||
@ -637,7 +636,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
Py_INCREF (self);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct cmd_list_element *cmd;
|
||||
|
||||
@ -668,7 +667,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
||||
set_cmd_completer_handle_brkchars (cmd,
|
||||
cmdpy_completer_handle_brkchars);
|
||||
}
|
||||
if (except.reason < 0)
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
xfree (cmd_name);
|
||||
xfree (docstring);
|
||||
@ -679,6 +678,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
||||
"%s", except.message);
|
||||
return -1;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,6 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
|
||||
{
|
||||
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);
|
||||
@ -101,7 +100,7 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
|
||||
if (!self_finishbp->return_type)
|
||||
return;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct value *function =
|
||||
value_object_to_value (self_finishbp->function_value);
|
||||
@ -121,11 +120,12 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
|
||||
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
|
||||
@ -134,19 +134,19 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
|
||||
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. */
|
||||
@ -166,7 +166,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
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;
|
||||
|
||||
@ -174,7 +173,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
&frame_obj, &internal))
|
||||
return -1;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
/* Default frame to newest frame if necessary. */
|
||||
if (frame_obj == NULL)
|
||||
@ -212,12 +211,14 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
@ -243,7 +244,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
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))
|
||||
{
|
||||
@ -269,11 +270,12 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -289,7 +291,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
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);
|
||||
@ -306,7 +308,11 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
&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;
|
||||
@ -347,7 +353,6 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
|
||||
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 ();
|
||||
@ -362,18 +367,19 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,13 +101,16 @@ static PyObject *
|
||||
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;
|
||||
@ -125,19 +128,19 @@ frapy_name (PyObject *self, PyObject *args)
|
||||
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)
|
||||
{
|
||||
@ -161,15 +164,18 @@ frapy_type (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -182,13 +188,16 @@ frapy_arch (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -200,14 +209,17 @@ static PyObject *
|
||||
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);
|
||||
|
||||
@ -222,15 +234,18 @@ frapy_pc (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -241,14 +256,13 @@ frapy_pc (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -264,7 +278,11 @@ frapy_read_register (PyObject *self, PyObject *args)
|
||||
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);
|
||||
}
|
||||
@ -277,14 +295,17 @@ frapy_block (PyObject *self, PyObject *args)
|
||||
{
|
||||
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;
|
||||
@ -316,15 +337,18 @@ frapy_function (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
@ -339,13 +363,12 @@ PyObject *
|
||||
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
|
||||
@ -365,12 +388,14 @@ frame_info_to_frame_object (struct frame_info *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;
|
||||
}
|
||||
|
||||
@ -382,16 +407,19 @@ static PyObject *
|
||||
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);
|
||||
@ -412,16 +440,19 @@ static PyObject *
|
||||
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);
|
||||
@ -442,17 +473,20 @@ frapy_find_sal (PyObject *self, PyObject *args)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -471,7 +505,6 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -483,7 +516,6 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||
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)
|
||||
@ -502,7 +534,7 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
FRAPY_REQUIRE_VALID (self, frame);
|
||||
|
||||
@ -510,12 +542,13 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||
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)
|
||||
{
|
||||
@ -535,13 +568,17 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||
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);
|
||||
}
|
||||
@ -552,15 +589,18 @@ static PyObject *
|
||||
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;
|
||||
}
|
||||
@ -572,13 +612,16 @@ PyObject *
|
||||
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);
|
||||
}
|
||||
@ -590,13 +633,16 @@ PyObject *
|
||||
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);
|
||||
}
|
||||
|
@ -201,9 +201,8 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
|
||||
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;
|
||||
@ -216,11 +215,12 @@ py_print_type (struct ui_out *out, struct value *val)
|
||||
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;
|
||||
}
|
||||
@ -242,7 +242,6 @@ py_print_value (struct ui_out *out, struct value *val,
|
||||
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. */
|
||||
@ -257,15 +256,16 @@ py_print_value (struct ui_out *out, struct value *val,
|
||||
{
|
||||
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;
|
||||
@ -280,7 +280,7 @@ py_print_value (struct ui_out *out, struct value *val,
|
||||
|
||||
if (should_print)
|
||||
{
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct ui_file *stb;
|
||||
struct cleanup *cleanup;
|
||||
@ -291,11 +291,12 @@ py_print_value (struct ui_out *out, struct value *val,
|
||||
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;
|
||||
@ -363,7 +364,6 @@ py_print_single_arg (struct ui_out *out,
|
||||
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)
|
||||
@ -376,7 +376,7 @@ py_print_single_arg (struct ui_out *out,
|
||||
else
|
||||
val = fv;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
||||
|
||||
@ -473,8 +473,11 @@ py_print_single_arg (struct ui_out *out,
|
||||
|
||||
do_cleanups (cleanups);
|
||||
}
|
||||
if (except.reason < 0)
|
||||
gdbpy_convert_exception (except);
|
||||
CATCH (except, RETURN_MASK_ERROR)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -499,7 +502,6 @@ enumerate_args (PyObject *iter,
|
||||
{
|
||||
PyObject *item;
|
||||
struct value_print_options opts;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
get_user_print_options (&opts);
|
||||
|
||||
@ -511,15 +513,16 @@ enumerate_args (PyObject *iter,
|
||||
|
||||
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
|
||||
@ -578,16 +581,17 @@ enumerate_args (PyObject *iter,
|
||||
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
|
||||
@ -612,12 +616,12 @@ enumerate_args (PyObject *iter,
|
||||
{
|
||||
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);
|
||||
@ -625,6 +629,7 @@ enumerate_args (PyObject *iter,
|
||||
gdbpy_convert_exception (except);
|
||||
goto error;
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
if (py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
|
||||
@ -664,30 +669,32 @@ enumerate_args (PyObject *iter,
|
||||
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;
|
||||
@ -729,7 +736,6 @@ enumerate_locals (PyObject *iter,
|
||||
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;
|
||||
|
||||
@ -761,16 +767,17 @@ enumerate_locals (PyObject *iter,
|
||||
/* 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
|
||||
@ -781,7 +788,7 @@ enumerate_locals (PyObject *iter,
|
||||
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))
|
||||
{
|
||||
@ -794,12 +801,13 @@ enumerate_locals (PyObject *iter,
|
||||
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)
|
||||
{
|
||||
@ -838,15 +846,16 @@ enumerate_locals (PyObject *iter,
|
||||
|
||||
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 ())
|
||||
@ -947,40 +956,41 @@ py_print_args (PyObject *filter,
|
||||
{
|
||||
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;
|
||||
@ -1018,7 +1028,6 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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;
|
||||
@ -1042,15 +1051,16 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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)
|
||||
@ -1074,16 +1084,17 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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
|
||||
@ -1113,11 +1124,10 @@ py_print_frame (PyObject *filter, int flags,
|
||||
{
|
||||
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);
|
||||
|
||||
@ -1137,12 +1147,13 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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)
|
||||
@ -1151,19 +1162,20 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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. */
|
||||
@ -1218,7 +1230,7 @@ py_print_frame (PyObject *filter, int flags,
|
||||
return EXT_LANG_BT_ERROR;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
annotate_frame_function_name ();
|
||||
if (function == NULL)
|
||||
@ -1226,12 +1238,14 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -1251,16 +1265,17 @@ py_print_frame (PyObject *filter, int flags,
|
||||
/* 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"))
|
||||
{
|
||||
@ -1285,7 +1300,7 @@ py_print_frame (PyObject *filter, int flags,
|
||||
}
|
||||
|
||||
make_cleanup (xfree, filename);
|
||||
TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
ui_out_wrap_hint (out, " ");
|
||||
ui_out_text (out, " at ");
|
||||
@ -1293,12 +1308,13 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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);
|
||||
}
|
||||
@ -1319,18 +1335,19 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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);
|
||||
}
|
||||
@ -1340,17 +1357,18 @@ py_print_frame (PyObject *filter, int flags,
|
||||
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)
|
||||
@ -1503,22 +1521,22 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
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);
|
||||
|
||||
|
@ -37,18 +37,18 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
|
||||
{
|
||||
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;
|
||||
|
||||
/* Handle errors by raising Python exceptions. */
|
||||
if (except.reason < 0)
|
||||
TRY
|
||||
{
|
||||
p = command_line_input (prompt, 0, "python");
|
||||
}
|
||||
/* Handle errors by raising Python exceptions. */
|
||||
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
|
||||
@ -58,6 +58,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
|
||||
PyEval_SaveThread ();
|
||||
return NULL;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
/* Detect EOF (Ctrl-D). */
|
||||
if (p == NULL)
|
||||
|
@ -395,13 +395,18 @@ infpy_threads (PyObject *self, PyObject *args)
|
||||
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)
|
||||
@ -503,7 +508,6 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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,
|
||||
@ -514,17 +518,18 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|| 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)
|
||||
@ -557,11 +562,11 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
@ -588,10 +593,16 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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
|
||||
@ -701,10 +712,10 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
|
||||
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;
|
||||
@ -760,12 +771,18 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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
|
||||
|
@ -147,15 +147,18 @@ static PyObject *
|
||||
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;
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
|
||||
{
|
||||
lazy_string_object *self_string = (lazy_string_object *) self;
|
||||
struct value *val = NULL;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (self_string->address == 0)
|
||||
{
|
||||
@ -105,11 +104,15 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
|
||||
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);
|
||||
}
|
||||
|
@ -172,18 +172,21 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
|
||||
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);
|
||||
|
@ -131,15 +131,18 @@ objfpy_get_build_id (PyObject *self, void *closure)
|
||||
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)
|
||||
{
|
||||
@ -386,20 +389,23 @@ objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
}
|
||||
|
@ -662,7 +662,6 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
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))
|
||||
@ -724,14 +723,14 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
|
||||
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);
|
||||
@ -743,6 +742,8 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
"%s", except.message);
|
||||
return -1;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -213,11 +213,10 @@ find_pretty_printer (PyObject *value)
|
||||
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)
|
||||
@ -233,6 +232,10 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -803,13 +806,16 @@ gdbpy_get_varobj_pretty_printer (struct value *value)
|
||||
{
|
||||
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)
|
||||
|
@ -192,16 +192,19 @@ static PyObject *
|
||||
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;
|
||||
@ -246,7 +249,6 @@ sympy_value (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -264,7 +266,7 @@ sympy_value (PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (frame_obj != NULL)
|
||||
{
|
||||
@ -278,7 +280,11 @@ sympy_value (PyObject *self, PyObject *args)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -365,7 +371,6 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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))
|
||||
@ -376,21 +381,28 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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)
|
||||
@ -430,17 +442,20 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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)
|
||||
{
|
||||
|
@ -341,15 +341,18 @@ typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
|
||||
{
|
||||
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);
|
||||
@ -449,13 +452,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -466,15 +472,18 @@ typy_strip_typedefs (PyObject *self, PyObject *args)
|
||||
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)
|
||||
@ -505,7 +514,6 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
|
||||
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;
|
||||
@ -535,13 +543,17 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
|
||||
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);
|
||||
}
|
||||
@ -567,13 +579,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -648,13 +663,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -680,13 +698,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -696,13 +717,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -712,13 +736,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -728,12 +755,16 @@ static PyObject *
|
||||
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));
|
||||
@ -743,9 +774,8 @@ static struct 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);
|
||||
@ -757,7 +787,11 @@ typy_lookup_typename (const char *type_name, const struct block *block)
|
||||
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;
|
||||
}
|
||||
@ -769,7 +803,6 @@ typy_lookup_type (struct demangle_component *demangled,
|
||||
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. */
|
||||
@ -784,7 +817,7 @@ typy_lookup_type (struct demangle_component *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
|
||||
@ -806,7 +839,11 @@ typy_lookup_type (struct demangle_component *demangled,
|
||||
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
|
||||
@ -837,7 +874,6 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
|
||||
const char *err;
|
||||
struct type *argtype;
|
||||
struct cleanup *cleanup;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (TYPE_NAME (type) == NULL)
|
||||
{
|
||||
@ -845,12 +881,16 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
|
||||
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)
|
||||
{
|
||||
@ -903,7 +943,6 @@ typy_template_argument (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -919,13 +958,17 @@ typy_template_argument (PyObject *self, PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
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 --
|
||||
@ -950,11 +993,15 @@ typy_template_argument (PyObject *self, PyObject *args)
|
||||
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);
|
||||
}
|
||||
@ -962,12 +1009,11 @@ typy_template_argument (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -981,11 +1027,12 @@ typy_str (PyObject *self)
|
||||
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);
|
||||
@ -1001,7 +1048,6 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
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. */
|
||||
@ -1015,13 +1061,17 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
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))
|
||||
|
@ -316,13 +316,16 @@ get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -172,10 +172,9 @@ gdbpy_preserve_values (const struct extension_language_defn *extlang,
|
||||
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 ());
|
||||
@ -184,7 +183,11 @@ valpy_dereference (PyObject *self, PyObject *args)
|
||||
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;
|
||||
}
|
||||
@ -200,10 +203,9 @@ valpy_dereference (PyObject *self, PyObject *args)
|
||||
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 ());
|
||||
@ -225,7 +227,11 @@ valpy_referenced_value (PyObject *self, PyObject *args)
|
||||
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;
|
||||
}
|
||||
@ -235,11 +241,10 @@ static PyObject *
|
||||
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
|
||||
@ -249,11 +254,12 @@ valpy_get_address (PyObject *self, void *closure)
|
||||
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);
|
||||
@ -283,7 +289,6 @@ static PyObject *
|
||||
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)
|
||||
@ -292,7 +297,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
|
||||
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 ());
|
||||
@ -331,7 +336,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
|
||||
|
||||
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);
|
||||
@ -358,13 +367,12 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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 ());
|
||||
|
||||
@ -377,7 +385,11 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return str_obj;
|
||||
}
|
||||
@ -394,7 +406,6 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
@ -407,11 +418,15 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
|
||||
&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,
|
||||
@ -429,7 +444,6 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
|
||||
{
|
||||
PyObject *type_obj, *result = NULL;
|
||||
struct type *type;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (! PyArg_ParseTuple (args, "O", &type_obj))
|
||||
return NULL;
|
||||
@ -442,7 +456,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct value *val = ((value_object *) self)->value;
|
||||
struct value *res_val;
|
||||
@ -461,7 +475,11 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
|
||||
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;
|
||||
}
|
||||
@ -508,7 +526,6 @@ value_has_field (struct value *v, PyObject *field)
|
||||
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)
|
||||
@ -524,7 +541,7 @@ value_has_field (struct value *v, PyObject *field)
|
||||
return -1;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
val_type = value_type (v);
|
||||
val_type = check_typedef (val_type);
|
||||
@ -539,7 +556,11 @@ value_has_field (struct value *v, PyObject *field)
|
||||
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;
|
||||
}
|
||||
@ -591,11 +612,11 @@ get_field_type (PyObject *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))
|
||||
@ -673,7 +694,7 @@ valpy_getitem (PyObject *self, PyObject *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 ());
|
||||
@ -723,6 +744,11 @@ valpy_getitem (PyObject *self, PyObject *key)
|
||||
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);
|
||||
@ -744,18 +770,21 @@ static PyObject *
|
||||
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)
|
||||
{
|
||||
@ -790,7 +819,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
|
||||
}
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
|
||||
struct value *return_value;
|
||||
@ -799,7 +828,11 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
|
||||
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;
|
||||
}
|
||||
@ -812,12 +845,11 @@ valpy_str (PyObject *self)
|
||||
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);
|
||||
@ -828,7 +860,11 @@ valpy_str (PyObject *self)
|
||||
|
||||
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);
|
||||
@ -842,13 +878,16 @@ valpy_get_is_optimized_out (PyObject *self, void *closure)
|
||||
{
|
||||
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;
|
||||
@ -862,13 +901,16 @@ valpy_get_is_lazy (PyObject *self, void *closure)
|
||||
{
|
||||
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;
|
||||
@ -881,14 +923,17 @@ static PyObject *
|
||||
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;
|
||||
}
|
||||
@ -926,10 +971,9 @@ enum valpy_opcode
|
||||
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 ());
|
||||
@ -1049,7 +1093,11 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
|
||||
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1103,10 +1151,9 @@ valpy_power (PyObject *self, PyObject *other, PyObject *unused)
|
||||
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 ());
|
||||
@ -1116,7 +1163,11 @@ valpy_negative (PyObject *self)
|
||||
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;
|
||||
}
|
||||
@ -1131,10 +1182,9 @@ static PyObject *
|
||||
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 ());
|
||||
|
||||
@ -1143,7 +1193,11 @@ valpy_absolute (PyObject *self)
|
||||
|
||||
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);
|
||||
@ -1155,12 +1209,12 @@ valpy_absolute (PyObject *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));
|
||||
|
||||
@ -1176,6 +1230,12 @@ valpy_nonzero (PyObject *self)
|
||||
/* 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). */
|
||||
@ -1189,13 +1249,16 @@ static PyObject *
|
||||
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);
|
||||
}
|
||||
@ -1241,7 +1304,6 @@ static PyObject *
|
||||
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
|
||||
@ -1262,7 +1324,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
struct value *value_other, *mark = value_mark ();
|
||||
struct cleanup *cleanup;
|
||||
@ -1307,7 +1369,11 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
|
||||
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)
|
||||
@ -1327,16 +1393,19 @@ valpy_int (PyObject *self)
|
||||
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);
|
||||
}
|
||||
@ -1349,9 +1418,8 @@ valpy_long (PyObject *self)
|
||||
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);
|
||||
|
||||
@ -1361,7 +1429,11 @@ valpy_long (PyObject *self)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -1373,9 +1445,8 @@ valpy_float (PyObject *self)
|
||||
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);
|
||||
|
||||
@ -1384,7 +1455,11 @@ valpy_float (PyObject *self)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -1431,12 +1506,11 @@ struct value *
|
||||
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))
|
||||
{
|
||||
@ -1532,13 +1606,14 @@ convert_value_from_python (PyObject *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;
|
||||
}
|
||||
@ -1549,16 +1624,19 @@ gdbpy_history (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -564,21 +564,27 @@ gdbpy_parameter_value (enum var_types type, void *var)
|
||||
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)
|
||||
@ -619,7 +625,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
|
||||
@ -646,7 +651,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
to_string = cmp;
|
||||
}
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
/* Copy the argument text in case the command modifies it. */
|
||||
char *copy = xstrdup (arg);
|
||||
@ -666,7 +671,11 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
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 ();
|
||||
@ -710,6 +719,7 @@ gdbpy_solib_name (PyObject *self, PyObject *args)
|
||||
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;
|
||||
@ -719,7 +729,6 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
PyObject *result = NULL;
|
||||
PyObject *return_result = NULL;
|
||||
PyObject *unparsed = NULL;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
if (! PyArg_ParseTuple (args, "|s", &arg))
|
||||
return NULL;
|
||||
@ -727,7 +736,8 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
cleanups = make_cleanup (null_cleanup, NULL);
|
||||
|
||||
sals.sals = NULL;
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
|
||||
TRY
|
||||
{
|
||||
if (arg)
|
||||
{
|
||||
@ -743,6 +753,11 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
sals.nelts = 1;
|
||||
}
|
||||
}
|
||||
CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
except = ex;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (sals.sals != NULL && sals.sals != &sal)
|
||||
{
|
||||
@ -824,16 +839,19 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -845,13 +863,12 @@ static PyObject *
|
||||
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;
|
||||
@ -860,7 +877,11 @@ gdbpy_find_pc_line (PyObject *self, PyObject *args)
|
||||
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;
|
||||
}
|
||||
@ -1096,13 +1117,12 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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)
|
||||
{
|
||||
@ -1120,7 +1140,11 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
}
|
||||
@ -1165,7 +1189,6 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
|
||||
void
|
||||
gdbpy_print_stack (void)
|
||||
{
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
/* Print "none", just clear exception. */
|
||||
if (gdbpy_should_print_stack == python_excp_none)
|
||||
@ -1179,10 +1202,14 @@ gdbpy_print_stack (void)
|
||||
/* 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
|
||||
@ -1196,7 +1223,7 @@ gdbpy_print_stack (void)
|
||||
msg = gdbpy_exception_to_string (ptype, pvalue);
|
||||
type = gdbpy_obj_to_string (ptype);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
TRY
|
||||
{
|
||||
if (msg == NULL)
|
||||
{
|
||||
@ -1210,6 +1237,10 @@ gdbpy_print_stack (void)
|
||||
fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
|
||||
type, msg);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
Py_XDECREF (ptype);
|
||||
Py_XDECREF (pvalue);
|
||||
|
@ -139,13 +139,15 @@ require_btrace (void)
|
||||
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. */
|
||||
@ -1140,7 +1142,6 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
|
||||
struct gdbarch *gdbarch,
|
||||
struct bp_target_info *bp_tgt)
|
||||
{
|
||||
volatile struct gdb_exception except;
|
||||
const char *old;
|
||||
int ret;
|
||||
|
||||
@ -1150,13 +1151,18 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
|
||||
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;
|
||||
}
|
||||
@ -1168,7 +1174,6 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
|
||||
struct gdbarch *gdbarch,
|
||||
struct bp_target_info *bp_tgt)
|
||||
{
|
||||
volatile struct gdb_exception except;
|
||||
const char *old;
|
||||
int ret;
|
||||
|
||||
@ -1178,13 +1183,18 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
|
||||
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;
|
||||
}
|
||||
@ -1622,7 +1632,6 @@ record_btrace_find_resume_thread (ptid_t ptid)
|
||||
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;
|
||||
@ -1649,7 +1658,7 @@ record_btrace_start_replaying (struct thread_info *tp)
|
||||
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;
|
||||
@ -1701,7 +1710,7 @@ record_btrace_start_replaying (struct thread_info *tp)
|
||||
/* 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;
|
||||
@ -1710,6 +1719,7 @@ record_btrace_start_replaying (struct thread_info *tp)
|
||||
|
||||
throw_exception (except);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return replay;
|
||||
}
|
||||
@ -2298,21 +2308,22 @@ init_record_btrace_ops (void)
|
||||
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". */
|
||||
@ -2320,21 +2331,22 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
|
||||
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. */
|
||||
|
40
gdb/remote.c
40
gdb/remote.c
@ -497,7 +497,6 @@ remote_get_noisy_reply (char **buf_p,
|
||||
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:");
|
||||
@ -512,12 +511,12 @@ remote_get_noisy_reply (char **buf_p,
|
||||
|
||||
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)
|
||||
{
|
||||
@ -536,6 +535,7 @@ remote_get_noisy_reply (char **buf_p,
|
||||
}
|
||||
putpkt ("E01");
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (relocated)
|
||||
{
|
||||
@ -4382,13 +4382,12 @@ remote_open_1 (const char *name, int from_tty,
|
||||
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. */
|
||||
@ -4398,6 +4397,7 @@ remote_open_1 (const char *name, int from_tty,
|
||||
wait_forever_enabled_p = 1;
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
|
||||
remote_btrace_reset ();
|
||||
@ -7835,15 +7835,14 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever,
|
||||
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)
|
||||
{
|
||||
@ -7861,6 +7860,7 @@ remote_kill (struct target_ops *ops)
|
||||
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
|
||||
@ -10948,7 +10948,6 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
|
||||
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)
|
||||
@ -10958,11 +10957,11 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
|
||||
|
||||
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)
|
||||
{
|
||||
@ -10971,6 +10970,7 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
|
||||
}
|
||||
throw_exception (ex);
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]);
|
||||
|
||||
@ -11537,7 +11537,6 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
|
||||
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."));
|
||||
@ -11565,11 +11564,16 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
@ -572,19 +572,20 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
|
||||
{
|
||||
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))
|
||||
|
@ -3355,7 +3355,6 @@ static const struct frame_unwind rs6000_frame_unwind =
|
||||
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);
|
||||
@ -3367,7 +3366,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
(*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. */
|
||||
@ -3382,11 +3381,12 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
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;
|
||||
}
|
||||
|
@ -1950,7 +1950,6 @@ static struct s390_unwind_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)
|
||||
@ -1963,18 +1962,19 @@ s390_frame_unwind_cache (struct frame_info *this_frame,
|
||||
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;
|
||||
}
|
||||
|
@ -820,7 +820,6 @@ enable_break (void)
|
||||
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;
|
||||
@ -834,10 +833,15 @@ enable_break (void)
|
||||
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 ();
|
||||
|
@ -539,7 +539,6 @@ enable_break2 (void)
|
||||
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. */
|
||||
@ -557,10 +556,15 @@ enable_break2 (void)
|
||||
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 ();
|
||||
|
@ -163,18 +163,20 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
|
||||
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;
|
||||
}
|
||||
@ -277,17 +279,19 @@ ia64_hpux_handle_dld_breakpoint_1 (ptid_t ptid)
|
||||
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
|
||||
|
@ -110,8 +110,7 @@ append_ocl_sos (struct so_list **link_ptr)
|
||||
{
|
||||
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,
|
||||
@ -134,7 +133,7 @@ append_ocl_sos (struct so_list **link_ptr)
|
||||
link_ptr = &newobj->next;
|
||||
}
|
||||
}
|
||||
if (ex.reason < 0)
|
||||
CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
/* Ignore memory errors. */
|
||||
switch (ex.error)
|
||||
@ -146,6 +145,7 @@ append_ocl_sos (struct so_list **link_ptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -874,15 +874,18 @@ solib_svr4_r_map (struct svr4_info *info)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2267,7 +2270,6 @@ enable_break (struct svr4_info *info, int from_tty)
|
||||
struct so_list *so;
|
||||
bfd *tmp_bfd = NULL;
|
||||
struct target_ops *tmp_bfd_target;
|
||||
volatile struct gdb_exception ex;
|
||||
|
||||
sym_addr = 0;
|
||||
|
||||
@ -2280,10 +2282,15 @@ enable_break (struct svr4_info *info, int from_tty)
|
||||
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;
|
||||
|
||||
|
60
gdb/solib.c
60
gdb/solib.c
@ -613,11 +613,10 @@ solib_read_symbols (struct so_list *so, int flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
volatile struct gdb_exception e;
|
||||
|
||||
flags |= current_inferior ()->symfile_flags;
|
||||
|
||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||
TRY
|
||||
{
|
||||
struct section_addr_info *sap;
|
||||
|
||||
@ -638,14 +637,17 @@ solib_read_symbols (struct so_list *so, int flags)
|
||||
NULL);
|
||||
so->objfile->addr_low = so->addr_low;
|
||||
free_section_addr_info (sap);
|
||||
}
|
||||
|
||||
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;
|
||||
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
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -814,12 +816,11 @@ update_solib_list (int from_tty, struct target_ops *target)
|
||||
/* 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))
|
||||
@ -830,10 +831,13 @@ update_solib_list (int from_tty, struct target_ops *target)
|
||||
}
|
||||
}
|
||||
|
||||
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. */
|
||||
@ -1320,17 +1324,25 @@ reload_shared_libraries_1 (int from_tty)
|
||||
&& (!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);
|
||||
}
|
||||
|
||||
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);
|
||||
CATCH (e, RETURN_MASK_ERROR)
|
||||
{
|
||||
exception_fprintf (gdb_stderr, e,
|
||||
_("Error while mapping "
|
||||
"shared library sections:\n"));
|
||||
got_error = 1;
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
if (!got_error
|
||||
&& (auto_solib_add || was_loaded || libpthread_solib_p (so)))
|
||||
solib_read_symbols (so, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user