Warn if missing debug info for Ada exception catchpoints
authorJoel Brobecker <brobecker@gnat.com>
Sun, 11 Dec 2011 17:36:10 +0000 (17:36 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Sun, 11 Dec 2011 17:36:10 +0000 (17:36 +0000)
This patch should help the user understand why the debugger is not
able to insert Ada exception catchpoints when the Ada runtime was
stripped of debugging info, as is often the case on many GNU/Linux
distros:

    (gdb) catch exception
    Your Ada runtime appears to be missing some debugging information.
    Cannot insert Ada exception catchpoint in this configuration.

gdb/ChangeLog:

        * ada-lang.c (ada_has_this_exception_support): Raise an error
        if we could find the Ada exception hook in the Ada runtime,
        but no debugging info for that hook.

gdb/testsuite/ChangeLog:

        * gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp: Adjust
        expected output for unsupported case.

gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/catch_ex.exp
gdb/testsuite/gdb.ada/mi_catch_ex.exp

index cbd770bc087816d9564277874cf891565886433e..31397e09921113932c57a2c5627476b050641740 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-11  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.c (ada_has_this_exception_support): Raise an error
+       if we could find the Ada exception hook in the Ada runtime,
+       but no debugging info for that hook.
+
 2011-12-11  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-lang.c (ada_has_this_exception_support): New function,
index 66d74201246e33542b6f0e4ca0329e6c61b4ea03..1a3a975f56fa44e0ef2539fb0ac9d07c6711327c 100644 (file)
@@ -10659,7 +10659,28 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
 
   sym = standard_lookup (einfo->catch_exception_sym, NULL, VAR_DOMAIN);
   if (sym == NULL)
-    return 0;
+    {
+      /* Perhaps we did not find our symbol because the Ada runtime was
+        compiled without debugging info, or simply stripped of it.
+        It happens on some GNU/Linux distributions for instance, where
+        users have to install a separate debug package in order to get
+        the runtime's debugging info.  In that situation, let the user
+        know why we cannot insert an Ada exception catchpoint.
+
+        Note: Just for the purpose of inserting our Ada exception
+        catchpoint, we could rely purely on the associated minimal symbol.
+        But we would be operating in degraded mode anyway, since we are
+        still lacking the debugging info needed later on to extract
+        the name of the exception being raised (this name is printed in
+        the catchpoint message, and is also used when trying to catch
+        a specific exception).  We do not handle this case for now.  */
+      if (lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL))
+       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.  */
 
index 1a02cf9fac68570f74a7dd7901ac499450be1411..f95ac4d3d8cb3e8b860f352fa350043096b606ed 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-11  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp: Adjust
+       expected output for unsupported case.
+
 2011-12-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        PR testsuite/12649
index 0ea32568ebc74120fd1b06894b5970090ccee51e..0cb88748e2029dde4596ada1a973def1baf34630 100644 (file)
@@ -56,7 +56,7 @@ gdb_test_multiple "catch exception" $msg {
     -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" {
        pass $msg
     }
-    -re "Cannot (insert catchpoints|break on __gnat_raise_nodefer_with_msg) in this configuration\.$eol$gdb_prompt $" {
+    -re "Your Ada runtime appears to be missing some debugging information.*$eol$gdb_prompt $" {
        # If the runtime was not built with enough debug information,
        # or if it was stripped, we can not test exception
        # catchpoints.
index 4be1cad98aae54a7df892a61ad6ab2c8f14473c3..584cc001eaaa138374a6a82021b63acfdee2e432 100644 (file)
@@ -46,7 +46,7 @@ gdb_test_multiple "catch exception" $msg {
     -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" {
        pass $msg
     }
-    -re "Cannot (insert catchpoints|break on __gnat_raise_nodefer_with_msg) in this configuration\.\[\r\n\]+$gdb_prompt $" {
+    -re "Your Ada runtime appears to be missing some debugging information.*\[\r\n\]+$gdb_prompt $" {
        # If the runtime was not built with enough debug information,
        # or if it was stripped, we can not test exception
        # catchpoints.
This page took 0.085528 seconds and 4 git commands to generate.