summaryrefslogtreecommitdiff
path: root/opcodes/cgen-asm.in
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2000-12-13 18:55:02 +0000
committerFrank Ch. Eigler <fche@redhat.com>2000-12-13 18:55:02 +0000
commit4b23a03224f20ffaf3b1d2913315c8b7880a366e (patch)
treeefc08625f7df7ac7f716fe4939d63a39e6887e76 /opcodes/cgen-asm.in
parente6c47ced7f9f98a50c91ae9c28c3182f967bcf0b (diff)
downloadgdb-4b23a03224f20ffaf3b1d2913315c8b7880a366e.tar.gz
* error message improvements for cgen assemblers
2000-12-12 Frank Ch. Eigler <fche@redhat.com> * cgen-asm.in (@arch@_cgen_assemble_insn): Prefer printing insert-time error messages over later parse-time ones.
Diffstat (limited to 'opcodes/cgen-asm.in')
-rw-r--r--opcodes/cgen-asm.in25
1 files changed, 14 insertions, 11 deletions
diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in
index 8abd8dea551..ad6d1722fab 100644
--- a/opcodes/cgen-asm.in
+++ b/opcodes/cgen-asm.in
@@ -200,7 +200,8 @@ const CGEN_INSN *
{
const char *start;
CGEN_INSN_LIST *ilist;
- const char *tmp_errmsg = NULL;
+ const char *parse_errmsg = NULL;
+ const char *insert_errmsg = NULL;
/* Skip leading white space. */
while (isspace (* str))
@@ -235,14 +236,14 @@ const CGEN_INSN *
/* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
- tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
- if (tmp_errmsg != NULL)
+ parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+ if (parse_errmsg != NULL)
continue;
/* ??? 0 is passed for `pc' */
- tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
- (bfd_vma) 0);
- if (tmp_errmsg != NULL)
+ insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+ (bfd_vma) 0);
+ if (insert_errmsg != NULL)
continue;
/* It is up to the caller to actually output the insn and any
@@ -250,15 +251,17 @@ const CGEN_INSN *
return insn;
}
- /* Make sure we leave this with something at this point. */
- if (tmp_errmsg == NULL)
- tmp_errmsg = "unknown mnemonic";
-
{
static char errbuf[150];
+ const char *tmp_errmsg;
#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
- /* if verbose error messages, use errmsg from CGEN_PARSE_FN */
+ /* If requesting verbose error messages, use insert_errmsg.
+ Failing that, use parse_errmsg */
+ tmp_errmsg = (insert_errmsg ? insert_errmsg :
+ parse_errmsg ? parse_errmsg :
+ _("unrecognized instruction"));
+
if (strlen (start) > 50)
/* xgettext:c-format */
sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);