Rewrite TRY/CATCH

This rewrites gdb's TRY/CATCH to plain C++ try/catch.  The patch was
largely written by script, though one change (to a comment in
common-exceptions.h) was reverted by hand.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* xml-support.c: Use C++ exception handling.
	* x86-linux-nat.c: Use C++ exception handling.
	* windows-nat.c: Use C++ exception handling.
	* varobj.c: Use C++ exception handling.
	* value.c: Use C++ exception handling.
	* valprint.c: Use C++ exception handling.
	* valops.c: Use C++ exception handling.
	* unittests/parse-connection-spec-selftests.c: Use C++ exception
	handling.
	* unittests/cli-utils-selftests.c: Use C++ exception handling.
	* typeprint.c: Use C++ exception handling.
	* tui/tui.c: Use C++ exception handling.
	* tracefile-tfile.c: Use C++ exception handling.
	* top.c: Use C++ exception handling.
	* thread.c: Use C++ exception handling.
	* target.c: Use C++ exception handling.
	* symmisc.c: Use C++ exception handling.
	* symfile-mem.c: Use C++ exception handling.
	* stack.c: Use C++ exception handling.
	* sparc64-linux-tdep.c: Use C++ exception handling.
	* solib.c: Use C++ exception handling.
	* solib-svr4.c: Use C++ exception handling.
	* solib-spu.c: Use C++ exception handling.
	* solib-frv.c: Use C++ exception handling.
	* solib-dsbt.c: Use C++ exception handling.
	* selftest-arch.c: Use C++ exception handling.
	* s390-tdep.c: Use C++ exception handling.
	* rust-lang.c: Use C++ exception handling.
	* rust-exp.y: Use C++ exception handling.
	* rs6000-tdep.c: Use C++ exception handling.
	* rs6000-aix-tdep.c: Use C++ exception handling.
	* riscv-tdep.c: Use C++ exception handling.
	* remote.c: Use C++ exception handling.
	* remote-fileio.c: Use C++ exception handling.
	* record-full.c: Use C++ exception handling.
	* record-btrace.c: Use C++ exception handling.
	* python/python.c: Use C++ exception handling.
	* python/py-value.c: Use C++ exception handling.
	* python/py-utils.c: Use C++ exception handling.
	* python/py-unwind.c: Use C++ exception handling.
	* python/py-type.c: Use C++ exception handling.
	* python/py-symbol.c: Use C++ exception handling.
	* python/py-record.c: Use C++ exception handling.
	* python/py-record-btrace.c: Use C++ exception handling.
	* python/py-progspace.c: Use C++ exception handling.
	* python/py-prettyprint.c: Use C++ exception handling.
	* python/py-param.c: Use C++ exception handling.
	* python/py-objfile.c: Use C++ exception handling.
	* python/py-linetable.c: Use C++ exception handling.
	* python/py-lazy-string.c: Use C++ exception handling.
	* python/py-infthread.c: Use C++ exception handling.
	* python/py-inferior.c: Use C++ exception handling.
	* python/py-gdb-readline.c: Use C++ exception handling.
	* python/py-framefilter.c: Use C++ exception handling.
	* python/py-frame.c: Use C++ exception handling.
	* python/py-finishbreakpoint.c: Use C++ exception handling.
	* python/py-cmd.c: Use C++ exception handling.
	* python/py-breakpoint.c: Use C++ exception handling.
	* python/py-arch.c: Use C++ exception handling.
	* printcmd.c: Use C++ exception handling.
	* ppc-linux-tdep.c: Use C++ exception handling.
	* parse.c: Use C++ exception handling.
	* p-valprint.c: Use C++ exception handling.
	* objc-lang.c: Use C++ exception handling.
	* mi/mi-main.c: Use C++ exception handling.
	* mi/mi-interp.c: Use C++ exception handling.
	* mi/mi-cmd-stack.c: Use C++ exception handling.
	* mi/mi-cmd-break.c: Use C++ exception handling.
	* main.c: Use C++ exception handling.
	* linux-thread-db.c: Use C++ exception handling.
	* linux-tdep.c: Use C++ exception handling.
	* linux-nat.c: Use C++ exception handling.
	* linux-fork.c: Use C++ exception handling.
	* linespec.c: Use C++ exception handling.
	* language.c: Use C++ exception handling.
	* jit.c: Use C++ exception handling.
	* infrun.c: Use C++ exception handling.
	* infcmd.c: Use C++ exception handling.
	* infcall.c: Use C++ exception handling.
	* inf-loop.c: Use C++ exception handling.
	* i386-tdep.c: Use C++ exception handling.
	* i386-linux-tdep.c: Use C++ exception handling.
	* guile/scm-value.c: Use C++ exception handling.
	* guile/scm-type.c: Use C++ exception handling.
	* guile/scm-symtab.c: Use C++ exception handling.
	* guile/scm-symbol.c: Use C++ exception handling.
	* guile/scm-pretty-print.c: Use C++ exception handling.
	* guile/scm-ports.c: Use C++ exception handling.
	* guile/scm-param.c: Use C++ exception handling.
	* guile/scm-math.c: Use C++ exception handling.
	* guile/scm-lazy-string.c: Use C++ exception handling.
	* guile/scm-frame.c: Use C++ exception handling.
	* guile/scm-disasm.c: Use C++ exception handling.
	* guile/scm-cmd.c: Use C++ exception handling.
	* guile/scm-breakpoint.c: Use C++ exception handling.
	* guile/scm-block.c: Use C++ exception handling.
	* guile/guile-internal.h: Use C++ exception handling.
	* gnu-v3-abi.c: Use C++ exception handling.
	* gdbtypes.c: Use C++ exception handling.
	* frame.c: Use C++ exception handling.
	* frame-unwind.c: Use C++ exception handling.
	* fbsd-tdep.c: Use C++ exception handling.
	* f-valprint.c: Use C++ exception handling.
	* exec.c: Use C++ exception handling.
	* event-top.c: Use C++ exception handling.
	* event-loop.c: Use C++ exception handling.
	* eval.c: Use C++ exception handling.
	* dwarf2read.c: Use C++ exception handling.
	* dwarf2loc.c: Use C++ exception handling.
	* dwarf2-frame.c: Use C++ exception handling.
	* dwarf2-frame-tailcall.c: Use C++ exception handling.
	* dwarf-index-write.c: Use C++ exception handling.
	* dwarf-index-cache.c: Use C++ exception handling.
	* dtrace-probe.c: Use C++ exception handling.
	* disasm-selftests.c: Use C++ exception handling.
	* darwin-nat.c: Use C++ exception handling.
	* cp-valprint.c: Use C++ exception handling.
	* cp-support.c: Use C++ exception handling.
	* cp-abi.c: Use C++ exception handling.
	* corelow.c: Use C++ exception handling.
	* completer.c: Use C++ exception handling.
	* compile/compile-object-run.c: Use C++ exception handling.
	* compile/compile-object-load.c: Use C++ exception handling.
	* compile/compile-cplus-symbols.c: Use C++ exception handling.
	* compile/compile-c-symbols.c: Use C++ exception handling.
	* common/selftest.c: Use C++ exception handling.
	* common/new-op.c: Use C++ exception handling.
	* cli/cli-script.c: Use C++ exception handling.
	* cli/cli-interp.c: Use C++ exception handling.
	* cli/cli-cmds.c: Use C++ exception handling.
	* c-varobj.c: Use C++ exception handling.
	* btrace.c: Use C++ exception handling.
	* breakpoint.c: Use C++ exception handling.
	* break-catch-throw.c: Use C++ exception handling.
	* arch-utils.c: Use C++ exception handling.
	* amd64-tdep.c: Use C++ exception handling.
	* ada-valprint.c: Use C++ exception handling.
	* ada-typeprint.c: Use C++ exception handling.
	* ada-lang.c: Use C++ exception handling.
	* aarch64-tdep.c: Use C++ exception handling.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* server.c: Use C++ exception handling.
	* linux-low.c: Use C++ exception handling.
	* gdbreplay.c: Use C++ exception handling.
This commit is contained in:
Tom Tromey 2019-04-03 16:02:42 -06:00
parent 3d6e9d2336
commit a70b814420
144 changed files with 1033 additions and 1326 deletions

View File

@ -1,3 +1,146 @@
2019-04-08 Tom Tromey <tom@tromey.com>
* xml-support.c: Use C++ exception handling.
* x86-linux-nat.c: Use C++ exception handling.
* windows-nat.c: Use C++ exception handling.
* varobj.c: Use C++ exception handling.
* value.c: Use C++ exception handling.
* valprint.c: Use C++ exception handling.
* valops.c: Use C++ exception handling.
* unittests/parse-connection-spec-selftests.c: Use C++ exception
handling.
* unittests/cli-utils-selftests.c: Use C++ exception handling.
* typeprint.c: Use C++ exception handling.
* tui/tui.c: Use C++ exception handling.
* tracefile-tfile.c: Use C++ exception handling.
* top.c: Use C++ exception handling.
* thread.c: Use C++ exception handling.
* target.c: Use C++ exception handling.
* symmisc.c: Use C++ exception handling.
* symfile-mem.c: Use C++ exception handling.
* stack.c: Use C++ exception handling.
* sparc64-linux-tdep.c: Use C++ exception handling.
* solib.c: Use C++ exception handling.
* solib-svr4.c: Use C++ exception handling.
* solib-spu.c: Use C++ exception handling.
* solib-frv.c: Use C++ exception handling.
* solib-dsbt.c: Use C++ exception handling.
* selftest-arch.c: Use C++ exception handling.
* s390-tdep.c: Use C++ exception handling.
* rust-lang.c: Use C++ exception handling.
* rust-exp.y: Use C++ exception handling.
* rs6000-tdep.c: Use C++ exception handling.
* rs6000-aix-tdep.c: Use C++ exception handling.
* riscv-tdep.c: Use C++ exception handling.
* remote.c: Use C++ exception handling.
* remote-fileio.c: Use C++ exception handling.
* record-full.c: Use C++ exception handling.
* record-btrace.c: Use C++ exception handling.
* python/python.c: Use C++ exception handling.
* python/py-value.c: Use C++ exception handling.
* python/py-utils.c: Use C++ exception handling.
* python/py-unwind.c: Use C++ exception handling.
* python/py-type.c: Use C++ exception handling.
* python/py-symbol.c: Use C++ exception handling.
* python/py-record.c: Use C++ exception handling.
* python/py-record-btrace.c: Use C++ exception handling.
* python/py-progspace.c: Use C++ exception handling.
* python/py-prettyprint.c: Use C++ exception handling.
* python/py-param.c: Use C++ exception handling.
* python/py-objfile.c: Use C++ exception handling.
* python/py-linetable.c: Use C++ exception handling.
* python/py-lazy-string.c: Use C++ exception handling.
* python/py-infthread.c: Use C++ exception handling.
* python/py-inferior.c: Use C++ exception handling.
* python/py-gdb-readline.c: Use C++ exception handling.
* python/py-framefilter.c: Use C++ exception handling.
* python/py-frame.c: Use C++ exception handling.
* python/py-finishbreakpoint.c: Use C++ exception handling.
* python/py-cmd.c: Use C++ exception handling.
* python/py-breakpoint.c: Use C++ exception handling.
* python/py-arch.c: Use C++ exception handling.
* printcmd.c: Use C++ exception handling.
* ppc-linux-tdep.c: Use C++ exception handling.
* parse.c: Use C++ exception handling.
* p-valprint.c: Use C++ exception handling.
* objc-lang.c: Use C++ exception handling.
* mi/mi-main.c: Use C++ exception handling.
* mi/mi-interp.c: Use C++ exception handling.
* mi/mi-cmd-stack.c: Use C++ exception handling.
* mi/mi-cmd-break.c: Use C++ exception handling.
* main.c: Use C++ exception handling.
* linux-thread-db.c: Use C++ exception handling.
* linux-tdep.c: Use C++ exception handling.
* linux-nat.c: Use C++ exception handling.
* linux-fork.c: Use C++ exception handling.
* linespec.c: Use C++ exception handling.
* language.c: Use C++ exception handling.
* jit.c: Use C++ exception handling.
* infrun.c: Use C++ exception handling.
* infcmd.c: Use C++ exception handling.
* infcall.c: Use C++ exception handling.
* inf-loop.c: Use C++ exception handling.
* i386-tdep.c: Use C++ exception handling.
* i386-linux-tdep.c: Use C++ exception handling.
* guile/scm-value.c: Use C++ exception handling.
* guile/scm-type.c: Use C++ exception handling.
* guile/scm-symtab.c: Use C++ exception handling.
* guile/scm-symbol.c: Use C++ exception handling.
* guile/scm-pretty-print.c: Use C++ exception handling.
* guile/scm-ports.c: Use C++ exception handling.
* guile/scm-param.c: Use C++ exception handling.
* guile/scm-math.c: Use C++ exception handling.
* guile/scm-lazy-string.c: Use C++ exception handling.
* guile/scm-frame.c: Use C++ exception handling.
* guile/scm-disasm.c: Use C++ exception handling.
* guile/scm-cmd.c: Use C++ exception handling.
* guile/scm-breakpoint.c: Use C++ exception handling.
* guile/scm-block.c: Use C++ exception handling.
* guile/guile-internal.h: Use C++ exception handling.
* gnu-v3-abi.c: Use C++ exception handling.
* gdbtypes.c: Use C++ exception handling.
* frame.c: Use C++ exception handling.
* frame-unwind.c: Use C++ exception handling.
* fbsd-tdep.c: Use C++ exception handling.
* f-valprint.c: Use C++ exception handling.
* exec.c: Use C++ exception handling.
* event-top.c: Use C++ exception handling.
* event-loop.c: Use C++ exception handling.
* eval.c: Use C++ exception handling.
* dwarf2read.c: Use C++ exception handling.
* dwarf2loc.c: Use C++ exception handling.
* dwarf2-frame.c: Use C++ exception handling.
* dwarf2-frame-tailcall.c: Use C++ exception handling.
* dwarf-index-write.c: Use C++ exception handling.
* dwarf-index-cache.c: Use C++ exception handling.
* dtrace-probe.c: Use C++ exception handling.
* disasm-selftests.c: Use C++ exception handling.
* darwin-nat.c: Use C++ exception handling.
* cp-valprint.c: Use C++ exception handling.
* cp-support.c: Use C++ exception handling.
* cp-abi.c: Use C++ exception handling.
* corelow.c: Use C++ exception handling.
* completer.c: Use C++ exception handling.
* compile/compile-object-run.c: Use C++ exception handling.
* compile/compile-object-load.c: Use C++ exception handling.
* compile/compile-cplus-symbols.c: Use C++ exception handling.
* compile/compile-c-symbols.c: Use C++ exception handling.
* common/selftest.c: Use C++ exception handling.
* common/new-op.c: Use C++ exception handling.
* cli/cli-script.c: Use C++ exception handling.
* cli/cli-interp.c: Use C++ exception handling.
* cli/cli-cmds.c: Use C++ exception handling.
* c-varobj.c: Use C++ exception handling.
* btrace.c: Use C++ exception handling.
* breakpoint.c: Use C++ exception handling.
* break-catch-throw.c: Use C++ exception handling.
* arch-utils.c: Use C++ exception handling.
* amd64-tdep.c: Use C++ exception handling.
* ada-valprint.c: Use C++ exception handling.
* ada-typeprint.c: Use C++ exception handling.
* ada-lang.c: Use C++ exception handling.
* aarch64-tdep.c: Use C++ exception handling.
2019-04-08 Tom Tromey <tom@tromey.com>
* xml-support.c (gdb_xml_parser::parse): Update.

