From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5977 invoked by alias); 17 Nov 2008 19:51:01 -0000 Received: (qmail 5885 invoked by uid 22791); 17 Nov 2008 19:51:01 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate1.de.ibm.com (HELO mtagate1.de.ibm.com) (195.212.17.161) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 17 Nov 2008 19:50:16 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.1/8.13.1) with ESMTP id mAHJoDLO006365 for ; Mon, 17 Nov 2008 19:50:13 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mAHJoDSd4030676 for ; Mon, 17 Nov 2008 20:50:13 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mAHJoDTu012393 for ; Mon, 17 Nov 2008 20:50:13 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id mAHJoD5O012390; Mon, 17 Nov 2008 20:50:13 +0100 Message-Id: <200811171950.mAHJoD5O012390@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 17 Nov 2008 20:50:13 +0100 Subject: Re: [RFA] fix popping of dummy frame if inferior gets signal with unwindonsignal To: dje@google.com (Doug Evans) Date: Tue, 18 Nov 2008 00:00:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20081116011325.DE3CB4125E1@localhost> from "Doug Evans" at Nov 15, 2008 05:13:25 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2008-11/txt/msg00442.txt.bz2 Doug Evans wrote: > Hi. This fixes a bug where a signal in an inferior function call with > unwindonsignal set doesn't remove the dummy frame from dummy_frame_stack. > A testcase is included to exercise the bug. I agree that it would be better if call_function_by_hand were to call dummy_frame_pop in this case. However, why exactly is this a bug? In general, the list of dummy frames is expected to occasionally contains stale entries (e.g. if the inferior jumped out of an inferior call via longjmp). Your test case only uses "maint pring dummy-frames" to verify the dummy frame list -- apart from this, was there any actual problem you experienced due to this issue? > /* We must get back to the frame we were before the > - dummy call. */ > - frame_pop (get_current_frame ()); > + dummy call. > + NOTE: This discards the regcache recorded in the dummy frame > + but that's ok, the registers will get restored from the > + regcache in inf_status (which gets called by a cleanup). */ > + dummy_frame_pop (dummy_id); > + reinit_frame_cache (); Why the reinit_frame_cache here? Michael Synder wrote: > I don't understand why calling dummy_frame_pop directly works, > but calling frame_pop doesn't work. Doesn't frame_pop call > dummy_frame_pop? If not, what prevents it? frame_pop will call dummy_frame_pop if you pop the dummy frame directly. However, in this case, frame_pop (get_current_frame ()) only pops the current frame during the inferior call sequence, and the dummy frame is somewhere higher on the stack. I guess you could do a frame_pop (find_frame_by_id (dummy_id)) instead, but as Doug points out this is not really needed because of the outstanding inf_status cleanup. On the other hand, I'm wondering if we really need the inf_status cleanup in the first place. It supposed to protect against errors during the initial setup of the registers, see the comment in infrun.c: /* These are here because if call_function_by_hand has written some registers and then decides to call error(), we better not have changed any registers. */ struct regcache *registers; I'm not sure what the point is of having two copies of the regcache preserved across the full extent of the inferior call ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com