aboutsummaryrefslogtreecommitdiff
path: root/opcodes/arc-dis.c
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2016-09-15 12:24:24 +0200
committerClaudiu Zissulescu <claziss@synopsys.com>2016-09-16 14:49:33 +0200
commitf807f43d7eba5bba3042554f9b3e884d71a68309 (patch)
treeec9c600313b94d50ab2982fb20db1c256b799add /opcodes/arc-dis.c
parent0a0df908277bc9c63ec546fb7cd15ea14ad4d9a0 (diff)
downloadgdb-f807f43d7eba5bba3042554f9b3e884d71a68309.zip
gdb-f807f43d7eba5bba3042554f9b3e884d71a68309.tar.gz
gdb-f807f43d7eba5bba3042554f9b3e884d71a68309.tar.bz2
[ARC] Disassemble correctly extension instructions.
For each MAJOR-MINOR opcode tuple, we can have either a 3-operand, or 2-operand, or a single operand instruction format, depending on the values present in i-field, and a-field. The disassembler is reading the section containing the extension instruction format and stores them in a table. Each table element represents a linked list with encodings for a particular MAJOR-MINOR tuple. The current implementation checks only against the first element of the list, hence, the issue. This patch is walking the linked list until empty or finds an opcode match. It also adds a test outlining the found problem. opcodes/ 2016-09-15 Claudiu Zissulescu <claziss@synopsys.com> * arc-dis.c (find_format): Walk the linked list pointed by einsn. gas/ 2016-09-15 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/textinsnxop.d: New file. * testsuite/gas/arc/textinsnxop.s: Likewise.
Diffstat (limited to 'opcodes/arc-dis.c')
-rw-r--r--opcodes/arc-dis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index ac03b8c..e4df678 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -477,15 +477,15 @@ find_format (bfd_vma memaddr,
{
const struct arc_opcode *opcode = NULL;
bfd_boolean needs_limm;
- const extInstruction_t *einsn;
+ const extInstruction_t *einsn, *i;
/* First, try the extension instructions. */
einsn = arcExtMap_insn (OPCODE (insn[0]), insn[0]);
- if (einsn != NULL)
+ for (i = einsn; (i != NULL) && (opcode == NULL); i = i->next)
{
const char *errmsg = NULL;
- opcode = arcExtMap_genOpcode (einsn, isa_mask, &errmsg);
+ opcode = arcExtMap_genOpcode (i, isa_mask, &errmsg);
if (opcode == NULL)
{
(*info->fprintf_func) (info->stream, "\