[PATCH] [ARC] Pass arc_opcode to GDB as an architecture specific data

Anton Kolesov Anton.Kolesov@synopsys.com
Fri Sep 30 17:33:00 GMT 2016


To do prologue analysis GDB needs to know a lot of information about
instructions that is not provided by generic disassemble_info structure.  For
example, disassemble_info doesn't provide information about instruction
operands, or whether instruction is has is a predicated (which means that it is
effectively a branch and in general prologue analysis halts immediately on
branches).  To close the information gap between disassembly and GDB it is
required to pass architecture-specific structure "arc_opcode" to GDB as a value
of "private_data" field of disassemble_info structure. Structure "arc_opcode"
contains most of the information needed by GDB.

Alternative solution would be to do a complete instruction decoding in GDB
instead of using opcodes, however that would create a lot of unnecessary
duplication, which would be especially problematic because ARC doesn't have a
clear instruction encoding format organization, so handling all of the various
instruction formats is quite a task.

opcodes/ChangeLog

	* arc-dis.c (print_insn_arc): Pass arc_opcode to GDB as private_data.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
---
 opcodes/arc-dis.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index e4df678..a6552b8 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -1231,6 +1231,12 @@ print_insn_arc (bfd_vma memaddr,
 	}
     }
 
+  /* Assign arc_opcode as a private data of disassemble_info to give GDB more
+     information about instruction.  For example to do prologue analysis GDB
+     needs to know what instruction does, what are instruction operands,
+     whether it has condition code, etc.  */
+  info->private_data = (void *) opcode;
+
   return insn_len;
 }
 
-- 
2.8.1



More information about the Binutils mailing list