From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28015 invoked by alias); 17 Apr 2013 21:26:02 -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 28005 invoked by uid 89); 17 Apr 2013 21:26:02 -0000 X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 17 Apr 2013 21:26:01 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3HLPhqW028154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Apr 2013 17:25:44 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3HLPg6S025640; Wed, 17 Apr 2013 17:25:43 -0400 Message-ID: <516F1356.6030204@redhat.com> Date: Thu, 18 Apr 2013 11:09:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: "Abid, Hafiz" CC: gdb-patches@sourceware.org Subject: Re: [patch] circ.exp References: <1366214779.30939.1@abidh-ubunto1104> <516F11B9.8030202@redhat.com> In-Reply-To: <516F11B9.8030202@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00555.txt.bz2 On 04/17/2013 10:18 PM, Pedro Alves wrote: > I see. The issue is that when haven't collected any registers in the > the tracepoint (collect $regs), we end up with a frames that are > un-unwindable (UNWIND_UNAVAILABLE). All frames in that case have the same > id (outer_frame_id), even if they represent different functions. I started > out with a local fix in tfind_1, but that got ugly quick. Below's that version. It feels very much like a workaround. outer_frame_id should die. > I think we should fix this in the frame machinery itself. --- gdb/tracepoint.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 4113999..fa2ce5d 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2270,6 +2270,9 @@ tfind_1 (enum trace_find_type type, int num, struct frame_id old_frame_id = null_frame_id; struct tracepoint *tp; struct ui_out *uiout = current_uiout; + enum unwind_stop_reason old_frame_stop_reason = UNWIND_NO_REASON; + int old_frame_func_pc_p = 0; + CORE_ADDR old_frame_func_pc; /* Only try to get the current stack frame if we have a chance of succeeding. In particular, if we're trying to get a first trace @@ -2279,7 +2282,17 @@ tfind_1 (enum trace_find_type type, int num, trace frame. */ if (!(type == tfind_number && num == -1) && (has_stack_frames () || traceframe_number >= 0)) - old_frame_id = get_frame_id (get_current_frame ()); + { + struct frame_info *frame = get_current_frame (); + + old_frame_id = get_frame_id (frame); + + get_prev_frame (frame); + old_frame_stop_reason = get_frame_unwind_stop_reason (frame); + + old_frame_func_pc_p = get_frame_func_if_available (frame, + &old_frame_func_pc); + } target_frameno = target_trace_find (type, num, addr1, addr2, &target_tracept); @@ -2384,8 +2397,19 @@ tfind_1 (enum trace_find_type type, int num, function and it's arguments) -- otherwise we'll just show the new source line. */ - if (frame_id_eq (old_frame_id, - get_frame_id (get_current_frame ()))) + struct frame_info *frame = get_current_frame (); + CORE_ADDR frame_func_pc; + + get_prev_frame (frame); + + if ((old_frame_stop_reason == UNWIND_UNAVAILABLE + || get_frame_unwind_stop_reason (frame) == UNWIND_UNAVAILABLE) + && ((old_frame_func_pc_p + != get_frame_func_if_available (frame, &frame_func_pc)) + || old_frame_func_pc != frame_func_pc)) + print_what = SRC_AND_LOC; + else if (frame_id_eq (old_frame_id, + get_frame_id (get_current_frame ()))) print_what = SRC_LINE; else print_what = SRC_AND_LOC;