This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 03/17] arm-tdep.c: Move debug printout from decode to copy function
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Thu, 9 Jun 2016 08:56:01 -0400
- Subject: [PATCH v2 03/17] arm-tdep.c: Move debug printout from decode to copy function
- Authentication-results: sourceware.org; auth=none
- References: <1465476975-25062-1-git-send-email-antoine dot tremblay at ericsson dot com>
From: Simon Marchi <simon.marchi@ericsson.com>
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
--
2.8.1