aboutsummaryrefslogtreecommitdiff
path: root/opcodes/aarch64-dis.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-03-30 11:09:08 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-03-30 11:09:08 +0100
commitb5b4f6654515c93e131578045260d2dc8c6caeee (patch)
tree12c8e7df6d2170c68664aee74a2ed34d81ed2440 /opcodes/aarch64-dis.c
parent8c2216b2773ee9e5a233fa29e12b61d1646af18e (diff)
downloadgdb-b5b4f6654515c93e131578045260d2dc8c6caeee.zip
gdb-b5b4f6654515c93e131578045260d2dc8c6caeee.tar.gz
gdb-b5b4f6654515c93e131578045260d2dc8c6caeee.tar.bz2
aarch64: Try to report invalid variants against the closest match
If an instruction has invalid qualifiers, GAS would report the error against the final opcode entry that got to the qualifier- checking stage. It seems better to report the error against the opcode entry that had the closest match, just like we pick the closest match within an opcode entry for the "did you mean this?" message. This patch adds the number of invalid operands as an argument to AARCH64_OPDE_INVALID_VARIANT and then picks the AARCH64_OPDE_INVALID_VARIANT with the lowest argument.
Diffstat (limited to 'opcodes/aarch64-dis.c')
-rw-r--r--opcodes/aarch64-dis.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index eabcc9e..ddbeefa 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -253,8 +253,9 @@ get_expected_qualifier (const aarch64_inst *inst, int i)
aarch64_opnd_qualifier_seq_t qualifiers;
/* Should not be called if the qualifier is known. */
assert (inst->operands[i].qualifier == AARCH64_OPND_QLF_NIL);
+ int invalid_count;
if (aarch64_find_best_match (inst, inst->opcode->qualifiers_list,
- i, qualifiers))
+ i, qualifiers, &invalid_count))
return qualifiers[i];
else
return AARCH64_OPND_QLF_NIL;