From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11030 invoked by alias); 16 Jan 2014 18:20:20 -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 11020 invoked by uid 89); 16 Jan 2014 18:20:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2014 18:20:18 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0GIKFgb016684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Jan 2014 13:20:16 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0GIKCqZ022861; Thu, 16 Jan 2014 13:20:13 -0500 Message-ID: <52D822DC.8000205@redhat.com> Date: Thu, 16 Jan 2014 18:20:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Sergio Durigan Junior CC: Yao Qi , GDB Patches Subject: Re: [PATCH] Fix gdb.trace/mi-traceframe-changed.exp to check for target trace support References: <52CF4B40.3030500@codesourcery.com> <52CF57CF.9030503@codesourcery.com> <52CFD221.3050100@redhat.com> <52D04291.2000901@redhat.com> <52D41081.7050907@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-01/txt/msg00637.txt.bz2 On 01/15/2014 08:37 PM, Sergio Durigan Junior wrote: > Yes, confirming that it passes with the patch. Sorry for taking long to > test, I had issues trying to get another s390x machine to test it. > > Thanks for the patch and the further investigation. Thank you. Patch is now pushed, as below. ------ Fix gdb.trace/mi-traceframe-changed.exp on s390. The test fails on s390 with: -trace-find frame-number 0^M &"PC not available\n"^M ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="",func="??",args=[]}^M (gdb) ^M FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: -trace-find frame-number 0 tfile knows to infer the PC from the tracepoint's address if the PC wasn't collected (tfile_fetch_registers) but, that only works on targets whose PC register is a raw register, and on s390, the PC register is a pseudo register. But even if GDB doesn't know how to infer the value of PC, saying the current frame is level -1 is a bug: ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="",func="??",args=[]}^M ^^^^^^^^^ '-1' is the level of the sentinel frame, which should never be visible. This is caused by the s390's heuristic unwinder accepting the frame (the fallback heuristic unwinders _always_ accept the frame), but then the unwind->this_id method throws that "PC not available\n" error. IOW, the s390's heuristic unwinder was never adjusted to handle unavailable register values gracefully, which can happen with e.g., a trimmed core file too. This is just the minimal necessary for frames, which at least gets us: (gdb) tfind Found trace frame 0, tracepoint 1 #0 in ?? () That is, frame #0 instead of -1. We could get better info out of "info frame" (this patch makes us show "outermost"), but this change would still be necessary. gdb/ 2014-01-16 Pedro Alves * s390-linux-tdep.c (s390_frame_unwind_cache): Swallow NOT_AVAILABLE_ERROR errors while parsing the prologue or reading the backchain. --- gdb/ChangeLog | 6 ++++++ gdb/s390-linux-tdep.c | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f614f1b..6eef81a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-01-16 Pedro Alves + + * s390-linux-tdep.c (s390_frame_unwind_cache): Swallow + NOT_AVAILABLE_ERROR errors while parsing the prologue or reading + the backchain. + 2014-01-16 Doug Evans * dwarf2read.c (open_and_init_dwp_file): Fix typo in comment. diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index b75c86a..8b71e78 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -2039,7 +2039,9 @@ static struct s390_unwind_cache * s390_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { + volatile struct gdb_exception ex; struct s390_unwind_cache *info; + if (*this_prologue_cache) return *this_prologue_cache; @@ -2050,10 +2052,15 @@ s390_frame_unwind_cache (struct frame_info *this_frame, info->frame_base = -1; info->local_base = -1; - /* Try to use prologue analysis to fill the unwind cache. - If this fails, fall back to reading the stack backchain. */ - if (!s390_prologue_frame_unwind_cache (this_frame, info)) - s390_backchain_frame_unwind_cache (this_frame, info); + TRY_CATCH (ex, RETURN_MASK_ERROR) + { + /* Try to use prologue analysis to fill the unwind cache. + If this fails, fall back to reading the stack backchain. */ + if (!s390_prologue_frame_unwind_cache (this_frame, info)) + s390_backchain_frame_unwind_cache (this_frame, info); + } + if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR) + throw_exception (ex); return info; } -- 1.7.11.7