View File

@ -874,16 +874,15 @@ aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
TRY
try
{
aarch64_make_prologue_cache_1 (this_frame, cache);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}
@ -1006,19 +1005,18 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
TRY
try
{
cache->prev_sp = get_frame_register_unsigned (this_frame,
AARCH64_SP_REGNUM);
cache->prev_pc = get_frame_pc (this_frame);
cache->available_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}

View File

@ -6723,16 +6723,15 @@ 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
try
{
offset_to_top = value_as_long (value_ind (value_ptradd (val, -2)));
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
return obj;
}
END_CATCH
/* If offset is null, nothing to do. */
@ -6869,17 +6868,16 @@ 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
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)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
}
END_CATCH
return name;
}
@ -9054,11 +9052,11 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
LONGEST size;
xsnprintf (xvz_name, strlen (name) + 7, "%s___XVZ", name);
TRY
try
{
xvz_found = get_int_var_value (xvz_name, size);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
/* We found the variable, but somehow failed to read
its value. Rethrow the same error, but with a little
@ -9069,7 +9067,6 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
_("unable to read value of %s (%s)"),
xvz_name, except.what ());
}
END_CATCH
if (xvz_found && TYPE_LENGTH (fixed_record_type) != size)
{
@ -12346,15 +12343,14 @@ ada_exception_message (void)
{
gdb::unique_xmalloc_ptr<char> e_msg;
TRY
try
{
e_msg = ada_exception_message_1 ();
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
e_msg.reset (nullptr);
}
END_CATCH
return e_msg;
}
@ -12370,17 +12366,16 @@ ada_exception_name_addr (enum ada_exception_catchpoint_kind ex,
{
CORE_ADDR result = 0;
TRY
try
{
result = ada_exception_name_addr_1 (ex, b);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
warning (_("failed to get exception name: %s"), e.what ());
return 0;
}
END_CATCH
return result;
}
@ -12461,19 +12456,18 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
const char *s;
s = cond_string.c_str ();
TRY
try
{
exp = parse_exp_1 (&s, bl->address,
block_for_pc (bl->address),
0);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
warning (_("failed to reevaluate internal exception condition "
"for catchpoint %d: %s"),
c->number, e.what ());
}
END_CATCH
}
ada_loc->excep_cond_expr = std::move (exp);
@ -12531,7 +12525,7 @@ should_stop_exception (const struct bp_location *bl)
}
stop = 1;
TRY
try
{
struct value *mark;
@ -12539,12 +12533,11 @@ should_stop_exception (const struct bp_location *bl)
stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
value_free_to_mark (mark);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
_("Error in testing exception condition:\n"));
}
END_CATCH
return stop;
}

View File

@ -163,12 +163,12 @@ print_range (struct type *type, struct ui_file *stream,
LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
int got_error = 0;
TRY
try
{
lo = ada_discrete_type_low_bound (type);
hi = ada_discrete_type_high_bound (type);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
/* This can happen when the range is dynamic. Sometimes,
resolving dynamic property values requires us to have
@ -178,7 +178,6 @@ print_range (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "<>");
got_error = 1;
}
END_CATCH
if (!got_error)
{

View File

@ -1203,18 +1203,17 @@ ada_val_print (struct type *type,
struct value *val,
const struct value_print_options *options)
{
TRY
try
{
ada_val_print_1 (type, embedded_offset, address,
stream, recurse, val, options,
current_language);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
fprintf_filtered (stream, _("<error reading variable: %s>"),
except.what ());
}
END_CATCH
}
void

View File

@ -2581,16 +2581,15 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
TRY
try
{
amd64_frame_cache_1 (this_frame, cache);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}
@ -2699,7 +2698,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = amd64_alloc_frame_cache ();
TRY
try
{
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8;
@ -2713,12 +2712,11 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
*this_cache = cache;
return cache;
@ -2876,7 +2874,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
TRY
try
{
/* Cache base will be %esp plus cache->sp_offset (-8). */
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
@ -2894,12 +2892,11 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}

View File

