From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11090 invoked by alias); 5 Jun 2012 19:52:29 -0000 Received: (qmail 11079 invoked by uid 22791); 5 Jun 2012 19:52:28 -0000 X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,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; Tue, 05 Jun 2012 19:52:07 +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 q55Jq79Q023106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Jun 2012 15:52:07 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q55Jq09w023836; Tue, 5 Jun 2012 15:52:06 -0400 Message-ID: <4FCE6360.5040307@redhat.com> Date: Tue, 05 Jun 2012 19:52:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Jan Kratochvil Subject: Re: [downstream patch FYI] workaround stale frame_info * (PR 13866) References: <20120404191416.GA29603@host2.jankratochvil.net> <4FCE5CDF.7070407@redhat.com> In-Reply-To: <4FCE5CDF.7070407@redhat.com> 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-06/txt/msg00156.txt.bz2 On 06/05/2012 08:24 PM, Pedro Alves wrote: > This fixes the crash. I actually posted an outdated version before... This version adds a little comment. I've applied it. 2012-06-05 Pedro Alves PR backtrace/13866 * breakpoint.c (until_break_command): Only fetch the selected frame after decode_line_1. --- gdb/breakpoint.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5cc1f64..12db39b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10815,10 +10815,10 @@ 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 *frame_gdbarch = get_frame_arch (frame); - struct frame_id stack_frame_id = get_stack_frame_id (frame); - struct frame_id caller_frame_id = frame_unwind_caller_id (frame); + struct frame_info *frame; + struct gdbarch *frame_gdbarch; + struct frame_id stack_frame_id; + struct frame_id caller_frame_id; struct breakpoint *breakpoint; struct breakpoint *breakpoint2 = NULL; struct cleanup *old_chain; @@ -10854,8 +10854,15 @@ until_break_command (char *arg, int from_tty, int anywhere) 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. */ + /* Note linespec handling above invalidates the frame chain. + Installing a breakpoint also invalidates the frame chain (as it + may need to switch threads), so do any frame handling before + that. */ + + frame = get_selected_frame (NULL); + frame_gdbarch = get_frame_arch (frame); + stack_frame_id = get_stack_frame_id (frame); + caller_frame_id = frame_unwind_caller_id (frame); /* Keep within the current frame, or in frames called by the current one. */