From patchwork Tue Jun 30 01:06:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Buettner X-Patchwork-Id: 7428 Received: (qmail 111830 invoked by alias); 30 Jun 2015 01:06:08 -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 111821 invoked by uid 89); 30 Jun 2015 01:06:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no 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; Tue, 30 Jun 2015 01:06:07 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 18BE88E779 for ; Tue, 30 Jun 2015 01:06:06 +0000 (UTC) Received: from pinnacle.lan (ovpn-113-20.phx2.redhat.com [10.3.113.20]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5U165j5017640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Mon, 29 Jun 2015 21:06:05 -0400 Date: Mon, 29 Jun 2015 18:06:03 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] Turn on dwarf2 unwinding for Renesas RX architecture Message-ID: <20150629180603.0ac44046@pinnacle.lan> MIME-Version: 1.0 X-IsSubscribed: yes This change turns on dwarf2 unwinding in rx-tdep.c. I found it necessary to add rx_dwarf_reg_to_regnum in order to cause PC to be mapped correctly. gdb/ChangeLog: * rx-tdep.c (RX_PSW_REGNUM): New enum constant. (rx_dwarf_reg_to_regnum): New function. (rx_gdbarch_init): Register rx_dwarf_reg_to_regnum. Use dwarf2 unwinding. --- gdb/ChangeLog | 7 +++++++ gdb/rx-tdep.c | 25 +++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a8aa0ba..74a88db 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-06-29 Kevin Buettner + + * rx-tdep.c (RX_PSW_REGNUM): New enum constant. + (rx_dwarf_reg_to_regnum): New function. + (rx_gdbarch_init): Register rx_dwarf_reg_to_regnum. Use dwarf2 + unwinding. + 2015-06-29 Pedro Alves PR threads/18127 diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c index aa44f7a..11d390b 100644 --- a/gdb/rx-tdep.c +++ b/gdb/rx-tdep.c @@ -45,6 +45,7 @@ enum RX_R4_REGNUM = 4, RX_FP_REGNUM = 6, RX_R15_REGNUM = 15, + RX_PSW_REGNUM = 18, RX_PC_REGNUM = 19, RX_ACC_REGNUM = 25, RX_NUM_REGS = 26 @@ -764,6 +765,23 @@ rx_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) return breakpoint; } +/* Implement the dwarf_reg_to_regnum" gdbarch method. */ + +static int +rx_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) +{ + if (0 <= reg && reg <= 15) + return reg; + else if (reg == 16) + return RX_PSW_REGNUM; + else if (reg == 17) + return RX_PC_REGNUM; + else + internal_error (__FILE__, __LINE__, + _("Undefined dwarf2 register mapping of reg %d"), + reg); +} + /* Allocate and initialize a gdbarch object. */ static struct gdbarch * rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -838,12 +856,11 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single); } + /* DWARF register mapping. */ + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, rx_dwarf_reg_to_regnum); + /* Frame unwinding. */ -#if 0 - /* Note: The test results are better with the dwarf2 unwinder disabled, - so it's turned off for now. */ dwarf2_append_unwinders (gdbarch); -#endif frame_unwind_append_unwinder (gdbarch, &rx_frame_unwind); /* Methods for saving / extracting a dummy frame's ID.