From patchwork Thu Feb 26 11:20:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5305 Received: (qmail 55766 invoked by alias); 26 Feb 2015 11:20:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 55754 invoked by uid 89); 26 Feb 2015 11:20:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 Feb 2015 11:20:57 +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 t1QBKnPf007307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Feb 2015 06:20:49 -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 t1QBKm9b012649; Thu, 26 Feb 2015 06:20:48 -0500 Message-ID: <54EF018F.7000300@redhat.com> Date: Thu, 26 Feb 2015 11:20:47 +0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: John Baldwin , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] Fix infinite recursion in amd64fbsd_sigcontext_addr(). References: <2821594.BvgdgVAvXD@ralph.baldwin.cx> In-Reply-To: <2821594.BvgdgVAvXD@ralph.baldwin.cx> Thanks. Added commit log and ChangeLog and pushed, as below. From c5cb74eeb3ea13a9fbeb0ec26b5bad10c4b92e4a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 26 Feb 2015 11:07:57 +0000 Subject: [PATCH 1/2] Fix infinite recursion in amd64fbsd_sigcontext_addr amd64fbsd_sigcontext_addr is using frame_unwind_register_unsigned to fetch the stack pointer which results in infinite recursion. This patch changes it to use get_frame_register to match the sigcontext_addr methods in the i386-bsd and amd64-linux targets instead. gdb/ChangeLog: 2015-02-25 John Baldwin * amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use get_frame_register instead of frame_unwind_register_unsigned. --- gdb/ChangeLog | 5 +++++ gdb/amd64fbsd-tdep.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1aa6fc1..b024d23 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-02-25 John Baldwin + + * amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use + get_frame_register instead of frame_unwind_register_unsigned. + 2015-02-26 Jan Kratochvil PR build/18033 diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c index 2d49cdf..abb0cab 100644 --- a/gdb/amd64fbsd-tdep.c +++ b/gdb/amd64fbsd-tdep.c @@ -37,12 +37,16 @@ static CORE_ADDR amd64fbsd_sigcontext_addr (struct frame_info *this_frame) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR sp; + gdb_byte buf[8]; /* The `struct sigcontext' (which really is an `ucontext_t' on FreeBSD/amd64) lives at a fixed offset in the signal frame. See . */ - sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM); + get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); + sp = extract_unsigned_integer (buf, 8, byte_order); return sp + 16; }