From: Alexandre Oliva Date: Fri, 2 Aug 2019 18:40:32 +0000 (-0300) Subject: support Ada EH ABI v1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca683e3a86d081fcf43685bee840086bd4c07443;p=binutils-gdb.git support Ada EH ABI v1 A new pair of hooks used by Ada exception handlers, for correct release of reraised exception occurrences, involves the introduction of new v1 symbols that GDB should use when available. The older, v0 ABI remains available in newer runtimes for bootstrapping purposes only. for gdb/ChangeLog * ada-lang.c (exception_support_info_v0): Renamed from... (default_exception_support_info): ... this. Create new definition for v1. (ada_has_this_exception_support): Look up catch_handlers_sym. (ada_exception_support_info_sniffer): Try v0 after default. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7dcbe7e2c2e..27c310e7551 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2019-08-02 Alexandre Oliva + + * ada-lang.c (exception_support_info_v0): Renamed from... + (default_exception_support_info): ... this. Create new + definition for v1. + (ada_has_this_exception_support): Look up catch_handlers_sym. + (ada_exception_support_info_sniffer): Try v0 after default. + 2019-08-01 Tom Tromey * ia64-libunwind-tdep.h (struct libunwind_descr): Include diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 7a5cc4272c6..15a7a902b82 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11867,9 +11867,22 @@ static CORE_ADDR ada_unhandled_exception_name_addr_from_raise (void); /* The following exception support info structure describes how to implement exception catchpoints with the latest version of the - Ada runtime (as of 2007-03-06). */ + Ada runtime (as of 2019-08-??). */ static const struct exception_support_info default_exception_support_info = +{ + "__gnat_debug_raise_exception", /* catch_exception_sym */ + "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */ + "__gnat_debug_raise_assert_failure", /* catch_assert_sym */ + "__gnat_begin_handler_v1", /* catch_handlers_sym */ + ada_unhandled_exception_name_addr +}; + +/* The following exception support info structure describes how to + implement exception catchpoints with an earlier version of the + Ada runtime (as of 2007-03-06) using v0 of the EH ABI. */ + +static const struct exception_support_info exception_support_info_v0 = { "__gnat_debug_raise_exception", /* catch_exception_sym */ "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */ @@ -11938,8 +11951,34 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) /* Make sure that the symbol we found corresponds to a function. */ if (SYMBOL_CLASS (sym) != LOC_BLOCK) - error (_("Symbol \"%s\" is not a function (class = %d)"), - SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym)); + { + error (_("Symbol \"%s\" is not a function (class = %d)"), + SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym)); + return 0; + } + + sym = standard_lookup (einfo->catch_handlers_sym, NULL, VAR_DOMAIN); + if (sym == NULL) + { + struct bound_minimal_symbol msym + = lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL); + + if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline) + error (_("Your Ada runtime appears to be missing some debugging " + "information.\nCannot insert Ada exception catchpoint " + "in this configuration.")); + + return 0; + } + + /* Make sure that the symbol we found corresponds to a function. */ + + if (SYMBOL_CLASS (sym) != LOC_BLOCK) + { + error (_("Symbol \"%s\" is not a function (class = %d)"), + SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym)); + return 0; + } return 1; } @@ -11966,6 +12005,13 @@ ada_exception_support_info_sniffer (void) return; } + /* Try the v0 exception suport info. */ + if (ada_has_this_exception_support (&exception_support_info_v0)) + { + data->exception_info = &exception_support_info_v0; + return; + } + /* Try our fallback exception suport info. */ if (ada_has_this_exception_support (&exception_support_info_fallback)) {