[v3,03/18] arm-tdep.c: Move debug printout from decode to copy function

Message ID 1467726030-13020-4-git-send-email-antoine.tremblay@ericsson.com
State New, archived
Headers

Commit Message

Antoine Tremblay July 5, 2016, 1:40 p.m. UTC
  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(-)
  

Patch

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