diff options
author | Jens Remus <jremus@linux.ibm.com> | 2024-03-01 12:45:14 +0100 |
---|---|---|
committer | Jens Remus <jremus@linux.ibm.com> | 2024-03-01 12:45:14 +0100 |
commit | 5c97cb1c80994462632ba7c62a54a3fbecaff2ca (patch) | |
tree | 0dea8f7e80bfb42918327bea152c8e5a9c55b826 /gas | |
parent | ac6582253b64aed40739f916d4080af42c73b194 (diff) | |
download | gdb-5c97cb1c80994462632ba7c62a54a3fbecaff2ca.zip gdb-5c97cb1c80994462632ba7c62a54a3fbecaff2ca.tar.gz gdb-5c97cb1c80994462632ba7c62a54a3fbecaff2ca.tar.bz2 |
s390: Be more verbose about missing operand type
Provide expected operand type in s390-specific assembler operand parsing
error message:
"error: operand <operand-number>: missing <operand-type> operand"
With <operand-type> being one of:
- base register
- displacement
- [vector] index register
- length
- access register
- control register
- floating-point register
- general-purpose register
- vector register
- [un]signed number
gas/
* config/tc-s390.c: Provide missing operand type in error
message.
* testsuite/gas/s390/zarch-base-index-0-err.l: Update test case
result validation patterns to operand number in operand syntax
error messages.
* testsuite/gas/s390/zarch-omitted-base-index-err.l: Likewise.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-s390.c | 38 | ||||
-rw-r--r-- | gas/testsuite/gas/s390/zarch-base-index-0-err.l | 30 | ||||
-rw-r--r-- | gas/testsuite/gas/s390/zarch-omitted-base-index-err.l | 4 |
3 files changed, 54 insertions, 18 deletions
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index a2f499b..659c6af 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -1329,6 +1329,41 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */) demand_empty_rest_of_line (); } +static const char * +operand_type_str(const struct s390_operand * operand) +{ + if (operand->flags & S390_OPERAND_BASE) + return _("base register"); + else if (operand->flags & S390_OPERAND_DISP) + return _("displacement"); + else if (operand->flags & S390_OPERAND_INDEX) + { + if (operand->flags & S390_OPERAND_VR) + return _("vector index register"); + else + return _("index register"); + } + else if (operand->flags & S390_OPERAND_LENGTH) + return _("length"); + else if (operand->flags & S390_OPERAND_AR) + return _("access register"); + else if (operand->flags & S390_OPERAND_CR) + return _("control register"); + else if (operand->flags & S390_OPERAND_FPR) + return _("floating-point register"); + else if (operand->flags & S390_OPERAND_GPR) + return _("general-purpose register"); + else if (operand->flags & S390_OPERAND_VR) + return _("vector register"); + else + { + if (operand->flags & S390_OPERAND_SIGNED) + return _("signed number"); + else + return _("unsigned number"); + } +} + /* Return true if all remaining operands in the opcode with OPCODE_FLAGS can be skipped. */ static bool @@ -1431,7 +1466,8 @@ md_gather_operands (char *str, { if (opindex_ptr[0] == '\0') break; - as_bad (_("operand %d: missing operand"), operand_number); + as_bad (_("operand %d: missing %s operand"), operand_number, + operand_type_str(operand)); } else if (ex.X_op == O_register || ex.X_op == O_constant) { diff --git a/gas/testsuite/gas/s390/zarch-base-index-0-err.l b/gas/testsuite/gas/s390/zarch-base-index-0-err.l index 6332d99..26187c9 100644 --- a/gas/testsuite/gas/s390/zarch-base-index-0-err.l +++ b/gas/testsuite/gas/s390/zarch-base-index-0-err.l @@ -16,9 +16,9 @@ .*:16: Error: bad expression .*:16: Error: operand 2: syntax error; missing '\)' after base register .*:17: Error: operand 1: operand out of range \(0 is not between 1 and 256\) -.*:18: Error: operand 1: missing operand -.*:19: Error: operand 1: missing operand -.*:20: Error: operand 1: missing operand +.*:18: Error: operand 1: missing length operand +.*:19: Error: operand 1: missing length operand +.*:20: Error: operand 1: missing length operand .*:21: Error: bad expression .*:21: Error: operand 1: operand out of range \(0 is not between 1 and 256\) .*:21: Error: operand 1: operand out of range \(32 is not between 0 and 15\) @@ -31,9 +31,9 @@ .*:22: Error: operand 1: syntax error; missing '\(' after displacement .*:23: Error: operand 1: invalid length field specified .*:26: Error: operand 1: operand out of range \(0 is not between 1 and 16\) -.*:27: Error: operand 1: missing operand -.*:28: Error: operand 1: missing operand -.*:29: Error: operand 1: missing operand +.*:27: Error: operand 1: missing length operand +.*:28: Error: operand 1: missing length operand +.*:29: Error: operand 1: missing length operand .*:30: Error: bad expression .*:30: Error: operand 1: operand out of range \(0 is not between 1 and 16\) .*:30: Error: operand 1: operand out of range \(32 is not between 0 and 15\) @@ -42,21 +42,21 @@ .*:30: Error: found ',', expected: '\)' .*:31: Error: operand 1: syntax error; missing '\(' after displacement .*:32: Error: operand 2: operand out of range \(0 is not between 1 and 16\) -.*:33: Error: operand 2: missing operand -.*:34: Error: operand 2: missing operand -.*:35: Error: operand 2: missing operand +.*:33: Error: operand 2: missing length operand +.*:34: Error: operand 2: missing length operand +.*:35: Error: operand 2: missing length operand .*:36: Error: bad expression .*:36: Error: operand 2: operand out of range \(0 is not between 1 and 16\) .*:36: Error: operand 2: syntax error; expected ',' .*:37: Error: operand 2: syntax error; missing '\(' after displacement .*:38: Error: operand 1: operand out of range \(0 is not between 1 and 16\) .*:38: Error: operand 2: operand out of range \(0 is not between 1 and 16\) -.*:39: Error: operand 1: missing operand -.*:39: Error: operand 2: missing operand -.*:40: Error: operand 1: missing operand -.*:40: Error: operand 2: missing operand -.*:41: Error: operand 1: missing operand -.*:41: Error: operand 2: missing operand +.*:39: Error: operand 1: missing length operand +.*:39: Error: operand 2: missing length operand +.*:40: Error: operand 1: missing length operand +.*:40: Error: operand 2: missing length operand +.*:41: Error: operand 1: missing length operand +.*:41: Error: operand 2: missing length operand .*:42: Error: bad expression .*:42: Error: operand 1: operand out of range \(0 is not between 1 and 16\) .*:42: Error: operand 1: operand out of range \(32 is not between 0 and 15\) diff --git a/gas/testsuite/gas/s390/zarch-omitted-base-index-err.l b/gas/testsuite/gas/s390/zarch-omitted-base-index-err.l index b2ee382..9ff6392 100644 --- a/gas/testsuite/gas/s390/zarch-omitted-base-index-err.l +++ b/gas/testsuite/gas/s390/zarch-omitted-base-index-err.l @@ -6,8 +6,8 @@ .*:11: Warning: operand 2: expected general register name as base register .*:12: Error: bad expression .*:12: Error: operand 2: syntax error; missing '\)' after base register -.*:15: Error: operand 1: missing operand -.*:16: Error: operand 1: missing operand +.*:15: Error: operand 1: missing length operand +.*:16: Error: operand 1: missing length operand .*:17: Error: operand 1: invalid length field specified .*:18: Error: bad expression .*:18: Error: operand 1: operand out of range \(0 is not between 1 and 256\) |