summaryrefslogtreecommitdiff
path: root/opcodes/m32r-asm.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2000-02-24 16:19:36 +0000
committerAndrew Haley <aph@redhat.com>2000-02-24 16:19:36 +0000
commit5c878f658eb75b8820e9d8c9d282042feeea3969 (patch)
treea0cf769949e79ce08116b4e74333a07e8c43cf6f /opcodes/m32r-asm.c
parent950725a87f001d46f9c2a6b230b0e44d4ce0daf5 (diff)
downloadgdb-5c878f658eb75b8820e9d8c9d282042feeea3969.tar.gz
2000-02-23 Andrew Haley <aph@cygnus.com>
* m32r-asm.c, m32r-desc.c, m32r-desc.h, m32r-dis.c, m32r-ibld.c,m32r-opc.h: Rebuild.
Diffstat (limited to 'opcodes/m32r-asm.c')
-rw-r--r--opcodes/m32r-asm.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index 2d3bd96e728..0aa62ce1a15 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -486,6 +486,7 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
{
const char *start;
CGEN_INSN_LIST *ilist;
+ const char *tmp_errmsg;
/* Skip leading white space. */
while (isspace (* str))
@@ -502,7 +503,8 @@ m32r_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 (! m32r_cgen_insn_supported (cd, insn))
continue;
@@ -519,7 +521,7 @@ m32r_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))
+ if (!(tmp_errmsg = 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)
@@ -533,16 +535,25 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
/* Try the next entry. */
}
- /* FIXME: We can return a better error message than this.
- Need to track why it failed and pick the right one. */
{
- 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;