diff options
author | Tamar Christina <tamar.christina@arm.com> | 2018-10-03 18:35:15 +0100 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2018-10-03 18:36:30 +0100 |
commit | 1d4823943d92e7fccb0616f885c029d9952cfb0e (patch) | |
tree | f0f117535ae9a23e44db11a8681765fcd82d2232 /opcodes | |
parent | 7e84b55d8f973b011f55f604a76c2d1d989d0b6b (diff) | |
download | gdb-1d4823943d92e7fccb0616f885c029d9952cfb0e.zip gdb-1d4823943d92e7fccb0616f885c029d9952cfb0e.tar.gz gdb-1d4823943d92e7fccb0616f885c029d9952cfb0e.tar.bz2 |
AArch64: Refactor err_type.
Previously the ERR_ values were defined as different constants, to make this a
bit more type safe and so they can be more easily re-used I'm changing them into
an actual enum and updating any usages.
include/
* opcode/aarch64.h (enum err_type): New.
(aarch64_decode_insn): Use it.
opcodes/
* aarch64-dis.c (ERR_OK, ERR_UND, ERR_UNP, ERR_NYI): Remove.
(aarch64_decode_insn, print_insn_aarch64_word): Use err_type.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 5 | ||||
-rw-r--r-- | opcodes/aarch64-dis.c | 21 |
2 files changed, 13 insertions, 13 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 2ccfe8e..1da4e80 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,10 @@ 2018-10-03 Tamar Christina <tamar.christina@arm.com> + * aarch64-dis.c (ERR_OK, ERR_UND, ERR_UNP, ERR_NYI): Remove. + (aarch64_decode_insn, print_insn_aarch64_word): Use err_type. + +2018-10-03 Tamar Christina <tamar.christina@arm.com> + * aarch64-asm.c (aarch64_opcode_encode): Add insn_sequence. * aarch64-dis.c (insn_sequence): New. diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c index 599727e..c08c82f 100644 --- a/opcodes/aarch64-dis.c +++ b/opcodes/aarch64-dis.c @@ -26,11 +26,6 @@ #include "aarch64-dis.h" #include "elf-bfd.h" -#define ERR_OK 0 -#define ERR_UND -1 -#define ERR_UNP -3 -#define ERR_NYI -5 - #define INSNLEN 4 /* Cached mapping symbol state. */ @@ -2945,7 +2940,7 @@ user_friendly_fixup (aarch64_inst *inst) opcode may be filled in *INSN if NOALIASES_P is FALSE. Return zero on success. */ -int +enum err_type aarch64_decode_insn (aarch64_insn insn, aarch64_inst *inst, bfd_boolean noaliases_p, aarch64_operand_error *errors) @@ -3097,15 +3092,15 @@ print_insn_aarch64_word (bfd_vma pc, struct disassemble_info *info, aarch64_operand_error *errors) { - static const char *err_msg[6] = + static const char *err_msg[ERR_NR_ENTRIES+1] = { - [ERR_OK] = "_", - [-ERR_UND] = "undefined", - [-ERR_UNP] = "unpredictable", - [-ERR_NYI] = "NYI" + [ERR_OK] = "_", + [ERR_UND] = "undefined", + [ERR_UNP] = "unpredictable", + [ERR_NYI] = "NYI" }; - int ret; + enum err_type ret; aarch64_inst inst; info->insn_info_valid = 1; @@ -3139,7 +3134,7 @@ print_insn_aarch64_word (bfd_vma pc, /* Handle undefined instructions. */ info->insn_type = dis_noninsn; (*info->fprintf_func) (info->stream,".inst\t0x%08x ; %s", - word, err_msg[-ret]); + word, err_msg[ret]); break; case ERR_OK: user_friendly_fixup (&inst); |