From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19733 invoked by alias); 24 Feb 2012 15:28:25 -0000 Received: (qmail 19683 invoked by uid 22791); 24 Feb 2012 15:28:24 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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, 24 Feb 2012 15:28:06 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1OFS5XP029016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 Feb 2012 10:28:05 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1OFS4kx012091; Fri, 24 Feb 2012 10:28:05 -0500 Message-ID: <4F47AC84.9080807@redhat.com> Date: Fri, 24 Feb 2012 15:37:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org Subject: Re: [patch] Fix another stale frame_info * References: <20120223083743.GA5696@host2.jankratochvil.net> In-Reply-To: <20120223083743.GA5696@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 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: 2012-02/txt/msg00574.txt.bz2 On 02/23/2012 08:37 AM, Jan Kratochvil wrote: > + if (frame_id_p (frame_caller_id)) > + frame_caller_pc = frame_unwind_caller_pc (frame); > + Yeah. If we swap the order we do things, we can avoid needing this bit. WDYT? It seems slightly cleaner to me. Tested on x86_64 Fedora 16. 2012-02-24 Jan Kratochvil Pedro Alves * breakpoint.c (until_break_command): Install breakpoints after all frame manipulations. --- gdb/breakpoint.c | 41 ++++++++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 17 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3740157..fa09238 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9853,6 +9853,8 @@ until_break_command (char *arg, int from_tty, int anywhere) struct symtabs_and_lines sals; struct symtab_and_line sal; struct frame_info *frame = get_selected_frame (NULL); + struct gdbarch *gdbarch = get_frame_arch (frame); + struct frame_id stack_frame_id = get_stack_frame_id (frame); struct breakpoint *breakpoint; struct breakpoint *breakpoint2 = NULL; struct cleanup *old_chain; @@ -9883,32 +9885,25 @@ until_break_command (char *arg, int from_tty, int anywhere) resolve_sal_pc (&sal); - if (anywhere) - /* If the user told us to continue until a specified location, - we don't specify a frame at which we need to stop. */ - breakpoint = set_momentary_breakpoint (get_frame_arch (frame), sal, - null_frame_id, bp_until); - else - /* Otherwise, specify the selected frame, because we want to stop - only at the very same frame. */ - breakpoint = set_momentary_breakpoint (get_frame_arch (frame), sal, - get_stack_frame_id (frame), - bp_until); - - old_chain = make_cleanup_delete_breakpoint (breakpoint); - tp = inferior_thread (); thread = tp->num; + old_chain = make_cleanup (null_cleanup, NULL); + + /* Installing a breakpoint invalidates the frame chain (as it may + need to switch threads), so do any frame handling first. */ + /* Keep within the current frame, or in frames called by the current one. */ if (frame_id_p (frame_unwind_caller_id (frame))) { - sal = find_pc_line (frame_unwind_caller_pc (frame), 0); - sal.pc = frame_unwind_caller_pc (frame); + struct symtab_and_line sal2; + + sal2 = find_pc_line (frame_unwind_caller_pc (frame), 0); + sal2.pc = frame_unwind_caller_pc (frame); breakpoint2 = set_momentary_breakpoint (frame_unwind_caller_arch (frame), - sal, + sal2, frame_unwind_caller_id (frame), bp_until); make_cleanup_delete_breakpoint (breakpoint2); @@ -9917,6 +9912,18 @@ until_break_command (char *arg, int from_tty, int anywhere) make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); } + if (anywhere) + /* If the user told us to continue until a specified location, + we don't specify a frame at which we need to stop. */ + breakpoint = set_momentary_breakpoint (gdbarch, sal, + null_frame_id, bp_until); + else + /* Otherwise, specify the selected frame, because we want to stop + only at the very same frame. */ + breakpoint = set_momentary_breakpoint (gdbarch, sal, + stack_frame_id, bp_until); + make_cleanup_delete_breakpoint (breakpoint); + proceed (-1, TARGET_SIGNAL_DEFAULT, 0); /* If we are running asynchronously, and proceed call above has