From patchwork Thu Jun 9 12:56:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 12905 Received: (qmail 67239 invoked by alias); 9 Jun 2016 12:56:59 -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 67130 invoked by uid 89); 9 Jun 2016 12:56:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 09 Jun 2016 12:56:48 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 29.8C.03614.44769575; Thu, 9 Jun 2016 14:55:32 +0200 (CEST) Received: from elxa4wqvvz1.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.75) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 9 Jun 2016 08:56:28 -0400 From: Antoine Tremblay To: CC: Simon Marchi Subject: [PATCH v2 03/17] arm-tdep.c: Move debug printout from decode to copy function Date: Thu, 9 Jun 2016 08:56:01 -0400 Message-ID: <1465476975-25062-4-git-send-email-antoine.tremblay@ericsson.com> In-Reply-To: <1465476975-25062-1-git-send-email-antoine.tremblay@ericsson.com> References: <1465476975-25062-1-git-send-email-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes From: Simon Marchi To be consistent with the rest of the code, the debug printout should be in thumb_copy_pc_relative_16bit. Also, thumb_decode_pc_relative_16bit will be move out of arm-tdep.c to common code, so it can't contain anything gdb-specific. * arm-tdep.c (thumb_decode_pc_relative_16bit): Move debug print from here... (thumb_copy_pc_relative_16bit): ... to here. --- gdb/arm-tdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 5a0e247..0c05aae 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -6972,9 +6972,13 @@ install_pc_relative (struct arm_insn_reloc_data *data, int rd) } static int -thumb_copy_pc_relative_16bit (struct arm_insn_reloc_data *data, int rd, - unsigned int imm) +thumb_copy_pc_relative_16bit (uint16_t insn, struct arm_insn_reloc_data *data, + int rd, unsigned int imm) { + if (debug_displaced) + fprintf_unfiltered (gdb_stdlog, + "displaced: copying thumb adr r%d, #%d insn %.4x\n", + rd, imm, insn); /* Encoding T2: ADDS Rd, #imm */ data->dsc->modinsn[0] = (0x3000 | (rd << 8) | imm); @@ -6990,12 +6994,7 @@ thumb_decode_pc_relative_16bit (uint16_t insn, struct arm_insn_reloc_data *data) unsigned int rd = bits (insn, 8, 10); unsigned int imm8 = bits (insn, 0, 7); - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, - "displaced: copying thumb adr r%d, #%d insn %.4x\n", - rd, imm8, insn); - - return thumb_copy_pc_relative_16bit (data, rd, imm8); + return thumb_copy_pc_relative_16bit (insn, data, rd, imm8); } static int