aboutsummaryrefslogtreecommitdiff
path: root/opcodes/i386-gen.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2008-01-08 21:24:16 +0000
committerH.J. Lu <hjl.tools@gmail.com>2008-01-08 21:24:16 +0000
commit3d4d5afaf0e58a7dafe175de2527b1c968d235bf (patch)
treeab7fb02b7e67e240c73075cce772c5f0b1ac03b8 /opcodes/i386-gen.c
parenta761937534ef16c9c0c27f25e7162e422518d345 (diff)
downloadgdb-3d4d5afaf0e58a7dafe175de2527b1c968d235bf.zip
gdb-3d4d5afaf0e58a7dafe175de2527b1c968d235bf.tar.gz
gdb-3d4d5afaf0e58a7dafe175de2527b1c968d235bf.tar.bz2
2008-01-08 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (lineno): New. (filename): Likewise. (set_bitfield): Report filename and line numer on error. (process_i386_opcodes): Set filename and update lineno. (process_i386_registers): Likewise.
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r--opcodes/i386-gen.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index f93ff07..1db9660 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -339,6 +339,9 @@ static bitfield operand_types[] =
#endif
};
+static int lineno;
+static const char *filename;
+
static int
compare (const void *x, const void *y)
{
@@ -448,7 +451,8 @@ set_bitfield (const char *f, bitfield *array, unsigned int size)
return;
}
- printf ("Unknown bitfield: %s\n", f);
+ printf ("%s: %d: Unknown bitfield: %s\n",
+ filename, lineno, f);
abort ();
}
@@ -601,7 +605,7 @@ process_i386_operand_type (FILE *table, char *op, int macro,
static void
process_i386_opcodes (FILE *table)
{
- FILE *fp = fopen ("i386-opc.tbl", "r");
+ FILE *fp;
char buf[2048];
unsigned int i;
char *str, *p, *last;
@@ -609,6 +613,9 @@ process_i386_opcodes (FILE *table)
char *opcode_length;
char *cpu_flags, *opcode_modifier, *operand_types [MAX_OPERANDS];
+ filename = "i386-opc.tbl";
+ fp = fopen (filename, "r");
+
if (fp == NULL)
fail (_("can't find i386-opc.tbl for reading, errno = %s\n"),
xstrerror (errno));
@@ -621,6 +628,8 @@ process_i386_opcodes (FILE *table)
if (fgets (buf, sizeof (buf), fp) == NULL)
break;
+ lineno++;
+
p = remove_leading_whitespaces (buf);
/* Skip comments. */
@@ -776,11 +785,13 @@ process_i386_opcodes (FILE *table)
static void
process_i386_registers (FILE *table)
{
- FILE *fp = fopen ("i386-reg.tbl", "r");
+ FILE *fp;
char buf[2048];
char *str, *p, *last;
char *reg_name, *reg_type, *reg_flags, *reg_num;
+ filename = "i386-reg.tbl";
+ fp = fopen (filename, "r");
if (fp == NULL)
fail (_("can't find i386-reg.tbl for reading, errno = %s\n"),
xstrerror (errno));
@@ -793,6 +804,8 @@ process_i386_registers (FILE *table)
if (fgets (buf, sizeof (buf), fp) == NULL)
break;
+ lineno++;
+
p = remove_leading_whitespaces (buf);
/* Skip comments. */