From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115266 invoked by alias); 22 May 2018 14:39:43 -0000 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 Received: (qmail 115214 invoked by uid 89); 22 May 2018 14:39:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 May 2018 14:39:40 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 410F3117B84; Tue, 22 May 2018 10:39:39 -0400 (EDT) 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 6j4vfKOwx59J; Tue, 22 May 2018 10:39:39 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 2E3BF117B81; Tue, 22 May 2018 10:39:39 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4233) id 2D0E54F3; Tue, 22 May 2018 10:39:39 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed/Ada] fix "stale cleanup" internal-warning when using "catch assert" command Date: Tue, 22 May 2018 14:50:00 -0000 Message-Id: <1526999977-126638-2-git-send-email-brobecker@adacore.com> In-Reply-To: <1526999977-126638-1-git-send-email-brobecker@adacore.com> References: <1526999977-126638-1-git-send-email-brobecker@adacore.com> X-SW-Source: 2018-05/txt/msg00557.txt.bz2 Trying to insert a catchpoint on all Ada assertions now triggers the following internal warning regardless of the situation. For instance, not even debugging any program: (gdb) catch assert /[...]/gdb/common/cleanups.c:264: internal-warning: restore_my_cleanups has found a stale cleanup This is due to a small bug in the following C++-ification commit: commit bc18fbb575437dd10089ef4619e46c0b9a93097d Date: Fri May 18 15:58:50 2018 -0600 Subject: Change ada_catchpoint::excep_string to be a std::string The stale cleanup in question is the following one in top.c:execute_command: cleanup_if_error = make_bpstat_clear_actions_cleanup (); This cleanup is expected to be discarded if there are no exception. There were no GDB exception; however, a C++ exception was triggered, because we passed NULL as the excep_string argument when calling create_ada_exception_catchpoint, which is a reference to a const string. So we get a C++ exception during the std::string constructor, which propagates up, causing the cleanup to unexpectedly remain in the cleanup chain. This patch fixes the immediate issue of the incorrect call to create_ada_exception_catchpoint. gdb/ChangeLog: * ada-lang.c (catch_assert_command): Pass empty string instead of NULL for excep_string argument. Tested on x86_64-linux, fixes the following failures: * catch_assert_if.exp: insert catchpoint on failed assertions with condition * catch_ex.exp: insert catchpoint on failed assertions This also fixes about a dozen UNRESOLVED tests that are a consequence of the two tests above failing and crashing GDB. Pushed to master. --- gdb/ChangeLog | 5 +++++ gdb/ada-lang.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8d425a7..653771a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-05-22 Joel Brobecker + + * ada-lang.c (catch_assert_command): Pass empty string instead + of NULL for excep_string argument. + 2018-05-22 Maciej W. Rozycki * mips-linux-nat.c (mips64_linux_register_addr): Return -1 if diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index eaf3058..64bddc2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13408,7 +13408,7 @@ catch_assert_command (const char *arg_entry, int from_tty, arg = ""; catch_ada_assert_command_split (arg, cond_string); create_ada_exception_catchpoint (gdbarch, ada_catch_assert, - NULL, cond_string, + "", cond_string, tempflag, 1 /* enabled */, from_tty); } -- 2.1.4