From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25133 invoked by alias); 5 Aug 2011 20:14:46 -0000 Received: (qmail 25122 invoked by uid 22791); 5 Aug 2011 20:14:43 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Aug 2011 20:14:22 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p75KELCo007800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 5 Aug 2011 16:14:21 -0400 Received: from host1.jankratochvil.net (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p75KEJX2018432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 5 Aug 2011 16:14:21 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p75KEIEL023539 for ; Fri, 5 Aug 2011 22:14:18 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p75KEHPG023534 for gdb-patches@sourceware.org; Fri, 5 Aug 2011 22:14:17 +0200 Date: Fri, 05 Aug 2011 20:14:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Do not bpstat_clear_actions on throw_exception Message-ID: <20110805201417.GA23405@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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-08/txt/msg00120.txt.bz2 Hi, as discussed here recently throw_exception does various unwised side effects. This patch is a pre-requisite for the entryval patchset as unavailable entry values is a normal caught silent exception there but it now stops any commands execution. This function was there already during initial import of GDB to CVS. I do not see its reason as any uncaught exception throws through bpstat_do_actions_1 and thus terminates the bpstat evaluation anyway. And it the exception is caught there it is wrong to stop the commands execution. There was also the reset of bpstat->commands but I do not find it related: http://sourceware.org/ml/gdb-patches/2003-12/msg00350.html RFA: protect breakpoint commands from being freed http://sourceware.org/ml/gdb-cvs/2003-12/msg00136.html commit 79dbd81d5190cb413c7c44fdf00a858576f14e7e Author: Jim Blandy Date: Mon Dec 22 03:43:19 2003 +0000 * breakpoint.c (bpstat_do_actions): To ensure that clear_proceed_status doesn't free the command tree we're evaluating out from under us, zero the bpstat's pointer to it, and take care of freeing it ourselves. * cli/cli-script.c (make_cleanup_free_command_lines): Make this function externally visible. * cli/cli-script.h (make_cleanup_free_command_lines): New declaration. No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. Thanks, Jan gdb/ 2011-08-05 Jan Kratochvil * breakpoint.c (bpstat_clear_actions): Remove. * breakpoint.h (bpstat_clear_actions): Remove. * exceptions.c (throw_exception): Remove variable tp, its initialization and the call of bpstat_clear_actions. --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3186,23 +3186,6 @@ bpstat_num (bpstat *bsp, int *num) return 1; } -/* Modify BS so that the actions will not be performed. */ - -void -bpstat_clear_actions (bpstat bs) -{ - for (; bs != NULL; bs = bs->next) - { - decref_counted_command_line (&bs->commands); - bs->commands_left = NULL; - if (bs->old_val != NULL) - { - value_free (bs->old_val); - bs->old_val = NULL; - } - } -} - /* Called when a command is about to proceed the inferior. */ static void --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -895,9 +895,6 @@ extern int bpstat_num (bpstat *, int *); command loop). */ extern void bpstat_do_actions (void); -/* Modify BS so that the actions will not be performed. */ -extern void bpstat_clear_actions (bpstat); - /* Implementation: */ /* Values used to tell the printing routine how to behave for this --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -207,22 +207,9 @@ exceptions_state_mc_action_iter_1 (void) void throw_exception (struct gdb_exception exception) { - struct thread_info *tp = NULL; - quit_flag = 0; immediate_quit = 0; - if (!ptid_equal (inferior_ptid, null_ptid)) - tp = find_thread_ptid (inferior_ptid); - - /* Perhaps it would be cleaner to do this via the cleanup chain (not sure - I can think of a reason why that is vital, though). */ - if (tp != NULL) - { - /* Clear queued breakpoint commands. */ - bpstat_clear_actions (tp->control.stop_bpstat); - } - do_cleanups (ALL_CLEANUPS); /* Jump to the containing catch_errors() call, communicating REASON