From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21417 invoked by alias); 11 Dec 2011 17:42:44 -0000 Received: (qmail 21407 invoked by uid 22791); 11 Dec 2011 17:42:43 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Dec 2011 17:42:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 923FE2BB0DB; Sun, 11 Dec 2011 12:42:27 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id pFb-TJ6cb9YM; Sun, 11 Dec 2011 12:42:27 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 7E6912BB0B7; Sun, 11 Dec 2011 12:42:27 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 5B509145615; Sun, 11 Dec 2011 09:42:27 -0800 (PST) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [commit] Warn if missing debug info for Ada exception catchpoints Date: Sun, 11 Dec 2011 17:44:00 -0000 Message-Id: <1323625341-21755-1-git-send-email-brobecker@adacore.com> In-Reply-To: <20111207100101.GC21915@adacore.com> References: <20111207100101.GC21915@adacore.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00332.txt.bz2 This is the second part that takes advantage of the cleanup we just did. 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. Tested on x86_64-linux, with normal and stripped runtime. Checked in. --- gdb/ChangeLog | 6 ++++++ gdb/ada-lang.c | 23 ++++++++++++++++++++++- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.ada/catch_ex.exp | 2 +- gdb/testsuite/gdb.ada/mi_catch_ex.exp | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cbd770b..31397e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2011-12-11 Joel Brobecker + * 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 + * ada-lang.c (ada_has_this_exception_support): New function, extracted out of ada_exception_sal and ada_exception_sal. (ada_exception_support_info_sniffer): Simplify by using diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 97558f1..b3c0a24 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10666,7 +10666,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. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1a02cf9..f95ac4d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-11 Joel Brobecker + + * gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp: Adjust + expected output for unsupported case. + 2011-12-10 Jan Kratochvil PR testsuite/12649 diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp index 0ea3256..0cb8874 100644 --- a/gdb/testsuite/gdb.ada/catch_ex.exp +++ b/gdb/testsuite/gdb.ada/catch_ex.exp @@ -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. diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index 4be1cad..584cc00 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -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. -- 1.7.1