From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84368 invoked by alias); 19 Aug 2015 07:13:57 -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 84330 invoked by uid 89); 19 Aug 2015 07:13:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_05,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; Wed, 19 Aug 2015 07:13:56 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 12F98AFDD8 for ; Wed, 19 Aug 2015 07:13:55 +0000 (UTC) Received: from pinnacle.lan ([10.3.113.17]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7J7Dswn010779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Wed, 19 Aug 2015 03:13:54 -0400 Date: Wed, 19 Aug 2015 07:13:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [PATCH 7/8] Implement unconditional_branch_address method for rl78 Message-ID: <20150819001353.260874d2@pinnacle.lan> In-Reply-To: <20150818235334.1afb0c85@pinnacle.lan> References: <20150818235334.1afb0c85@pinnacle.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00498.txt.bz2 Implement unconditional_branch_address method for rl78. gdb/ChangeLog: * rl78-tdep.c (rl78_unconditional_branch_address): New function. (rl78_gdbarch_init): Register rl78_unconditional_branch_address. --- gdb/rl78-tdep.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index a5861d8..98129cc 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -1365,6 +1365,31 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function, return rl78_make_data_address (sp + 4); } +/* Implement the unconditional_branch_address gdbarch method. */ + +static CORE_ADDR +rl78_unconditional_branch_address (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + int bytes_read; + RL78_Opcode_Decoded opc; + struct rl78_get_opcode_byte_handle opcode_handle; + + opcode_handle.pc = pc; + + bytes_read = rl78_decode_opcode (pc, &opc, rl78_get_opcode_byte, + &opcode_handle); + + if (bytes_read > 0 + && opc.id == RLO_branch + && opc.op[0].type == RL78_Operand_Immediate) + { + LONGEST l = opc.op[0].addend; + + return (CORE_ADDR) l; + } + + return 0; +} /* Allocate and initialize a gdbarch object. */ static struct gdbarch * @@ -1491,6 +1516,10 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Virtual tables. */ set_gdbarch_vbit_in_delta (gdbarch, 1); + /* Unconditional Branch. */ + set_gdbarch_unconditional_branch_address (gdbarch, + rl78_unconditional_branch_address); + return gdbarch; }