aboutsummaryrefslogtreecommitdiff
path: root/opcodes/fr30-asm.c
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2000-08-28 18:17:54 +0000
committerDave Brolley <brolley@redhat.com>2000-08-28 18:17:54 +0000
commit6bb95a0ff8ead058dbfff87384fd379f6f8aeb05 (patch)
tree93bb6a71bbe0f96262581dadf2fa3349e06dbcf9 /opcodes/fr30-asm.c
parentbf830eae8fe6e37ae2bd83b914bb701fb9616db5 (diff)
downloadgdb-6bb95a0ff8ead058dbfff87384fd379f6f8aeb05.zip
gdb-6bb95a0ff8ead058dbfff87384fd379f6f8aeb05.tar.gz
gdb-6bb95a0ff8ead058dbfff87384fd379f6f8aeb05.tar.bz2
2000-08-28 Dave Brolley <brolley@redhat.com>
* cgen-ibld.in (cgen_put_insn_int_value): New function. (insert_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P. (insert_insn_normal): Use cgen_put_insn_int_value with CGEN_INT_INSN_P. (extract_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P. * cgen-dis.in (read_insn): New static function. (print_insn): Use read_insn to read the insn into the buffer and set up for disassembly. (print_insn): in CGEN_INT_INSN_P, make sure that the entire insn is in the buffer. * fr30-asm.c: Regenerated. * fr30-desc.c: Regenerated. * fr30-desc.h Regenerated. * fr30-dis.c: Regenerated. * fr30-ibld.c: Regenerated. * fr30-opc.c: Regenerated. * fr30-opc.h Regenerated. * m32r-asm.c: Regenerated. * m32r-desc.c: Regenerated. * m32r-desc.h Regenerated. * m32r-dis.c: Regenerated. * m32r-ibld.c: Regenerated. * m32r-opc.c: Regenerated.
Diffstat (limited to 'opcodes/fr30-asm.c')
-rw-r--r--opcodes/fr30-asm.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 6038dbb..08092af 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -398,7 +398,7 @@ parse_insn_normal (cd, insn, strp, fields)
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (*str == CGEN_SYNTAX_CHAR (* syn))
+ if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (* syn == ' ')
@@ -410,9 +410,11 @@ parse_insn_normal (cd, insn, strp, fields)
else
{
/* Syntax char didn't match. Can't be this insn. */
- /* FIXME: would like to return something like
- "expected char `c'" */
- return _("syntax error");
+ static char msg [80];
+ /* xgettext:c-format */
+ sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
+ *syn, *str);
+ return msg;
}
continue;
}
@@ -478,6 +480,7 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
{
const char *start;
CGEN_INSN_LIST *ilist;
+ const char *tmp_errmsg = NULL;
/* Skip leading white space. */
while (isspace (* str))
@@ -494,7 +497,8 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
{
const CGEN_INSN *insn = ilist->insn;
-#if 0 /* not needed as unsupported opcodes shouldn't be in the hash lists */
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED
+ /* not usually needed as unsupported opcodes shouldn't be in the hash lists */
/* Is this insn supported by the selected cpu? */
if (! fr30_cgen_insn_supported (cd, insn))
continue;
@@ -511,30 +515,44 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
/* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
- if (! CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields))
- {
- /* ??? 0 is passed for `pc' */
- if (CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, (bfd_vma) 0)
- != NULL)
- continue;
- /* It is up to the caller to actually output the insn and any
- queued relocs. */
- return insn;
- }
+ tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+ if (tmp_errmsg != NULL)
+ continue;
- /* Try the next entry. */
+ /* ??? 0 is passed for `pc' */
+ tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+ (bfd_vma) 0);
+ if (tmp_errmsg != NULL)
+ continue;
+
+ /* It is up to the caller to actually output the insn and any
+ queued relocs. */
+ return insn;
}
- /* FIXME: We can return a better error message than this.
- Need to track why it failed and pick the right one. */
+ /* Make sure we leave this with something at this point. */
+ if (tmp_errmsg == NULL)
+ tmp_errmsg = "unknown mnemonic";
+
{
- static char errbuf[100];
+ static char errbuf[150];
+
+#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
+ /* if verbose error messages, use errmsg from CGEN_PARSE_FN */
+ if (strlen (start) > 50)
+ /* xgettext:c-format */
+ sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
+ else
+ /* xgettext:c-format */
+ sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
+#else
if (strlen (start) > 50)
/* xgettext:c-format */
sprintf (errbuf, _("bad instruction `%.50s...'"), start);
else
/* xgettext:c-format */
sprintf (errbuf, _("bad instruction `%.50s'"), start);
+#endif
*errmsg = errbuf;
return NULL;