aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-04-03 16:02:42 -0600
committerTom Tromey <tom@tromey.com>2019-04-08 09:05:39 -0600
commita70b814420059e1f2de2130d532ddd7b2b2500fc (patch)
treece50952af2443675e67a60508a10c8fd5ab0715c /gdb/compile
parent3d6e9d2336c9ffcedb10f89631981a23dd518e8e (diff)
downloadgdb-a70b814420059e1f2de2130d532ddd7b2b2500fc.zip
gdb-a70b814420059e1f2de2130d532ddd7b2b2500fc.tar.gz
gdb-a70b814420059e1f2de2130d532ddd7b2b2500fc.tar.bz2
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.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-symbols.c15
-rw-r--r--gdb/compile/compile-cplus-symbols.c10
-rw-r--r--gdb/compile/compile-object-load.c5
-rw-r--r--gdb/compile/compile-object-run.c5
4 files changed, 14 insertions, 21 deletions
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 10d9ada..7e76db3 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -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. */
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 4914c7c..1bb3a6f 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -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,
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index db8238d..29542e7 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -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
}
}
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 82b8393..1c4dd20 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -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);