@ -969,13 +969,12 @@ gdbarch_skip_prologue_noexcept (gdbarch *gdbarch, CORE_ADDR pc) noexcept
{
CORE_ADDR new_pc = pc;
TRY
try
{
new_pc = gdbarch_skip_prologue (gdbarch, pc);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{}
END_CATCH
return new_pc;
}

View File

@ -154,7 +154,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
if (self->pattern == NULL)
return;
TRY
try
{
struct value *typeinfo_arg;
std::string canon;
@ -166,11 +166,10 @@ check_status_exception_catchpoint (struct bpstats *bs)
if (!canon.empty ())
std::swap (type_name, canon);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
exception_print (gdb_stderr, e);
}
END_CATCH
if (!type_name.empty ())
{
@ -189,17 +188,17 @@ re_set_exception_catchpoint (struct breakpoint *self)
struct program_space *filter_pspace = current_program_space;
/* We first try to use the probe interface. */
TRY
try
{
event_location_up location
= new_probe_location (exception_functions[kind].probe);
sals = parse_probes (location.get (), filter_pspace, NULL);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
/* Using the probe interface failed. Let's fallback to the normal
catchpoint mode. */
TRY
try
{
struct explicit_location explicit_loc;
@ -210,16 +209,14 @@ re_set_exception_catchpoint (struct breakpoint *self)
sals = self->ops->decode_location (self, location.get (),
filter_pspace);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
/* 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
update_breakpoint_locations (self, filter_pspace, sals, {});
}

View File

@ -2097,18 +2097,17 @@ parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
/* We don't want to stop processing, so catch any errors
that may show up. */
TRY
try
{
aexpr = gen_eval_for_expr (scope, cond);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
/* 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. */
}
END_CATCH
/* We have a valid agent expression. */
return aexpr;
@ -2272,19 +2271,18 @@ 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
try
{
aexpr = gen_printf (scope, gdbarch, 0, 0,
format_start, format_end - format_start,
argvec.size (), argvec.data ());
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
/* 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. */
}
END_CATCH
/* We have a valid agent expression, return it. */
return aexpr;
@ -2539,7 +2537,7 @@ insert_bp_location (struct bp_location *bl,
|| !(section_is_overlay (bl->section)))
{
/* No overlay handling: just set the breakpoint. */
TRY
try
{
int val;
@ -2547,11 +2545,10 @@ insert_bp_location (struct bp_location *bl,
if (val)
bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
bp_excpt = e;
}
END_CATCH
}
else
{
@ -2574,7 +2571,7 @@ insert_bp_location (struct bp_location *bl,
bl->overlay_target_info.reqstd_address = addr;
/* No overlay handling: just set the breakpoint. */
TRY
try
{
int val;
@ -2587,11 +2584,10 @@ insert_bp_location (struct bp_location *bl,
bp_excpt
= gdb_exception {RETURN_ERROR, GENERIC_ERROR};
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
bp_excpt = e;
}
END_CATCH
if (bp_excpt.reason != 0)
fprintf_unfiltered (tmp_error_stream,
@ -2604,7 +2600,7 @@ insert_bp_location (struct bp_location *bl,
if (section_is_mapped (bl->section))
{
/* Yes. This overlay section is mapped into memory. */
TRY
try
{
int val;
@ -2612,11 +2608,10 @@ insert_bp_location (struct bp_location *bl,
if (val)
bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
bp_excpt = e;
}
END_CATCH
}
else
{
@ -5017,11 +5012,11 @@ bpstat_check_watchpoint (bpstat bs)
{
wp_check_result e;
TRY
try
{
e = watchpoint_check (bs);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
"Error evaluating expression "
@ -5036,7 +5031,6 @@ bpstat_check_watchpoint (bpstat bs)
watchpoint_del_at_next_stop (b);
e = WP_DELETED;
}
END_CATCH
switch (e)
{
@ -5255,16 +5249,15 @@ bpstat_check_breakpoint_conditions (bpstat bs, thread_info *thread)
}
if (within_current_scope)
{
TRY
try
{
condition_result = breakpoint_cond_eval (cond);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
"Error in testing breakpoint condition:\n");
}
END_CATCH
}
else
{
@ -9246,11 +9239,11 @@ create_breakpoint (struct gdbarch *gdbarch,
if (extra_string != NULL && *extra_string == '\0')
extra_string = NULL;
TRY
try
{
ops->create_sals_from_location (location, &canonical, type_wanted);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
/* If caller is interested in rc value from parse, set
value. */
@ -9280,7 +9273,6 @@ create_breakpoint (struct gdbarch *gdbarch,
else
throw_exception (e);
}
END_CATCH
if (!pending && canonical.lsals.empty ())
return 0;
@ -12060,14 +12052,13 @@ static void
update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
{
TRY
try
{
update_global_location_list (insert_mode);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
}
END_CATCH
}
/* Clear BKP from a BPS. */
@ -13529,20 +13520,19 @@ update_breakpoint_locations (struct breakpoint *b,
const char *s;
s = b->cond_string;
TRY
try
{
new_loc->cond = parse_exp_1 (&s, sal.pc,
block_for_pc (sal.pc),
0);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
warning (_("failed to reevaluate condition "
"for breakpoint %d: %s"),
b->number, e.what ());
new_loc->enabled = 0;
}
END_CATCH
}
if (!sals_end.empty ())
@ -13609,11 +13599,11 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
std::vector<symtab_and_line> sals;
TRY
try
{
sals = b->ops->decode_location (b, location, search_pspace);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
int not_found_and_ok = 0;
@ -13648,7 +13638,6 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
throw_exception (e);
}
}
END_CATCH
if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
{
@ -13820,17 +13809,16 @@ breakpoint_re_set (void)
ALL_BREAKPOINTS_SAFE (b, b_tmp)
{
TRY
try
{
breakpoint_re_set_one (b);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
"Error in re-setting breakpoint %d: ",
b->number);
}
END_CATCH
}
jit_breakpoint_re_set ();
@ -14297,7 +14285,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
/* Initialize it just to avoid a GCC false warning. */
enum enable_state orig_enable_state = bp_disabled;
TRY
try
{
struct watchpoint *w = (struct watchpoint *) bpt;
@ -14305,14 +14293,13 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
bpt->enable_state = bp_enabled;
update_watchpoint (w, 1 /* reparse */);
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
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;
@ -15040,16 +15027,15 @@ save_breakpoints (const char *filename, int from_tty,
fp.puts (" commands\n");
current_uiout->redirect (&fp);
TRY
try
{
print_command_lines (current_uiout, tp->commands.get (), 2);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
current_uiout->redirect (NULL);
throw_exception (ex);
}
END_CATCH
current_uiout->redirect (NULL);
fp.puts (" end\n");

View File

@ -678,7 +678,7 @@ ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
enum btrace_insn_class iclass;
iclass = BTRACE_INSN_OTHER;
TRY
try
{
if (gdbarch_insn_is_call (gdbarch, pc))
iclass = BTRACE_INSN_CALL;
@ -687,10 +687,9 @@ 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)
catch (const gdb_exception_RETURN_MASK_ERROR &error)
{
}
END_CATCH
return iclass;
}
@ -1103,14 +1102,13 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
level = std::min (level, bfun->level);
size = 0;
TRY
try
{
size = gdb_insn_length (gdbarch, pc);
}
CATCH (error, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &error)
{
}
END_CATCH
insn.pc = pc;
insn.size = size;
@ -1370,17 +1368,16 @@ btrace_pt_readmem_callback (gdb_byte *buffer, size_t size,
int result, errcode;
result = (int) size;
TRY
try
{
errcode = target_read_code ((CORE_ADDR) pc, buffer, size);
if (errcode != 0)
result = -pte_nomap;
}
CATCH (error, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &error)
{
result = -pte_nomap;
}
END_CATCH
return result;
}
@ -1464,7 +1461,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
if (decoder == NULL)
error (_("Failed to allocate the Intel Processor Trace decoder."));
TRY
try
{
struct pt_image *image;
@ -1479,7 +1476,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
ftrace_add_pt (btinfo, decoder, &level, gaps);
}
CATCH (error, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &error)
{
/* Indicate a gap in the trace if we quit trace processing. */
if (error.reason == RETURN_QUIT && !btinfo->functions.empty ())
@ -1489,7 +1486,6 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
throw_exception (error);
}
END_CATCH
btrace_finalize_ftrace_pt (decoder, tp, level);
}
@ -1556,17 +1552,16 @@ btrace_compute_ftrace (struct thread_info *tp, struct btrace_data *btrace,
{
std::vector<unsigned int> gaps;
TRY
try
{
btrace_compute_ftrace_1 (tp, btrace, cpu, gaps);
}
CATCH (error, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &error)
{
btrace_finalize_ftrace (tp, gaps);
throw_exception (error);
}
END_CATCH
btrace_finalize_ftrace (tp, gaps);
}
@ -1617,7 +1612,7 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
return;
/* We need to undo the enable in case of errors. */
TRY
try
{
/* Add an entry for the current PC so we start tracing from where we
enabled it.
@ -1632,13 +1627,12 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
&& can_access_registers_thread (tp))
btrace_add_pc (tp);
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
btrace_disable (tp);
throw_exception (exception);
}
END_CATCH
}
/* See btrace.h. */
@ -3062,18 +3056,17 @@ btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
if (decoder == NULL)
error (_("Failed to allocate the Intel Processor Trace decoder."));
TRY
try
{
btrace_maint_decode_pt (&btinfo->maint, decoder);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
pt_pkt_free_decoder (decoder);
if (except.reason < 0)
throw_exception (except);
}
END_CATCH
pt_pkt_free_decoder (decoder);
}

View File

@ -92,16 +92,15 @@ adjust_value_for_child_access (struct value **value,
if (value && *value)
{
TRY
try
{
*value = value_ind (*value);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
*value = NULL;
}
END_CATCH
}
*type = target_type;
if (was_ptr)
@ -253,18 +252,17 @@ 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
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);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
return NULL;
}
END_CATCH
return result;
}
@ -316,14 +314,13 @@ c_describe_child (const struct varobj *parent, int index,
{
int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
TRY
try
{
*cvalue = value_subscript (value, real_index);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
}
END_CATCH
}
if (ctype)
@ -393,16 +390,15 @@ c_describe_child (const struct varobj *parent, int index,
if (cvalue && value)
{
TRY
try
{
*cvalue = value_ind (value);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
*cvalue = NULL;
}
END_CATCH
}
/* Don't use get_target_type because it calls

View File

@ -250,7 +250,7 @@ complete_command (const char *arg, int from_tty)
int quote_char = '\0';
const char *word;
TRY
try
{
word = completion_find_completion_word (tracker_handle_brkchars,
arg, &quote_char);
@ -267,11 +267,10 @@ complete_command (const char *arg, int from_tty)
tracker = &tracker_handle_completions;
}
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
return;
}
END_CATCH
std::string arg_prefix (arg, word - arg);

View File

@ -363,15 +363,14 @@ safe_execute_command (struct ui_out *command_uiout, const char *command,
scoped_restore saved_uiout = make_scoped_restore (&current_uiout,
command_uiout);
TRY
try
{
execute_command (command, from_tty);
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
e = exception;
}
END_CATCH
/* FIXME: cagney/2005-01-13: This shouldn't be needed. Instead the
caller should print the exception. */

View File

@ -1050,16 +1050,15 @@ process_next_line (const char *p, struct command_line **command,
if (validator)
{
TRY
try
{
validator ((*command)->line);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
free_command_lines (command);
throw_exception (ex);
}
END_CATCH
}
/* Nothing special. */
@ -1540,11 +1539,11 @@ script_from_file (FILE *stream, const char *file)
scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
TRY
try
{
read_command_file (stream);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
/* Re-throw the error, but with the file name information
prepended. */
@ -1553,7 +1552,6 @@ script_from_file (FILE *stream, const char *file)
source_file_name.c_str (), source_line_number,
e.what ());
}
END_CATCH
}
/* Print the definition of user command C to STREAM. Or, if C is a

View File

@ -60,15 +60,14 @@ operator new (std::size_t sz)
QUIT gdb_exception. This is necessary because operator new
can only ever throw std::bad_alloc, or something that extends
it. */
TRY
try
{
malloc_failure (sz);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
throw gdb_quit_bad_alloc (ex);
}
END_CATCH
}
return p;
}

View File

@ -81,18 +81,17 @@ run_tests (const char *filter)
&& name.find (filter) == std::string::npos)
continue;
TRY
try
{
debug_printf (_("Running selftest %s.\n"), name.c_str ());
++ran;
(*test) ();
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
++failed;
debug_printf ("Self test failed: %s\n", ex.what ());
}
END_CATCH
reset ();
}

View File

@ -344,7 +344,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
try
{
struct block_symbol sym;
@ -367,11 +367,10 @@ gcc_convert_symbol (void *datum,
}
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
context->plugin ().error (e.what ());
}
END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdlog,
@ -393,7 +392,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
TRY
try
{
struct symbol *sym;
@ -430,11 +429,10 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
}
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
context->plugin ().error (e.what ());
}
END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdlog,
@ -548,7 +546,7 @@ generate_c_for_for_one_variable (compile_instance *compiler,
struct symbol *sym)
{
TRY
try
{
if (is_dynamic_type (SYMBOL_TYPE (sym)))
{
@ -600,11 +598,10 @@ generate_c_for_for_one_variable (compile_instance *compiler,
}
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
compiler->insert_symbol_error (sym, e.what ());
}
END_CATCH
}
/* See compile-c.h. */

View File

@ -343,7 +343,7 @@ gcc_cplus_convert_symbol (void *datum,
bool found = false;
compile_cplus_instance *instance = (compile_cplus_instance *) datum;
TRY
try
{
/* Symbol searching is a three part process unfortunately. */
@ -388,13 +388,12 @@ gcc_cplus_convert_symbol (void *datum,
}
}
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
instance->plugin ().error (e.what ());
}
END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdlog,
@ -431,7 +430,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
TRY
try
{
struct symbol *sym
= lookup_symbol (identifier, nullptr, VAR_DOMAIN, nullptr).symbol;
@ -467,11 +466,10 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
}
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
instance->plugin ().error (e.what ());
}
END_CATCH
if (compile_debug && !found)
fprintf_unfiltered (gdb_stdlog,

View File

@ -50,16 +50,15 @@ munmap_list::~munmap_list ()
{
for (auto &item : items)
{
TRY
try
{
gdbarch_infcall_munmap (target_gdbarch (), item.addr, item.size);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
/* There's not much the user can do, so just ignore
this. */
}
END_CATCH
}
}

View File

@ -137,7 +137,7 @@ compile_object_run (struct compile_module *module)
xfree (module);
module = NULL;
TRY
try
{
struct type *func_type = SYMBOL_TYPE (func_sym);
htab_t copied_types;
@ -173,7 +173,7 @@ compile_object_run (struct compile_module *module)
call_function_by_hand_dummy (func_val, NULL, args,
do_module_cleanup, data);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
/* In the case of DTOR_FOUND or in the case of EXECUTED nothing
needs to be done. */
@ -185,7 +185,6 @@ compile_object_run (struct compile_module *module)
do_module_cleanup (data, 0);
throw_exception (ex);
}
END_CATCH
dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
gdb_assert (!dtor_found && executed);

View File

@ -1021,15 +1021,14 @@ complete_expression (completion_tracker &tracker,
/* Perform a tentative parse of the expression, to see whether a
field completion is required. */
TRY
try
{
type = parse_expression_for_completion (text, &fieldname, &code);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
return;
}
END_CATCH
if (fieldname != nullptr && type)
{
@ -1445,16 +1444,15 @@ complete_line_internal (completion_tracker &tracker,
const char *line_buffer, int point,
complete_line_internal_reason reason)
{
TRY
try
{
complete_line_internal_1 (tracker, text, line_buffer, point, reason);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
throw_exception (except);
}
END_CATCH
}
/* See completer.h. */
@ -1859,17 +1857,16 @@ gdb_completion_word_break_characters ()
/* New completion starting. */
current_completion.aborted = false;
TRY
try
{
return gdb_completion_word_break_characters_throw ();
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
/* Set this to that gdb_rl_attempted_completion_function knows
to abort early. */
current_completion.aborted = true;
}
END_CATCH
return NULL;
}
@ -2207,14 +2204,13 @@ gdb_rl_attempted_completion_function (const char *text, int start, int end)
if (current_completion.aborted)
return NULL;
TRY
try
{
return gdb_rl_attempted_completion_function_throw (text, start, end);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
}
END_CATCH
return NULL;
}

View File

@ -461,16 +461,15 @@ core_target_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
try
{
target_update_thread_list ();
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
exception_print (gdb_stderr, except);
}
END_CATCH
p = bfd_core_file_failing_command (core_bfd);
if (p)
@ -517,15 +516,14 @@ core_target_open (const char *arg, int from_tty)
anything about threads. That is why the test is >= 2. */
if (thread_count () >= 2)
{
TRY
try
{
thread_command (NULL, from_tty);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
exception_print (gdb_stderr, except);
}
END_CATCH
}
}

View File

@ -73,13 +73,13 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
gdb_assert (current_cp_abi.baseclass_offset != NULL);
TRY
try
{
res = (*current_cp_abi.baseclass_offset) (type, index, valaddr,
embedded_offset,
address, val);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
@ -88,7 +88,6 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
_("Cannot determine virtual baseclass offset "
"of incomplete object"));
}
END_CATCH
return res;
}
@ -112,15 +111,14 @@ value_rtti_type (struct value *v, int *full,
if ((current_cp_abi.rtti_type) == NULL)
return NULL;
TRY
try
{
ret = (*current_cp_abi.rtti_type) (v, full, top, using_enc);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
return NULL;
}
END_CATCH
return ret;
}

View File

@ -151,15 +151,14 @@ inspect_type (struct demangle_parse_info *info,
sym = NULL;
TRY
try
{
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0).symbol;
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
return 0;
}
END_CATCH
if (sym != NULL)
{
@ -223,17 +222,16 @@ inspect_type (struct demangle_parse_info *info,
}
string_file buf;
TRY
try
{
type_print (type, "", &buf, -1);
}
/* If type_print threw an exception, there is little point
in continuing, so just bow out gracefully. */
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
return 0;
}
END_CATCH
len = buf.size ();
name = (char *) obstack_copy0 (&info->obstack, buf.c_str (), len);
@ -424,15 +422,14 @@ replace_typedefs (struct demangle_parse_info *info,
struct symbol *sym = NULL;
sym = NULL;
TRY
try
{
sym = lookup_symbol (local_name.get (), 0,
VAR_DOMAIN, 0).symbol;
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
}
END_CATCH
if (sym != NULL)
{

View File

@ -320,18 +320,17 @@ cp_print_value_fields (struct type *type, struct type *real_type,
{
struct value *v = NULL;
TRY
try
{
v = value_static_field (type, i);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
fprintf_filtered (stream,
_("<error reading variable: %s>"),
ex.what ());
}
END_CATCH
cp_print_static_field (TYPE_FIELD_TYPE (type, i),
v, stream, recurse + 1,
@ -509,18 +508,17 @@ cp_print_value (struct type *type, struct type *real_type,
thisoffset = offset;
thistype = real_type;
TRY
try
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
skip = -1;
else
skip = 1;
}
END_CATCH
if (skip == 0)
{

View File

@ -1611,7 +1611,7 @@ darwin_attach_pid (struct inferior *inf)
darwin_inferior *priv = new darwin_inferior;
inf->priv.reset (priv);
TRY
try
{
kret = task_for_pid (gdb_task, inf->pid, &priv->task);
if (kret != KERN_SUCCESS)
@ -1688,14 +1688,13 @@ darwin_attach_pid (struct inferior *inf)
darwin_setup_exceptions (inf);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exit_inferior (inf);
inferior_ptid = null_ptid;
throw_exception (ex);
}
END_CATCH
target_ops *darwin_ops = get_native_target ();
if (!target_is_pushed (darwin_ops))
@ -1949,11 +1948,11 @@ The error was: %s"),
/* Maybe it was cached by some earlier gdb. */
if (stat (new_name.c_str (), &sb) != 0 || !S_ISREG (sb.st_mode))
{
TRY
try
{
copy_shell_to_cache (shell, new_name);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
warning (_("This version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb tried to work around SIP by\n\
@ -1965,7 +1964,6 @@ you \"run\". To prevent these attempts, you can use:\n\
ex.what ());
return false;
}
END_CATCH
printf_filtered (_("Note: this version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb has worked around this by\n\

View File

@ -192,16 +192,15 @@ memory_error_test (struct gdbarch *gdbarch)
gdb_disassembler_test di (gdbarch);
bool saw_memory_error = false;
TRY
try
{
di.print_insn (0);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == MEMORY_ERROR)
saw_memory_error = true;
}
END_CATCH
/* Expect MEMORY_ERROR. */
SELF_CHECK (saw_memory_error);

View File

@ -484,15 +484,14 @@ dtrace_process_dof_probe (struct objfile *objfile,
int'. */
struct type *type = builtin_type (gdbarch)->builtin_long;
TRY
try
{
expr = parse_expression_with_language (type_str.c_str (),
language_c);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
}
END_CATCH
if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE)
type = expr.get ()->elts[1].type;

View File

@ -110,7 +110,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
std::string build_id_str = build_id_to_string (build_id);
TRY
try
{
/* Try to create the containing directory. */
if (!mkdir_recursive (m_dir.c_str ()))
@ -129,13 +129,12 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
write_psymtabs_to_index (dwarf2_per_objfile, m_dir.c_str (),
build_id_str.c_str (), dw_index_kind::GDB_INDEX);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (debug_index_cache)
printf_unfiltered ("index cache: couldn't store index cache for objfile "
"%s: %s", objfile_name (obj), except.what ());
}
END_CATCH
}
#if HAVE_SYS_MMAN_H
@ -172,7 +171,7 @@ index_cache::lookup_gdb_index (const bfd_build_id *build_id,
/* Compute where we would expect a gdb index file for this build id to be. */
std::string filename = make_index_filename (build_id, INDEX4_SUFFIX);
TRY
try
{
if (debug_index_cache)
printf_unfiltered ("index cache: trying to read %s\n",
@ -189,13 +188,12 @@ index_cache::lookup_gdb_index (const bfd_build_id *build_id,
((const gdb_byte *) mmap_resource->mapping.get (),
mmap_resource->mapping.size ());
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (debug_index_cache)
printf_unfiltered ("index cache: couldn't read %s: %s\n",
filename.c_str (), except.what ());
}
END_CATCH
return {};
}

View File

@ -1675,19 +1675,18 @@ save_gdb_index_command (const char *arg, int from_tty)
if (dwarf2_per_objfile != NULL)
{
TRY
try
{
const char *basename = lbasename (objfile_name (objfile));
write_psymtabs_to_index (dwarf2_per_objfile, arg, basename,
index_kind);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
exception_fprintf (gdb_stderr, except,
_("Error while writing index for `%s': "),
objfile_name (objfile));
}
END_CATCH
}
}

View File

@ -377,7 +377,7 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
this_pc = get_frame_address_in_block (this_frame);
/* Catch any unwinding errors. */
TRY
try
{
int sp_regnum;
@ -399,13 +399,12 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
}
}
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
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)

View File

@ -1044,7 +1044,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
try
{
/* Calculate the CFA. */
switch (fs.regs.cfa_how)
@ -1068,7 +1068,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
}
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
@ -1078,7 +1078,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
throw_exception (ex);
}
END_CATCH
/* Initialize the register state. */
{
@ -2245,7 +2244,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
if (txt)
unit->tbase = txt->vma;
TRY
try
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@ -2254,7 +2253,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
EH_CIE_OR_FDE_TYPE_ID);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
warning (_("skipping .eh_frame info of %s: %s"),
objfile_name (objfile), e.what ());
@ -2267,7 +2266,6 @@ dwarf2_build_frame_info (struct objfile *objfile)
}
/* The cie_table is discarded by the next if. */
}
END_CATCH
if (cie_table.num_entries != 0)
{
@ -2287,7 +2285,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
{
int num_old_fde_entries = fde_table.num_entries;
TRY
try
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@ -2295,7 +2293,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
&cie_table, &fde_table,
EH_CIE_OR_FDE_TYPE_ID);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
warning (_("skipping .debug_frame info of %s: %s"),
objfile_name (objfile), e.what ());
@ -2318,7 +2316,6 @@ 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. */

View File

@ -1195,11 +1195,11 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
{
struct call_site_chain *retval = NULL;
TRY
try
{
retval = call_site_find_chain_1 (gdbarch, caller_pc, callee_pc);
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
if (e.error == NO_ENTRY_VALUE_ERROR)
{
@ -1211,7 +1211,6 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
else
throw_exception (e);
}
END_CATCH
return retval;
}
@ -2164,11 +2163,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
ctx.ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu);
ctx.offset = dwarf2_per_cu_text_offset (per_cu);
TRY
try
{
ctx.eval (data, size);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
@ -2188,7 +2187,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
else
throw_exception (ex);
}
END_CATCH
if (ctx.pieces.size () > 0)
{
@ -2382,11 +2380,11 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
ctx.ref_addr_size = dwarf2_per_cu_ref_addr_size (dlbaton->per_cu);
ctx.offset = dwarf2_per_cu_text_offset (dlbaton->per_cu);
TRY
try
{
ctx.eval (dlbaton->data, dlbaton->size);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
@ -2401,7 +2399,6 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
else
throw_exception (ex);
}
END_CATCH
switch (ctx.location)
{

View File

@ -6332,7 +6332,7 @@ dwarf2_build_psymtabs (struct objfile *objfile)
init_psymbol_list (objfile, 1024);
TRY
try
{
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
@ -6344,11 +6344,10 @@ dwarf2_build_psymtabs (struct objfile *objfile)
/* (maybe) store an index in the cache. */
global_index_cache.store (dwarf2_per_objfile);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
exception_print (gdb_stderr, except);
}
END_CATCH
}
/* Return the total length of the CU described by HEADER. */

View File

@ -201,11 +201,11 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
mark = value_mark ();
result = NULL;
TRY
try
{
result = evaluate_subexp (NULL_TYPE, exp, pc, EVAL_NORMAL);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
/* Ignore memory errors if we want watchpoints pointing at
inaccessible memory to still be created; otherwise, throw the
@ -221,7 +221,6 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
break;
}
}
END_CATCH
new_mark = value_mark ();
if (mark == new_mark)
@ -238,15 +237,14 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
else
{
TRY
try
{
value_fetch_lazy (result);
*valp = result;
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
}
END_CATCH
}
}
@ -716,19 +714,18 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var)
struct value *ret = NULL;
TRY
try
{
ret = value_of_variable (var, blk);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (noside != EVAL_AVOID_SIDE_EFFECTS)
throw_exception (except);
ret = value_zero (SYMBOL_TYPE (var), not_lval);
}
END_CATCH
return ret;
}
@ -957,19 +954,18 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
while (unop_user_defined_p (op, arg2))
{
struct value *value = NULL;
TRY
try
{
value = value_x_unop (arg2, op, noside);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
END_CATCH
arg2 = value;
}
@ -2047,19 +2043,18 @@ evaluate_subexp_standard (struct type *expect_type,
while (unop_user_defined_p (op, arg1))
{
struct value *value = NULL;
TRY
try
{
value = value_x_unop (arg1, op, noside);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
END_CATCH
arg1 = value;
}

View File

@ -366,11 +366,11 @@ start_event_loop (void)
{
int result = 0;
TRY
try
{
result = gdb_do_one_event ();
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stderr, ex);
@ -394,7 +394,6 @@ 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;

View File

@ -208,15 +208,14 @@ gdb_rl_callback_handler (char *rl) noexcept
struct gdb_exception gdb_rl_expt = exception_none;
struct ui *ui = current_ui;
TRY
try
{
ui->input_handler (gdb::unique_xmalloc_ptr<char> (rl));
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
gdb_rl_expt = ex;
}
END_CATCH
/* If we caught a GDB exception, longjmp out of the readline
callback. There's no other way for the callback to signal to
@ -1082,27 +1081,25 @@ static void
async_disconnect (gdb_client_data arg)
{
TRY
try
{
quit_cover ();
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
fputs_filtered ("Could not kill the program being debugged",
gdb_stderr);
exception_print (gdb_stderr, exception);
}
END_CATCH
TRY
try
{
pop_all_targets ();
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
}
END_CATCH
signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */
raise (SIGHUP);

View File

@ -161,33 +161,31 @@ try_open_exec_file (const char *exec_file_host, struct inferior *inf,
Even without a symbol file, the remote-based debugging session should
continue normally instead of ending abruptly. Hence we catch thrown
errors/exceptions in the following code. */
TRY
try
{
/* We must do this step even if exec_file_host is NULL, so that
exec_file_attach will clear state. */
exec_file_attach (exec_file_host, add_flags & SYMFILE_VERBOSE);
}
CATCH (err, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &err)
{
if (err.message != NULL)
warning ("%s", err.what ());
prev_err = err;
}
END_CATCH
if (exec_file_host != NULL)
{
TRY
try
{
symbol_file_add_main (exec_file_host, add_flags);
}
CATCH (err, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &err)
{
if (!exception_print_same (prev_err, err))
warning ("%s", err.what ());
}
END_CATCH
}
}

View File

@ -407,18 +407,17 @@ info_common_command_for_block (const struct block *block, const char *comname,
printf_filtered ("%s = ",
SYMBOL_PRINT_NAME (common->contents[index]));
TRY
try
{
val = value_of_variable (common->contents[index], block);
value_print (val, gdb_stdout, &opts);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
printf_filtered ("<error reading variable: %s>",
except.what ());
}
END_CATCH
putchar_filtered ('\n');
}

View File

@ -746,15 +746,14 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
}
/* Thread register information. */
TRY
try
{
update_thread_list ();
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
exception_print (gdb_stderr, e);
}
END_CATCH
/* Like the kernel, prefer dumping the signalled thread first.
"First thread" is what tools use to infer the signalled thread.
@ -1985,7 +1984,7 @@ fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name)
static void
fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
{
TRY
try
{
/* Fetch offsets from debug symbols in rtld. */
struct symbol *obj_entry_sym
@ -2000,13 +1999,12 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
data->rtld_offsets_valid = true;
return;
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
data->off_linkmap = -1;
}
END_CATCH
TRY
try
{
/* Fetch offsets from global variables in libthr. Note that
this does not work for single-threaded processes that are not
@ -2018,11 +2016,10 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
data->rtld_offsets_valid = true;
return;
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
data->off_linkmap = -1;
}
END_CATCH
}
/* Helper function to read the TLS index of an object file associated

View File

@ -101,11 +101,11 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
frame_prepare_for_sniffer (this_frame, unwinder);
TRY
try
{
res = unwinder->sniffer (unwinder, this_frame, this_cache);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
/* Catch all exceptions, caused by either interrupt or error.
Reset *THIS_CACHE. */
@ -122,7 +122,6 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
}
throw_exception (ex);
}
END_CATCH
if (res)
return 1;

View File

@ -894,12 +894,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
try
{
pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
pc_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
@ -924,7 +924,6 @@ frame_unwind_pc (struct frame_info *this_frame)
else
throw_exception (ex);
}
END_CATCH
if (pc_p)
{
@ -1894,7 +1893,7 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
if (prev_frame->level == 0)
return prev_frame;
TRY
try
{
compute_frame_id (prev_frame);
if (!frame_stash_add (prev_frame))
@ -1914,14 +1913,13 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
prev_frame = NULL;
}
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
prev_frame->next = NULL;
this_frame->prev = NULL;
throw_exception (ex);
}
END_CATCH
return prev_frame;
}
@ -2092,11 +2090,11 @@ get_prev_frame_always (struct frame_info *this_frame)
{
struct frame_info *prev_frame = NULL;
TRY
try
{
prev_frame = get_prev_frame_always_1 (this_frame);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == MEMORY_ERROR)
{
@ -2120,7 +2118,6 @@ get_prev_frame_always (struct frame_info *this_frame)
else
throw_exception (ex);
}
END_CATCH
return prev_frame;
}
@ -2379,18 +2376,17 @@ get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
gdb_assert (frame->next != NULL);
TRY
try
{
*pc = frame_unwind_pc (frame->next);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
return 0;
else
throw_exception (ex);
}
END_CATCH
return 1;
}
@ -2462,17 +2458,16 @@ get_frame_address_in_block_if_available (struct frame_info *this_frame,
CORE_ADDR *pc)
{
TRY
try
{
*pc = get_frame_address_in_block (this_frame);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
return 0;
throw_exception (ex);
}
END_CATCH
return 1;
}
@ -2747,17 +2742,16 @@ get_frame_language (struct frame_info *frame)
a PC that is guaranteed to be inside the frame's code
block. */
TRY
try
{
pc = get_frame_address_in_block (frame);
pc_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
if (pc_p)
{

View File

@ -1,3 +1,9 @@
2019-04-08 Tom Tromey <tom@tromey.com>
* server.c: Use C++ exception handling.
* linux-low.c: Use C++ exception handling.
* gdbreplay.c: Use C++ exception handling.
2019-04-08 Tom Tromey <tom@tromey.com>
* server.c (handle_btrace_general_set, handle_qxfer_btrace)

View File

@ -528,11 +528,11 @@ captured_main (int argc, char *argv[])
int
main (int argc, char *argv[])
{
TRY
try
{
captured_main (argc, argv);
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
if (exception.reason == RETURN_ERROR)
{
@ -542,7 +542,6 @@ main (int argc, char *argv[])
exit (1);
}
END_CATCH
gdb_assert_not_reached ("captured_main should never return");
}

View File

@ -1531,7 +1531,7 @@ linux_detach_one_lwp (struct lwp_info *lwp)
/* Preparing to resume may try to write registers, and fail if the
lwp is zombie. If that happens, ignore the error. We'll handle
it below, when detach fails with ESRCH. */
TRY
try
{
/* Flush any pending changes to the process's registers. */
regcache_invalidate_thread (thread);
@ -1540,12 +1540,11 @@ linux_detach_one_lwp (struct lwp_info *lwp)
if (the_low_target.prepare_to_resume != NULL)
the_low_target.prepare_to_resume (lwp);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (!check_ptrace_stopped_lwp_gone (lwp))
throw_exception (ex);
}
END_CATCH
lwpid = lwpid_of (thread);
if (ptrace (PTRACE_DETACH, lwpid, (PTRACE_TYPE_ARG3) 0,
@ -4508,16 +4507,15 @@ static void
linux_resume_one_lwp (struct lwp_info *lwp,
int step, int signal, siginfo_t *info)
{
TRY
try
{
linux_resume_one_lwp_throw (lwp, step, signal, info);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (!check_ptrace_stopped_lwp_gone (lwp))
throw_exception (ex);
}
END_CATCH
}
/* This function is called once per thread via for_each_thread.

View File

@ -459,7 +459,7 @@ handle_btrace_general_set (char *own_buf)
return -1;
}
TRY
try
{
if (strcmp (op, "bts") == 0)
handle_btrace_enable_bts (thread);
@ -472,11 +472,10 @@ handle_btrace_general_set (char *own_buf)
write_ok (own_buf);
}
CATCH (exception, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &exception)
{
sprintf (own_buf, "E.%s", exception.what ());
}
END_CATCH
return 1;
}
@ -1876,18 +1875,17 @@ handle_qxfer_btrace (const char *annex,
{
buffer_free (&cache);
TRY
try
{
result = target_read_btrace (thread->btrace, &cache, type);
if (result != 0)
memcpy (cs.own_buf, cache.buffer, cache.used_size);
}
CATCH (exception, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &exception)
{
sprintf (cs.own_buf, "E.%s", exception.what ());
result = -1;
}
END_CATCH
if (result != 0)
return -3;
@ -1948,18 +1946,17 @@ handle_qxfer_btrace_conf (const char *annex,
{
buffer_free (&cache);
TRY
try
{
result = target_read_btrace_conf (thread->btrace, &cache);
if (result != 0)
memcpy (cs.own_buf, cache.buffer, cache.used_size);
}
CATCH (exception, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &exception)
{
sprintf (cs.own_buf, "E.%s", exception.what ());
result = -1;
}
END_CATCH
if (result != 0)
return -3;
@ -3552,18 +3549,17 @@ static int exit_code;
static void
detach_or_kill_for_exit_cleanup ()
{
TRY
try
{
detach_or_kill_for_exit ();
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
fflush (stdout);
fprintf (stderr, "Detach or kill failed: %s\n",
exception.what ());
exit_code = 1;
}
END_CATCH
}
/* Main function. This is called by the real "main" function,
@ -3866,7 +3862,7 @@ captured_main (int argc, char *argv[])
remote_open (port);
TRY
try
{
/* Wait for events. This will return when all event sources
are removed from the event loop. */
@ -3931,7 +3927,7 @@ captured_main (int argc, char *argv[])
}
}
}
CATCH (exception, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &exception)
{
fflush (stdout);
fprintf (stderr, "gdbserver: %s\n", exception.what ());
@ -3945,7 +3941,6 @@ captured_main (int argc, char *argv[])
if (run_once)
throw_quit ("Quit");
}
END_CATCH
}
}
@ -3955,11 +3950,11 @@ int
main (int argc, char *argv[])
{
TRY
try
{
captured_main (argc, argv);
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
if (exception.reason == RETURN_ERROR)
{
@ -3971,7 +3966,6 @@ main (int argc, char *argv[])
exit (exit_code);
}
END_CATCH
gdb_assert_not_reached ("captured_main should never return");
}

View File

@ -2571,15 +2571,14 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
gdb_stderr = &null_stream;
/* Call parse_and_eval_type() without fear of longjmp()s. */
TRY
try
{
type = parse_and_eval_type (p, length);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
type = builtin_type (gdbarch)->builtin_void;
}
END_CATCH
/* Stop suppressing error messages. */
gdb_stderr = saved_gdb_stderr;

View File

@ -906,16 +906,15 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
if (gdbarch_vtable_function_descriptors (gdbarch))
vfn = value_addr (vfn);
TRY
try
{
addr = value_as_address (vfn);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
printf_filtered (_("<error: %s>"), ex.what ());
got_error = 1;
}
END_CATCH
if (!got_error)
print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);

View File

@ -677,15 +677,14 @@ gdbscm_wrap (Function &&func, Args &&... args)
{
SCM result = SCM_BOOL_F;
TRY
try
{
result = func (std::forward<Args> (args)...);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (gdbscm_is_exception (result))
gdbscm_throw (result);

View File

@ -680,18 +680,17 @@ gdbscm_lookup_block (SCM pc_scm)
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
TRY
try
{
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
block = block_for_pc (pc);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
{

View File

@ -429,7 +429,7 @@ gdbscm_register_breakpoint_x (SCM self)
current_language,
symbol_name_match_type::WILD);
TRY
try
{
int internal = bp_smob->spec.is_internal;
@ -465,11 +465,10 @@ gdbscm_register_breakpoint_x (SCM self)
gdb_assert_not_reached ("invalid breakpoint type");
}
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
/* Ensure this gets reset, even if there's an error. */
pending_breakpoint_scm = SCM_BOOL_F;
@ -490,15 +489,14 @@ gdbscm_delete_breakpoint_x (SCM self)
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
delete_breakpoint (bp_smob->bp);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return SCM_UNSPECIFIED;
}
@ -588,18 +586,17 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
TRY
try
{
if (gdbscm_is_true (newvalue))
enable_breakpoint (bp_smob->bp);
else
disable_breakpoint (bp_smob->bp);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return SCM_UNSPECIFIED;
}
@ -626,15 +623,14 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
TRY
try
{
breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return SCM_UNSPECIFIED;
}
@ -667,15 +663,14 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
if (value < 0)
value = 0;
TRY
try
{
set_ignore_count (bp_smob->number, (int) value, 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return SCM_UNSPECIFIED;
}
@ -788,15 +783,14 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
{
id = scm_to_long (newvalue);
TRY
try
{
valid_id = valid_task_id (id);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (! valid_id)
{
@ -809,15 +803,14 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
else
SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
TRY
try
{
breakpoint_set_task (bp_smob->bp, id);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return SCM_UNSPECIFIED;
}
@ -975,16 +968,15 @@ gdbscm_breakpoint_commands (SCM self)
string_file buf;
current_uiout->redirect (&buf);
TRY
try
{
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
current_uiout->redirect (NULL);
gdbscm_throw_gdb_exception (except);
}
END_CATCH
current_uiout->redirect (NULL);
result = gdbscm_scm_from_c_string (buf.c_str ());

View File

@ -758,7 +758,7 @@ gdbscm_register_command_x (SCM self)
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
TRY
try
{
if (c_smob->is_prefix)
{
@ -776,11 +776,10 @@ gdbscm_register_command_x (SCM self)
c_smob->doc, cmd_list);
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
/* Note: At this point the command exists in gdb.
So no more errors after this point. */

View File

@ -247,7 +247,7 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
int insn_len = 0;
string_file buf;
TRY
try
{
if (using_port)
{
@ -257,11 +257,10 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
else
insn_len = gdb_print_insn (gdbarch, pc, &buf, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len),
result);

View File

@ -229,7 +229,7 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
if (*slot != NULL)
return (*slot)->containing_scm;
TRY
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
@ -248,11 +248,10 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
}
gdbarch = get_frame_arch (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
return gdbscm_scm_from_gdb_exception (except);
}
END_CATCH
f_scm = frscm_make_frame_smob ();
f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
@ -397,15 +396,14 @@ gdbscm_frame_valid_p (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return scm_from_bool (frame != NULL);
}
@ -425,17 +423,16 @@ gdbscm_frame_name (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
name = find_frame_funname (frame, &lang, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -463,17 +460,16 @@ gdbscm_frame_type (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
type = get_frame_type (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -495,15 +491,14 @@ gdbscm_frame_arch (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -526,15 +521,14 @@ gdbscm_frame_unwind_stop_reason (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -559,17 +553,16 @@ gdbscm_frame_pc (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
pc = get_frame_pc (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -592,17 +585,16 @@ gdbscm_frame_block (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
block = get_frame_block (frame, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -643,17 +635,16 @@ gdbscm_frame_function (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
sym = find_pc_function (get_frame_address_in_block (frame));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -680,17 +671,16 @@ gdbscm_frame_older (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
prev = get_prev_frame (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -717,17 +707,16 @@ gdbscm_frame_newer (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
next = get_next_frame (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -753,17 +742,16 @@ gdbscm_frame_sal (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
sal = find_frame_sal (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -791,7 +779,7 @@ gdbscm_frame_read_register (SCM self, SCM register_scm)
struct gdb_exception except = exception_none;
TRY
try
{
int regnum;
@ -805,11 +793,10 @@ gdbscm_frame_read_register (SCM self, SCM register_scm)
value = value_of_register (regnum, frame);
}
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
xfree (register_str);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@ -851,15 +838,14 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -897,7 +883,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
/* N.B. Between here and the end of the scope, don't do anything
to cause a Scheme exception. */
TRY
try
{
struct block_symbol lookup_sym;
@ -908,11 +894,10 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
var = lookup_sym.symbol;
block = lookup_sym.block;
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
}
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@ -928,15 +913,14 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
_("gdb:symbol or string"));
}
TRY
try
{
value = read_var_value (var, block, frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return vlscm_scm_from_value (value);
}
@ -952,17 +936,16 @@ gdbscm_frame_select (SCM self)
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
TRY
try
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
select_frame (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
{
@ -981,15 +964,14 @@ gdbscm_newest_frame (void)
{
struct frame_info *frame = NULL;
TRY
try
{
frame = get_current_frame ();
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
@ -1002,15 +984,14 @@ gdbscm_selected_frame (void)
{
struct frame_info *frame = NULL;
TRY
try
{
frame = get_selected_frame (_("No frame is currently selected"));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}

View File

@ -309,7 +309,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
return NULL;
}
TRY
try
{
struct type *type = tyscm_scm_to_type (ls_smob->type);
struct type *realtype = check_typedef (type);
@ -336,12 +336,11 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
break;
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
*except_scmp = gdbscm_scm_from_gdb_exception (except);
return NULL;
}
END_CATCH
return value;
}

View File

@ -723,7 +723,7 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
*except_scmp = SCM_BOOL_F;
TRY
try
{
if (vlscm_is_value (obj))
{
@ -824,11 +824,10 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
value = NULL;
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
except_scm = gdbscm_scm_from_gdb_exception (except);
}
END_CATCH
if (gdbscm_is_true (except_scm))
{

View File

@ -1006,7 +1006,7 @@ gdbscm_register_parameter_x (SCM self)
_("parameter exists, \"show\" command is already defined"));
}
TRY
try
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
p_smob->cmd_name, p_smob,
@ -1018,11 +1018,10 @@ gdbscm_register_parameter_x (SCM self)
set_list, show_list,
&p_smob->set_command, &p_smob->show_command);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
/* Note: At this point the parameter exists in gdb.
So no more errors after this point. */
@ -1064,15 +1063,14 @@ gdbscm_parameter_value (SCM self)
if (name == NULL)
gdbscm_throw (except_scm);
newarg = concat ("show ", name.get (), (char *) NULL);
TRY
try
{
found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
xfree (newarg);
GDBSCM_HANDLE_GDB_EXCEPTION (except);

View File

@ -272,18 +272,17 @@ ioscm_write (SCM port, const void *data, size_t size)
if (scm_is_eq (port, input_port_scm))
return;
TRY
try
{
if (scm_is_eq (port, error_port_scm))
fputsn_filtered ((const char *) data, size, gdb_stderr);
else
fputsn_filtered ((const char *) data, size, gdb_stdout);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
}
/* Flush gdb's stdout or stderr. */

View File

@ -524,7 +524,7 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
SCM result = SCM_BOOL_F;
*out_value = NULL;
TRY
try
{
pretty_printer_worker_smob *w_smob
= (pretty_printer_worker_smob *) SCM_SMOB_DATA (printer);
@ -558,10 +558,9 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
(_("invalid result from pretty-printer to-string"), result);
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
}
END_CATCH
return result;
}

View File

@ -486,15 +486,14 @@ gdbscm_symbol_needs_frame_p (SCM self)
struct symbol *symbol = s_smob->symbol;
int result = 0;
TRY
try
{
result = symbol_read_needs_frame (symbol);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return scm_from_bool (result);
}
@ -539,7 +538,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
_("cannot get the value of a typedef"));
}
TRY
try
{
if (f_smob != NULL)
{
@ -557,11 +556,10 @@ gdbscm_symbol_value (SCM self, SCM rest)
can happen with nested functions). */
value = read_var_value (symbol, NULL, frame_info);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return vlscm_scm_from_value (value);
}
@ -604,30 +602,28 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
{
struct frame_info *selected_frame;
TRY
try
{
selected_frame = get_selected_frame (_("no frame selected"));
block = get_frame_block (selected_frame, NULL);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
xfree (name);
GDBSCM_HANDLE_GDB_EXCEPTION (ex);
}
END_CATCH
}
struct gdb_exception except = exception_none;
TRY
try
{
symbol = lookup_symbol (name, block, (domain_enum) domain,
&is_a_field_of_this).symbol;
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
xfree (name);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@ -656,15 +652,14 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
name_scm, &name, rest,
&domain_arg_pos, &domain);
TRY
try
{
symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
xfree (name);
GDBSCM_HANDLE_GDB_EXCEPTION (except);

View File

@ -591,17 +591,16 @@ gdbscm_find_pc_line (SCM pc_scm)
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
TRY
try
{
CORE_ADDR pc = (CORE_ADDR) pc_ull;
sal = find_pc_line (pc, 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return stscm_scm_from_sal (sal);
}

View File

@ -105,19 +105,18 @@ tyscm_type_smob_type (type_smob *t_smob)
static std::string
tyscm_type_name (struct type *type)
{
TRY
try
{
string_file stb;
LA_PRINT_TYPE (type, "", &stb, -1, 0, &type_print_raw_options);
return std::move (stb.string ());
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
SCM excp = gdbscm_scm_from_gdb_exception (except);
gdbscm_throw (excp);
}
END_CATCH
gdb_assert_not_reached ("no way to get here");
}
@ -235,15 +234,14 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
type1 = type1_smob->type;
type2 = type2_smob->type;
TRY
try
{
result = types_deeply_equal (type1, type2);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return scm_from_bool (result);
}
@ -629,14 +627,13 @@ gdbscm_type_sizeof (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
}
END_CATCH
/* Ignore exceptions. */
@ -653,15 +650,14 @@ gdbscm_type_strip_typedefs (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -675,15 +671,14 @@ tyscm_get_composite (struct type *type)
for (;;)
{
TRY
try
{
type = check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@ -730,17 +725,16 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
_("Array length must not be negative"));
}
TRY
try
{
array = lookup_array_range_type (type, n1, n2);
if (is_vector)
make_vector_type (array);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (array);
}
@ -787,15 +781,14 @@ gdbscm_type_pointer (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = lookup_pointer_type (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -849,15 +842,14 @@ gdbscm_type_reference (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = lookup_lvalue_reference_type (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -887,15 +879,14 @@ gdbscm_type_const (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = make_cv_type (1, 0, type, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -910,15 +901,14 @@ gdbscm_type_volatile (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = make_cv_type (0, 1, type, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -933,15 +923,14 @@ gdbscm_type_unqualified (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
TRY
try
{
type = make_cv_type (0, 0, type, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return tyscm_scm_from_type (type);
}
@ -1230,7 +1219,7 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
TRY
try
{
if (startswith (type_name, "struct "))
type = lookup_struct (type_name + 7, NULL);
@ -1242,11 +1231,10 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
type = lookup_typename (current_language, get_current_arch (),
type_name, block, 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
return NULL;
}
END_CATCH
return type;
}

View File

@ -156,18 +156,17 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
instead of writingp. */
opts.raw = !!pstate->writingp;
TRY
try
{
string_file stb;
common_val_print (v_smob->value, &stb, 0, &opts, current_language);
scm_puts (stb.c_str (), port);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (pstate->writingp)
scm_puts (">", port);
@ -187,15 +186,14 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
int result = 0;
TRY
try
{
result = value_equal (v1_smob->value, v2_smob->value);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return scm_from_bool (result);
}
@ -392,14 +390,13 @@ gdbscm_value_address (SCM self)
SCM address = SCM_BOOL_F;
TRY
try
{
address = vlscm_scm_from_value (value_addr (value));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
}
END_CATCH
if (gdbscm_is_exception (address))
return address;
@ -496,7 +493,7 @@ gdbscm_value_dynamic_type (SCM self)
if (! SCM_UNBNDP (v_smob->dynamic_type))
return v_smob->dynamic_type;
TRY
try
{
scoped_value_mark free_values;
@ -532,11 +529,10 @@ gdbscm_value_dynamic_type (SCM self)
type = NULL;
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (type == NULL)
v_smob->dynamic_type = gdbscm_value_type (self);
@ -684,15 +680,14 @@ gdbscm_value_call (SCM self, SCM args)
long args_count;
struct value **vargs = NULL;
TRY
try
{
ftype = check_typedef (value_type (function));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
@ -751,17 +746,16 @@ gdbscm_value_to_bytevector (SCM self)
type = value_type (value);
TRY
try
{
type = check_typedef (type);
length = TYPE_LENGTH (type);
contents = value_contents (value);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
bv = scm_c_make_bytevector (length);
memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
@ -795,31 +789,29 @@ gdbscm_value_to_bool (SCM self)
type = value_type (value);
TRY
try
{
type = check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
TRY
try
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
return scm_from_bool (l != 0);
}
@ -838,31 +830,29 @@ gdbscm_value_to_integer (SCM self)
type = value_type (value);
TRY
try
{
type = check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
TRY
try
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
if (TYPE_UNSIGNED (type))
return gdbscm_scm_from_ulongest (l);
@ -885,20 +875,19 @@ gdbscm_value_to_real (SCM self)
type = value_type (value);
TRY
try
{
type = check_typedef (type);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
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
try
{
if (is_floating_value (value))
{
@ -916,11 +905,10 @@ gdbscm_value_to_real (SCM self)
check = value_from_longest (type, (LONGEST) d);
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
END_CATCH
/* TODO: Is there a better way to check if the value fits? */
if (!value_equal (value, check))
@ -1004,18 +992,17 @@ 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
try
{
gdb::unique_xmalloc_ptr<gdb_byte> buffer;
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
buffer_contents = buffer.release ();
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
xfree (encoding);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
}
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. */
@ -1077,7 +1064,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
_("invalid length"));
}
TRY
try
{
scoped_value_mark free_values;
@ -1132,11 +1119,10 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
result = lsscm_make_lazy_string (addr, length, encoding, type);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
xfree (encoding);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@ -1191,15 +1177,14 @@ gdbscm_value_print (SCM self)
string_file stb;
TRY
try
{
common_val_print (value, &stb, 0, &opts, current_language);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
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.

View File

@ -402,7 +402,7 @@ i386_linux_handle_segmentation_fault (struct gdbarch *gdbarch,
if (!i386_mpx_enabled ())
return;
TRY
try
{
/* Sigcode evaluates if the actual segfault is a boundary violation. */
sig_code = parse_and_eval_long ("$_siginfo.si_code\n");
@ -414,11 +414,10 @@ i386_linux_handle_segmentation_fault (struct gdbarch *gdbarch,
access
= parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
return;
}
END_CATCH
/* If this is not a boundary violation just return. */
if (sig_code != SIG_CODE_BONDARY_FAULT)

View File

@ -2082,16 +2082,15 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = i386_alloc_frame_cache ();
*this_cache = cache;
TRY
try
{
i386_frame_cache_1 (this_frame, cache);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}
@ -2252,7 +2251,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = i386_alloc_frame_cache ();
*this_cache = cache;
TRY
try
{
cache->pc = get_frame_func (this_frame);
@ -2266,12 +2265,11 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
return cache;
}
@ -2438,7 +2436,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = i386_alloc_frame_cache ();
TRY
try
{
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
@ -2462,12 +2460,11 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
*this_cache = cache;
return cache;

View File

@ -67,11 +67,11 @@ inferior_event_handler (enum inferior_event_type event_type,
/* Don't propagate breakpoint commands errors. Either we're
stopping or some command resumes the inferior. The user will
be informed. */
TRY
try
{
bpstat_do_actions ();
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
/* If the user was running a foreground execution
command, then propagate the error so that the prompt
@ -83,7 +83,6 @@ inferior_event_handler (enum inferior_event_type event_type,
else
exception_print (gdb_stderr, e);
}
END_CATCH
}
break;

View File

@ -597,7 +597,7 @@ run_inferior_call (struct call_thread_fsm *sm,
/* We want to print return value, please... */
call_thread->control.proceed_to_finish = 1;
TRY
try
{
proceed (real_pc, GDB_SIGNAL_0);
@ -605,11 +605,10 @@ run_inferior_call (struct call_thread_fsm *sm,
target supports asynchronous execution. */
wait_sync_command_done ();
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
caught_error = e;
}
END_CATCH
/* If GDB has the prompt blocked before, then ensure that it remains
so. normal_stop calls async_enable_stdin, so reset the prompt

View File

@ -447,16 +447,15 @@ post_create_inferior (struct target_ops *target, int from_tty)
thread_info *thr = inferior_thread ();
thr->suspend.stop_pc = 0;
TRY
try
{
thr->suspend.stop_pc = regcache_read_pc (get_current_regcache ());
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
}
END_CATCH
if (exec_bfd)
{
@ -1646,18 +1645,17 @@ print_return_value (struct ui_out *uiout, struct return_value_info *rv)
|| TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID)
return;
TRY
try
{
/* print_return_value_1 can throw an exception in some
circumstances. We need to catch this so that we still
delete the breakpoint. */
print_return_value_1 (uiout, rv);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stdout, ex);
}
END_CATCH
}
/* Data for the FSM that manages the finish command. */

View File

@ -1776,11 +1776,11 @@ displaced_step_prepare (thread_info *thread)
{
int prepared = -1;
TRY
try
{
prepared = displaced_step_prepare_throw (thread);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
struct displaced_step_inferior_state *displaced_state;
@ -1808,7 +1808,6 @@ displaced_step_prepare (thread_info *thread)
= get_displaced_stepping_state (thread->inf);
displaced_state->failed_before = 1;
}
END_CATCH
return prepared;
}
@ -2612,11 +2611,11 @@ resume_1 (enum gdb_signal sig)
static void
resume (gdb_signal sig)
{
TRY
try
{
resume_1 (sig);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
/* If resuming is being aborted for any reason, delete any
single-step breakpoint resume_1 may have created, to avoid
@ -2627,7 +2626,6 @@ resume (gdb_signal sig)
delete_single_step_breakpoints (inferior_thread ());
throw_exception (ex);
}
END_CATCH
}
@ -7270,7 +7268,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
struct frame_info *frame,
struct symbol *sym)
{
TRY
try
{
struct block_symbol vsym;
struct value *value;
@ -7301,11 +7299,10 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
inferior_thread ()->control.exception_resume_breakpoint = bp;
}
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
/* We want to ignore errors here. */
}
END_CATCH
}
/* A helper for check_exception_resume that sets an
@ -7364,7 +7361,7 @@ check_exception_resume (struct execution_control_state *ecs,
if (!func)
return;
TRY
try
{
const struct block *b;
struct block_iterator iter;
@ -7401,10 +7398,9 @@ check_exception_resume (struct execution_control_state *ecs,
}
}
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
}
END_CATCH
}
static void
@ -7531,18 +7527,17 @@ keep_going_pass_signal (struct execution_control_state *ecs)
stop_all_threads ();
/* Stop stepping if inserting breakpoints fails. */
TRY
try
{
insert_breakpoints ();
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
exception_print (gdb_stderr, e);
stop_waiting (ecs);
clear_step_over_info ();
return;
}
END_CATCH
ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
@ -8064,16 +8059,15 @@ normal_stop (void)
{
stop_context saved_context;
TRY
try
{
execute_cmd_pre_hook (stop_command);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
"Error while running hook_stop:\n");
}
END_CATCH
/* If the stop hook resumes the target, then there's no point in
trying to notify about the previous stop; its context is
@ -8770,11 +8764,11 @@ restore_infcall_control_state (struct infcall_control_state *inf_status)
/* The point of the try/catch is that if the stack is clobbered,
walking the stack might encounter a garbage pointer and
error() trying to dereference it. */
TRY
try
{
restore_selected_frame (inf_status->selected_frame_id);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
exception_fprintf (gdb_stderr, ex,
"Unable to restore previously selected frame:\n");
@ -8782,7 +8776,6 @@ restore_infcall_control_state (struct infcall_control_state *inf_status)
innermost frame. */
select_frame (get_current_frame ());
}
END_CATCH
}
delete inf_status;

View File

@ -849,17 +849,16 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
gdb_mem = (gdb_byte *) xmalloc (code_entry->symfile_size);
status = 1;
TRY
try
{
if (target_read_memory (code_entry->symfile_addr, gdb_mem,
code_entry->symfile_size))
status = 0;
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
status = 0;
}
END_CATCH
if (status)
{

View File

@ -172,18 +172,17 @@ set_language_command (const char *ignore,
/* Enter auto mode. Set to the current frame's language, if
known, or fallback to the initial language. */
language_mode = language_mode_auto;
TRY
try
{
struct frame_info *frame;
frame = get_selected_frame (NULL);
flang = get_frame_language (frame);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
flang = language_unknown;
}
END_CATCH
if (flang != language_unknown)
set_language (flang);

View File

@ -2383,16 +2383,15 @@ convert_explicit_location_to_linespec (struct linespec_state *self,
if (source_filename != NULL)
{
TRY
try
{
*result->file_symtabs
= symtabs_from_filename (source_filename, self->search_pspace);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
source_file_not_found_error (source_filename);
}
END_CATCH
result->explicit_loc.source_filename = xstrdup (source_filename);
}
else
@ -2608,17 +2607,16 @@ parse_linespec (linespec_parser *parser, const char *arg,
gdb::unique_xmalloc_ptr<char> user_filename = copy_token_string (token);
/* Check if the input is a filename. */
TRY
try
{
*PARSER_RESULT (parser)->file_symtabs
= symtabs_from_filename (user_filename.get (),
PARSER_STATE (parser)->search_pspace);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
file_exception = ex;
}
END_CATCH
if (file_exception.reason >= 0)
{
@ -2923,7 +2921,7 @@ linespec_complete_label (completion_tracker &tracker,
line_offset unknown_offset = { 0, LINE_OFFSET_UNKNOWN };
TRY
try
{
convert_explicit_location_to_linespec (PARSER_STATE (&parser),
PARSER_RESULT (&parser),
@ -2932,11 +2930,10 @@ linespec_complete_label (completion_tracker &tracker,
func_name_match_type,
NULL, unknown_offset);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
return;
}
END_CATCH
complete_label (tracker, &parser, label_name);
}
@ -2959,14 +2956,13 @@ linespec_complete (completion_tracker &tracker, const char *text,
/* Parse as much as possible. parser.completion_word will hold
furthest completion point we managed to parse to. */
TRY
try
{
parse_linespec (&parser, text, match_type);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
}
END_CATCH
if (parser.completion_quote_char != '\0'
&& parser.completion_quote_end != NULL
@ -3148,17 +3144,16 @@ event_location_to_sals (linespec_parser *parser,
case LINESPEC_LOCATION:
{
PARSER_STATE (parser)->is_linespec = 1;
TRY
try
{
const linespec_location *ls = get_linespec_location (location);
result = parse_linespec (parser,
ls->spec_string, ls->match_type);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
throw_exception (except);
}
END_CATCH
}
break;
@ -3959,7 +3954,7 @@ find_linespec_symbols (struct linespec_state *state,
if (!classes.empty ())
{
/* Now locate a list of suitable methods named METHOD. */
TRY
try
{
find_method (state, file_symtabs,
klass.c_str (), method.c_str (),
@ -3968,12 +3963,11 @@ 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. */
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (except.error != NOT_FOUND_ERROR)
throw_exception (except);
}
END_CATCH
}
}
}

View File

@ -427,19 +427,18 @@ public:
if (m_oldfp != nullptr)
{
/* Switch back to inferior_ptid. */
TRY
try
{
remove_breakpoints ();
fork_load_infrun_state (m_oldfp);
insert_breakpoints ();
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
warning (_("Couldn't restore checkpoint state in %s: %s"),
target_pid_to_str (m_oldfp->ptid).c_str (),
ex.what ());
}
END_CATCH
}
}

View File

@ -1188,11 +1188,11 @@ linux_nat_target::attach (const char *args, int from_tty)
/* Make sure we report all signals during attach. */
pass_signals ({});
TRY
try
{
inf_ptrace_target::attach (args, from_tty);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
pid_t pid = parse_pid_to_attach (args);
std::string reason = linux_ptrace_attach_fail_reason (pid);
@ -1203,7 +1203,6 @@ linux_nat_target::attach (const char *args, int from_tty)
else
throw_error (ex.error, "%s", ex.what ());
}
END_CATCH
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
@ -1402,16 +1401,15 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
/* Preparing to resume may try to write registers, and fail if the
lwp is zombie. If that happens, ignore the error. We'll handle
it below, when detach fails with ESRCH. */
TRY
try
{
linux_target->low_prepare_to_resume (lp);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (!check_ptrace_stopped_lwp_gone (lp))
throw_exception (ex);
}
END_CATCH
if (ptrace (PTRACE_DETACH, lwpid, 0, signo) < 0)
{
@ -1585,16 +1583,15 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
static void
linux_resume_one_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
{
TRY
try
{
linux_resume_one_lwp_throw (lp, step, signo);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (!check_ptrace_stopped_lwp_gone (lp))
throw_exception (ex);
}
END_CATCH
}
/* Resume LP. */
@ -3526,7 +3523,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
struct regcache *regcache = get_thread_regcache (lp->ptid);
struct gdbarch *gdbarch = regcache->arch ();
TRY
try
{
CORE_ADDR pc = regcache_read_pc (regcache);
int leave_stopped = 0;
@ -3552,12 +3549,11 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
linux_resume_one_lwp_throw (lp, lp->step, GDB_SIGNAL_0);
}
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (!check_ptrace_stopped_lwp_gone (lp))
throw_exception (ex);
}
END_CATCH
}
return 0;

View File

@ -1926,15 +1926,14 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
}
/* Thread register information. */
TRY
try
{
update_thread_list ();
}
CATCH (e, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &e)
{
exception_print (gdb_stderr, e);
}
END_CATCH
/* Like the kernel, prefer dumping the signalled thread first.
"First thread" is what tools use to infer the signalled thread.

View File

@ -497,12 +497,12 @@ static int
thread_db_find_new_threads_silently (thread_info *stopped)
{
TRY
try
{
thread_db_find_new_threads_2 (stopped, true);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (libthread_db_debug)
exception_fprintf (gdb_stdlog, except,
@ -532,7 +532,6 @@ thread_db_find_new_threads_silently (thread_info *stopped)
return 1;
}
}
END_CATCH
return 0;
}
@ -757,7 +756,7 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
fail. */
linux_stop_and_wait_all_lwps ();
TRY
try
{
td_err_e err = td_ta_thr_iter_p (info->thread_agent,
check_thread_db_callback,
@ -773,7 +772,7 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
if (!tdb_testinfo->threads_seen)
error (_("no threads seen"));
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (warning_pre_print)
fputs_unfiltered (warning_pre_print, gdb_stderr);
@ -783,7 +782,6 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
test_passed = false;
}
END_CATCH
if (test_passed && log_progress)
debug_printf (_("libthread_db integrity checks passed.\n"));
@ -1509,7 +1507,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
/* See comment in thread_db_update_thread_list. */
gdb_assert (info->td_ta_thr_iter_p != NULL);
TRY
try
{
/* Iterate over all user-space threads to discover new threads. */
err = info->td_ta_thr_iter_p (info->thread_agent,
@ -1520,7 +1518,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
TD_SIGNO_MASK,
TD_THR_ANY_USER_FLAGS);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
if (libthread_db_debug)
{
@ -1528,7 +1526,6 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
"Warning: find_new_threads_once: ");
}
}
END_CATCH
if (libthread_db_debug)
{

View File

@ -365,7 +365,7 @@ static int
catch_command_errors (catch_command_errors_const_ftype command,
const char *arg, int from_tty)
{
TRY
try
{
int was_sync = current_ui->prompt_state == PROMPT_BLOCKED;
@ -373,11 +373,10 @@ catch_command_errors (catch_command_errors_const_ftype command,
maybe_wait_sync_command_done (was_sync);
}
CATCH (e, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &e)
{
return handle_command_errors (e);
}
END_CATCH
return 1;
}
@ -1169,15 +1168,14 @@ captured_main (void *data)
change - SET_TOP_LEVEL() - has been eliminated. */
while (1)
{
TRY
try
{
captured_command_loop ();
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stderr, ex);
}
END_CATCH
}
/* No exit -- exit is through quit_command. */
}
@ -1185,15 +1183,14 @@ captured_main (void *data)
int
gdb_main (struct captured_main_args *args)
{
TRY
try
{
captured_main (args);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stderr, ex);
}
END_CATCH
/* The only way to end up here is by an error (normal exit is
handled by quit_force()), hence always return an error status. */

View File

@ -54,15 +54,14 @@ breakpoint_notify (struct breakpoint *b)
{
if (mi_can_breakpoint_notify)
{
TRY
try
{
print_breakpoint (b);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stderr, ex);
}
END_CATCH
}
}

View File

@ -531,7 +531,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
stb.printf (_("<error reading variable: %s>"), arg->error);
else
{
TRY
try
{
struct value_print_options opts;
@ -540,12 +540,11 @@ 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)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
stb.printf (_("<error reading variable: %s>"),
except.what ());
}
END_CATCH
}
uiout->field_stream ("value", stb);
}

View File

@ -823,18 +823,17 @@ mi_print_breakpoint_for_event (struct mi_interp *mi, breakpoint *bp)
ui_out_redirect. */
mi_uiout->redirect (mi->event_channel);
TRY
try
{
scoped_restore restore_uiout
= make_scoped_restore (&current_uiout, mi_uiout);
print_breakpoint (bp);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_print (gdb_stderr, ex);
}
END_CATCH
mi_uiout->redirect (NULL);
}

View File

@ -1938,16 +1938,15 @@ mi_execute_command (const char *cmd, int from_tty)
target_log_command (cmd);
TRY
try
{
command = mi_parse (cmd, &token);
}
CATCH (exception, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &exception)
{
mi_print_exception (token, exception);
xfree (token);
}
END_CATCH
if (command != NULL)
{
@ -1966,11 +1965,11 @@ mi_execute_command (const char *cmd, int from_tty)
timestamp (command->cmd_start);
}
TRY
try
{
captured_mi_execute_command (current_uiout, command.get ());
}
CATCH (result, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &result)
{
/* Like in start_event_loop, enable input and force display
of the prompt. Otherwise, any command that calls
@ -1984,7 +1983,6 @@ mi_execute_command (const char *cmd, int from_tty)
mi_print_exception (command->token, result);
mi_out_rewind (current_uiout);
}
END_CATCH
bpstat_do_actions ();

View File

@ -1297,18 +1297,17 @@ find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
CORE_ADDR pc,
CORE_ADDR *new_pc)
{
TRY
try
{
if (f (pc, new_pc) == 0)
return 1;
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
exception_fprintf (gdb_stderr, ex,
"Unable to determine target of "
"Objective-C method call (ignoring):\n");
}
END_CATCH
return 0;
}

View File

@ -751,18 +751,17 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
thisoffset = offset;
TRY
try
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
if (ex.error == NOT_AVAILABLE_ERROR)
skip = -1;
else
skip = 1;
}
END_CATCH
if (skip == 0)
{

View File

@ -1137,11 +1137,11 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
scoped_restore_current_language lang_saver;
set_language (lang->la_language);
TRY
try
{
lang->la_parser (&ps);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
/* If parsing for completion, allow this to succeed; but if no
expression elements have been written, then there's nothing
@ -1149,7 +1149,6 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
if (! ps.parse_completion || ps.expout_ptr == 0)
throw_exception (except);
}
END_CATCH
/* We have to operate on an "expression *", due to la_post_parser,
which explains this funny-looking double release. */
@ -1224,16 +1223,15 @@ parse_expression_for_completion (const char *string,
int subexp;
expr_completion_state cstate;
TRY
try
{
exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp,
nullptr, &cstate);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
/* Nothing, EXP remains NULL. */
}
END_CATCH
if (exp == NULL)
return NULL;

View File

@ -1827,7 +1827,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
{
struct target_ops *target = current_top_target ();
TRY
try
{
/* We do not call target_translate_tls_address here, because
svr4_fetch_objfile_link_map may invalidate the frame chain,
@ -1842,11 +1842,10 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
spe_context_cache_ptid = inferior_ptid;
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
return 0;
}
END_CATCH
}
/* Read variable value. */

View File

@ -1881,13 +1881,13 @@ do_one_display (struct display *d)
if (d->exp == NULL)
{
TRY
try
{
innermost_block_tracker tracker;
d->exp = parse_expression (d->exp_string, &tracker);
d->block = tracker.block ();
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
/* Can't re-parse the expression. Disable this display item. */
d->enabled_p = 0;
@ -1895,7 +1895,6 @@ do_one_display (struct display *d)
d->exp_string, ex.what ());
return;
}
END_CATCH
}
if (d->block)
@ -1942,7 +1941,7 @@ do_one_display (struct display *d)
annotate_display_value ();
TRY
try
{
struct value *val;
CORE_ADDR addr;
@ -1953,12 +1952,11 @@ do_one_display (struct display *d)
addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
do_examine (d->format, d->exp->gdbarch, addr);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
fprintf_filtered (gdb_stdout, _("<error: %s>\n"),
ex.what ());
}
END_CATCH
}
else
{
@ -1981,18 +1979,17 @@ do_one_display (struct display *d)
get_formatted_print_options (&opts, d->format.format);
opts.raw = d->format.raw;
TRY
try
{
struct value *val;
val = evaluate_expression (d->exp.get ());
print_formatted (val, d->format.size, &opts, gdb_stdout);
}
CATCH (ex, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &ex)
{
fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.what ());
}
END_CATCH
printf_filtered ("\n");
}
@ -2174,7 +2171,7 @@ print_variable_and_value (const char *name, struct symbol *var,
fputs_styled (name, variable_name_style.style (), stream);
fputs_filtered (" = ", stream);
TRY
try
{
struct value *val;
struct value_print_options opts;
@ -2192,12 +2189,11 @@ print_variable_and_value (const char *name, struct symbol *var,
function. */
frame = NULL;
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
fprintf_filtered (stream, "<error reading variable %s (%s)>", name,
except.what ());
}
END_CATCH
fprintf_filtered (stream, "\n");
}

View File

@ -199,16 +199,15 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
string_file stb;
TRY
try
{
insn_len = gdb_print_insn (gdbarch, pc, &stb, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
if (PyDict_SetItemString (insn_dict.get (), "addr",
gdb_py_long_from_ulongest (pc))

View File

@ -138,18 +138,17 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
if (cmp < 0)
return -1;
TRY
try
{
if (cmp == 1)
enable_breakpoint (self_bp->bp);
else
disable_breakpoint (self_bp->bp);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_SET_HANDLE_EXCEPTION (except);
}
END_CATCH
return 0;
}
@ -247,15 +246,14 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
if (! gdb_py_int_as_long (newvalue, &id))
return -1;
TRY
try
{
valid_id = valid_task_id (id);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_SET_HANDLE_EXCEPTION (except);
}
END_CATCH
if (! valid_id)
{
@ -290,15 +288,14 @@ bppy_delete_breakpoint (PyObject *self, PyObject *args)
BPPY_REQUIRE_VALID (self_bp);
TRY
try
{
delete_breakpoint (self_bp->bp);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
Py_RETURN_NONE;
}
@ -332,15 +329,14 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
if (value < 0)
value = 0;
TRY
try
{
set_ignore_count (self_bp->number, (int) value, 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_SET_HANDLE_EXCEPTION (except);
}
END_CATCH
return 0;
}
@ -469,15 +465,14 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
exp = exp_holder.get ();
}
TRY
try
{
set_breakpoint_condition (self_bp->bp, exp, 0);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
GDB_PY_SET_HANDLE_EXCEPTION (except);
@ -499,17 +494,16 @@ bppy_get_commands (PyObject *self, void *closure)
string_file stb;
current_uiout->redirect (&stb);
TRY
try
{
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
current_uiout->redirect (NULL);
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
current_uiout->redirect (NULL);
return host_string_to_python_string (stb.c_str ()).release ();
@ -530,7 +524,7 @@ bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
if (commands == nullptr)
return -1;
TRY
try
{
bool first = true;
char *save_ptr = nullptr;
@ -546,11 +540,10 @@ bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
breakpoint_set_commands (self_bp->bp, std::move (lines));
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
GDB_PY_SET_HANDLE_EXCEPTION (except);
@ -801,7 +794,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
bppy_pending_object->number = -1;
bppy_pending_object->bp = NULL;
TRY
try
{
switch (type)
{
@ -871,13 +864,12 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
error(_("Do not understand breakpoint type to set."));
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
bppy_pending_object = NULL;
gdbpy_convert_exception (except);
return -1;
}
END_CATCH
BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
return 0;

View File

@ -541,7 +541,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
gdbpy_ref<> self_ref = gdbpy_ref<>::new_reference (self);
TRY
try
{
struct cmd_list_element *cmd;
@ -572,7 +572,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
set_cmd_completer_handle_brkchars (cmd,
cmdpy_completer_handle_brkchars);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
xfree (cmd_name);
xfree (docstring);
@ -580,7 +580,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
gdbpy_convert_exception (except);
return -1;
}
END_CATCH
return 0;
}

View File

@ -101,7 +101,7 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
if (!self_finishbp->return_type)
return;
TRY
try
{
struct value *function =
value_object_to_value (self_finishbp->function_value);
@ -121,12 +121,11 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
self_finishbp->return_value = Py_None;
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
END_CATCH
}
/* Triggered when gdbpy_should_stop has triggered the `stop' callback
@ -136,18 +135,17 @@ void
bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
{
TRY
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);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
END_CATCH
}
/* Python function to create a new breakpoint. */
@ -172,7 +170,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
&frame_obj, &internal))
return -1;
TRY
try
{
/* Default frame to newest frame if necessary. */
if (frame_obj == NULL)
@ -210,12 +208,11 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
}
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
return -1;
}
END_CATCH
if (PyErr_Occurred ())
return -1;
@ -244,7 +241,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
self_bpfinish->return_type = NULL;
self_bpfinish->function_value = NULL;
TRY
try
{
if (get_frame_pc_if_available (frame, &pc))
{
@ -270,12 +267,11 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
}
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
/* 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)
{
@ -291,7 +287,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
bppy_pending_object->number = -1;
bppy_pending_object->bp = NULL;
TRY
try
{
/* Set a breakpoint on the return address. */
event_location_up location
@ -306,11 +302,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
&bkpt_breakpoint_ops,
0, 1, internal_bp, 0);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
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;
@ -362,19 +357,18 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
/* Check scope if not currently stopped at the FinishBreakpoint. */
if (b != bp_stopped)
{
TRY
try
{
if (b->pspace == current_inferior ()->pspace
&& (!target_has_registers
|| frame_find_by_id (b->frame_id) == NULL))
bpfinishpy_out_of_scope (finish_bp);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
gdbpy_print_stack ();
}
END_CATCH
}
}

View File

@ -95,15 +95,14 @@ frapy_is_valid (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
TRY
try
{
frame = frame_object_to_frame_info (self);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (frame == NULL)
Py_RETURN_FALSE;
@ -122,17 +121,16 @@ frapy_name (PyObject *self, PyObject *args)
enum language lang;
PyObject *result;
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
name = find_frame_funname (frame, &lang, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (name)
{
@ -157,17 +155,16 @@ frapy_type (PyObject *self, PyObject *args)
struct frame_info *frame;
enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
type = get_frame_type (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return PyInt_FromLong (type);
}
@ -181,15 +178,14 @@ frapy_arch (PyObject *self, PyObject *args)
struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
frame_object *obj = (frame_object *) self;
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return gdbarch_to_arch_object (obj->gdbarch);
}
@ -203,15 +199,14 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args)
struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
enum unwind_stop_reason stop_reason;
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
stop_reason = get_frame_unwind_stop_reason (frame);
@ -227,17 +222,16 @@ frapy_pc (PyObject *self, PyObject *args)
CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
struct frame_info *frame;
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
pc = get_frame_pc (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return gdb_py_long_from_ulongest (pc);
}
@ -254,7 +248,7 @@ frapy_read_register (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "s", &regnum_str))
return NULL;
TRY
try
{
struct frame_info *frame;
int regnum;
@ -270,11 +264,10 @@ frapy_read_register (PyObject *self, PyObject *args)
if (val == NULL)
PyErr_SetString (PyExc_ValueError, _("Unknown register."));
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return val == NULL ? NULL : value_to_value_object (val);
}
@ -288,16 +281,15 @@ frapy_block (PyObject *self, PyObject *args)
struct frame_info *frame;
const struct block *block = NULL, *fn_block;
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
block = get_frame_block (frame, NULL);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
for (fn_block = block;
fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
@ -330,7 +322,7 @@ frapy_function (PyObject *self, PyObject *args)
struct symbol *sym = NULL;
struct frame_info *frame;
TRY
try
{
enum language funlang;
@ -339,11 +331,10 @@ frapy_function (PyObject *self, PyObject *args)
gdb::unique_xmalloc_ptr<char> funname
= find_frame_funname (frame, &funlang, &sym);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (sym)
return symbol_to_symbol_object (sym);
@ -362,7 +353,7 @@ frame_info_to_frame_object (struct frame_info *frame)
if (frame_obj == NULL)
return NULL;
TRY
try
{
/* Try to get the previous frame, to determine if this is the last frame
@ -382,12 +373,11 @@ frame_info_to_frame_object (struct frame_info *frame)
}
frame_obj->gdbarch = get_frame_arch (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
return (PyObject *) frame_obj.release ();
}
@ -402,17 +392,16 @@ frapy_older (PyObject *self, PyObject *args)
struct frame_info *frame, *prev = NULL;
PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
prev = get_prev_frame (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (prev)
prev_obj = frame_info_to_frame_object (prev);
@ -435,17 +424,16 @@ frapy_newer (PyObject *self, PyObject *args)
struct frame_info *frame, *next = NULL;
PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
next = get_next_frame (frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (next)
next_obj = frame_info_to_frame_object (next);
@ -467,18 +455,17 @@ frapy_find_sal (PyObject *self, PyObject *args)
struct frame_info *frame;
PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
symtab_and_line sal = find_frame_sal (frame);
sal_obj = symtab_and_line_to_sal_object (sal);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return sal_obj;
}
@ -523,7 +510,7 @@ frapy_read_var (PyObject *self, PyObject *args)
}
}
TRY
try
{
struct block_symbol lookup_sym;
FRAPY_REQUIRE_VALID (self, frame);
@ -534,12 +521,11 @@ frapy_read_var (PyObject *self, PyObject *args)
var = lookup_sym.symbol;
block = lookup_sym.block;
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
if (!var)
{
@ -556,17 +542,16 @@ frapy_read_var (PyObject *self, PyObject *args)
return NULL;
}
TRY
try
{
FRAPY_REQUIRE_VALID (self, frame);
val = read_var_value (var, block, frame);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return value_to_value_object (val);
}
@ -578,17 +563,16 @@ frapy_select (PyObject *self, PyObject *args)
{
struct frame_info *fi;
TRY
try
{
FRAPY_REQUIRE_VALID (self, fi);
select_frame (fi);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
Py_RETURN_NONE;
}
@ -601,15 +585,14 @@ gdbpy_newest_frame (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
TRY
try
{
frame = get_current_frame ();
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return frame_info_to_frame_object (frame);
}
@ -622,15 +605,14 @@ gdbpy_selected_frame (PyObject *self, PyObject *args)
{
struct frame_info *frame = NULL;
TRY
try
{
frame = get_selected_frame ("No frame is currently selected.");
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return frame_info_to_frame_object (frame);
}

View File

@ -1081,16 +1081,15 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
if (!gdb_python_initialized)
return EXT_LANG_BT_NO_FILTERS;
TRY
try
{
gdbarch = get_frame_arch (frame);
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
/* Let gdb try to print the stack trace. */
return EXT_LANG_BT_NO_FILTERS;
}
END_CATCH
gdbpy_enter enter_py (gdbarch, current_language);
@ -1166,17 +1165,16 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
}
}
TRY
try
{
success = py_print_frame (item.get (), flags, args_type, out, 0,
levels_printed.get ());
}
CATCH (except, RETURN_MASK_ERROR)
catch (const gdb_exception_RETURN_MASK_ERROR &except)
{
gdbpy_convert_exception (except);
success = EXT_LANG_BT_ERROR;
}
END_CATCH
/* Do not exit on error printing a single frame. Print the
error and continue with other frames. */

View File

@ -39,12 +39,12 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
int n;
char *p = NULL, *q;
TRY
try
{
p = command_line_input (prompt, "python");
}
/* Handle errors by raising Python exceptions. */
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
/* Detect user interrupt (Ctrl-C). */
if (except.reason == RETURN_QUIT)
@ -59,7 +59,6 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
PyEval_SaveThread ();
return NULL;
}
END_CATCH
/* Detect EOF (Ctrl-D). */
if (p == NULL)

View File

@ -389,15 +389,14 @@ infpy_threads (PyObject *self, PyObject *args)
INFPY_REQUIRE_VALID (inf_obj);
TRY
try
{
update_thread_list ();
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
tuple = PyTuple_New (inf_obj->nthreads);
if (!tuple)
@ -508,17 +507,16 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
|| get_addr_from_python (length_obj, &length) < 0)
return NULL;
TRY
try
{
buffer.reset ((gdb_byte *) xmalloc (length));
read_memory (addr, buffer.get (), length);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
gdbpy_ref<membuf_object> membuf_obj (PyObject_New (membuf_object,
&membuf_object_type));
@ -572,15 +570,14 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
else if (get_addr_from_python (length_obj, &length) < 0)
return nullptr;
TRY
try
{
write_memory_with_notification (addr, buffer, length);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
GDB_PY_HANDLE_EXCEPTION (except);
@ -725,17 +722,16 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
return nullptr;
}
TRY
try
{
found = target_search_memory (start_addr, length,
buffer, pattern_size,
&found_addr);
}
CATCH (ex, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &ex)
{
except = ex;
}
END_CATCH
GDB_PY_HANDLE_EXCEPTION (except);
@ -782,7 +778,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
TRY
try
{
struct thread_info *thread_info;
struct value *val = value_object_to_value (handle_obj);
@ -791,11 +787,10 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
if (thread_info != NULL)
return thread_to_thread_object (thread_info).release ();
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
Py_RETURN_NONE;
}

View File

@ -181,15 +181,14 @@ thpy_switch (PyObject *self, PyObject *args)
THPY_REQUIRE_VALID (thread_obj);
TRY
try
{
switch_to_thread (thread_obj->thread);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
Py_RETURN_NONE;
}

View File

@ -113,7 +113,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
return NULL;
}
TRY
try
{
struct type *type = type_object_to_type (self_string->type);
struct type *realtype;
@ -142,11 +142,10 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
break;
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return value_to_value_object (val);
}

View File

@ -164,15 +164,14 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
return NULL;
TRY
try
{
pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
return build_line_table_tuple_from_pcs (py_line, pcs);
}

View File

@ -130,15 +130,14 @@ objfpy_get_build_id (PyObject *self, void *closure)
OBJFPY_REQUIRE_VALID (obj);
TRY
try
{
build_id = build_id_bfd_get (objfile->obfd);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (build_id != NULL)
{
@ -421,17 +420,16 @@ objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
return NULL;
TRY
try
{
gdb_bfd_ref_ptr abfd (symfile_bfd_open (file_name));
symbol_file_add_separate (abfd.get (), file_name, 0, obj->objfile);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
Py_RETURN_NONE;
}

View File

@ -726,21 +726,20 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
Py_INCREF (self);
TRY
try
{
add_setshow_generic (parmclass, (enum command_class) cmdtype,
cmd_name, obj,
set_doc.get (), show_doc.get (),
doc.get (), set_list, show_list);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
xfree (cmd_name);
Py_DECREF (self);
gdbpy_convert_exception (except);
return -1;
}
END_CATCH
return 0;
}

View File

@ -190,7 +190,7 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
gdbpy_ref<> result;
*out_value = NULL;
TRY
try
{
if (!PyObject_HasAttr (printer, gdbpy_to_string_cst))
result = gdbpy_ref<>::new_reference (Py_None);
@ -212,10 +212,9 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
}
}
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
}
END_CATCH
return result;
}
@ -637,15 +636,14 @@ apply_varobj_pretty_printer (PyObject *printer_obj,
gdbpy_ref<>
gdbpy_get_varobj_pretty_printer (struct value *value)
{
TRY
try
{
value = value_copy (value);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception_RETURN_MASK_ALL &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
gdbpy_ref<> val_obj (value_to_value_object (value));
if (val_obj == NULL)

Some files were not shown because too many files have changed in this diff Show More