[binutils-gdb] support Ada EH ABI v1

Alexandre Oliva aoliva@sourceware.org
Fri Aug 2 18:42:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ca683e3a86d081fcf43685bee840086bd4c07443

commit ca683e3a86d081fcf43685bee840086bd4c07443
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Aug 2 15:40:32 2019 -0300

    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:
---
 gdb/ChangeLog  |  8 ++++++++
 gdb/ada-lang.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7dcbe7e..27c310e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2019-08-02  Alexandre Oliva <oliva@adacore.com>
+
+	* 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  <tromey@adacore.com>
 
 	* ia64-libunwind-tdep.h (struct libunwind_descr): Include
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 7a5cc42..15a7a90 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11867,13 +11867,26 @@ 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 */
+  "__gnat_debug_raise_assert_failure", /* catch_assert_sym */
   "__gnat_begin_handler", /* catch_handlers_sym */
   ada_unhandled_exception_name_addr
 };
@@ -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))
     {



More information about the Gdb-cvs mailing list