diff options
author | Tom Tromey <tom@tromey.com> | 2019-01-24 17:31:21 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-04-08 09:05:37 -0600 |
commit | c5c10118216867e133c132b4f46e19fb6aa9258a (patch) | |
tree | 46b80e4714d51d586f4f11ffc0a33df9e695e6d4 /gdb/common/common-exceptions.c | |
parent | d970ee2bae1925bb9265d37adef0b92e2678d666 (diff) | |
download | binutils-c5c10118216867e133c132b4f46e19fb6aa9258a.zip binutils-c5c10118216867e133c132b4f46e19fb6aa9258a.tar.gz binutils-c5c10118216867e133c132b4f46e19fb6aa9258a.tar.bz2 |
Simplify exception handling
Now that cleanups have been removed, TRY/CATCH can't be SJLJ-based any
more. This patch simplifies the exception handling code, by removing
the non-working variants.
Note that the "pure" C++ exception handling code is removed as well; I
think the route forward must be to change exceptions to be
self-destructing, so that try_scope_depth can simply be removed.
Some longjmp-based code remains, as it is needed to throw an exception
through readline.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* common/common-exceptions.h (GDB_XCPT_SJMP, GDB_XCPT_TRY)
(GDB_XCPT_RAW_TRY, GDB_XCPT): Remove.
(TRY, CATCH, END_CATCH): Remove some definitions.
* common/common-exceptions.c: Don't use GDB_XCPT.
(catcher_list_size): Remove.
(throw_exception, throw_it): Simplify.
Diffstat (limited to 'gdb/common/common-exceptions.c')
-rw-r--r-- | gdb/common/common-exceptions.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c index 4e67e89..c3529c9 100644 --- a/gdb/common/common-exceptions.c +++ b/gdb/common/common-exceptions.c @@ -54,26 +54,6 @@ struct catcher /* Where to go for throw_exception(). */ static struct catcher *current_catcher; -#if GDB_XCPT == GDB_XCPT_SJMP - -/* Return length of current_catcher list. */ - -static int -catcher_list_size (void) -{ - int size; - struct catcher *catcher; - - for (size = 0, catcher = current_catcher; - catcher != NULL; - catcher = catcher->prev) - ++size; - - return size; -} - -#endif - jmp_buf * exceptions_state_mc_init (void) { @@ -205,8 +185,6 @@ exceptions_state_mc_action_iter_1 (void) return exceptions_state_mc (CATCH_ITER_1); } -#if GDB_XCPT != GDB_XCPT_SJMP - /* How many nested TRY blocks we have. See exception_messages and throw_it. */ @@ -248,8 +226,6 @@ gdb_exception_sliced_copy (struct gdb_exception *to, const struct gdb_exception *to = *from; } -#endif /* !GDB_XCPT_SJMP */ - /* Return EXCEPTION to the nearest containing CATCH_SJLJ block. */ void @@ -263,8 +239,6 @@ throw_exception_sjlj (struct gdb_exception exception) longjmp (current_catcher->buf, exception.reason); } -#if GDB_XCPT != GDB_XCPT_SJMP - /* Implementation of throw_exception that uses C++ try/catch. */ static ATTRIBUTE_NORETURN void @@ -288,16 +262,10 @@ throw_exception_cxx (struct gdb_exception exception) gdb_assert_not_reached ("invalid return reason"); } -#endif - void throw_exception (struct gdb_exception exception) { -#if GDB_XCPT == GDB_XCPT_SJMP - throw_exception_sjlj (exception); -#else throw_exception_cxx (exception); -#endif } /* A stack of exception messages. @@ -321,11 +289,7 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt, { struct gdb_exception e; char *new_message; -#if GDB_XCPT == GDB_XCPT_SJMP - int depth = catcher_list_size (); -#else int depth = try_scope_depth; -#endif gdb_assert (depth > 0); |