static long read_huge_number PARAMS ((char **, int, int *));
-static struct type *error_type PARAMS ((char **));
+static struct type *error_type PARAMS ((char **, struct objfile *));
static void
patch_block_stabs PARAMS ((struct pending *, struct pending_stabs *,
static struct symbol *current_symbol = NULL;
/* Check for and handle cretinous stabs symbol name continuation! */
-#define STABS_CONTINUE(pp) \
+#define STABS_CONTINUE(pp,objfile) \
do { \
if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \
- *(pp) = next_symbol_text (); \
+ *(pp) = next_symbol_text (objfile); \
} while (0)
\f
/* FIXME: These probably should be our own types (like rs6000_builtin_type
if (*p != '=')
{
SYMBOL_CLASS (sym) = LOC_CONST;
- SYMBOL_TYPE (sym) = error_type (&p);
+ SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
add_symbol_to_list (sym, &file_symbols);
return sym;
if (*p != ',')
{
- SYMBOL_TYPE (sym) = error_type (&p);
+ SYMBOL_TYPE (sym) = error_type (&p, objfile);
break;
}
++p;
default:
{
SYMBOL_CLASS (sym) = LOC_CONST;
- SYMBOL_TYPE (sym) = error_type (&p);
+ SYMBOL_TYPE (sym) = error_type (&p, objfile);
}
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
break;
default:
- SYMBOL_TYPE (sym) = error_type (&p);
+ SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_VALUE (sym) = 0;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
Thus code like this:
if (*(*pp)++ != ';')
- return error_type (pp);
+ return error_type (pp, objfile);
is wrong because if *pp starts out pointing at '\0' (typically as the
result of an earlier error), it will be incremented to point to the
if you run off the end of the string table. Instead use
if (**pp != ';')
- return error_type (pp);
+ return error_type (pp, objfile);
++*pp;
or
if (**pp != ';')
- foo = error_type (pp);
+ foo = error_type (pp, objfile);
else
++*pp;
debugger will be able to read the new symbol tables. */
static struct type *
-error_type (pp)
+error_type (pp, objfile)
char **pp;
+ struct objfile *objfile;
{
complain (&error_type_complaint);
while (1)
/* Check for and handle cretinous dbx symbol name continuation! */
if ((*pp)[-1] == '\\' || (*pp)[-1] == '?')
{
- *pp = next_symbol_text ();
+ *pp = next_symbol_text (objfile);
}
else
{
|| **pp == '-')
{
if (read_type_number (pp, typenums) != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
/* Type is not being defined here. Either it already exists,
or this is a forward reference to it. dbx_alloc_type handles
++p;
*pp = p;
if (*p == '\0')
- return error_type (pp);
+ return error_type (pp, objfile);
else
/* Skip the semicolon. */
++*pp;
q1 = strchr(*pp, '<');
p = strchr(*pp, ':');
if (p == NULL)
- return error_type (pp);
+ return error_type (pp, objfile);
while (q1 && p > q1 && p[1] == ':')
{
q2 = strchr(q1, '>');
p += 2;
p = strchr(p, ':');
if (p == NULL)
- return error_type (pp);
+ return error_type (pp, objfile);
}
to = type_name =
(char *)obstack_alloc (&objfile->type_obstack, p - *pp + 1);
/* Peek ahead at the number to detect void. */
if (read_type_number (pp, xtypenums) != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
/* It's being defined as itself. That means it is "void". */
/* Because 'c' means other things to AIX and 'k' is perfectly good,
only accept 'c' in the os9k_stabs case. */
if (type_descriptor == 'c' && !os9k_stabs)
- return error_type (pp);
+ return error_type (pp, objfile);
type = read_type (pp, objfile);
/* FIXME! For now, we ignore const and volatile qualifiers. */
break;
/* Because 'i' means other things to AIX and 'B' is perfectly good,
only accept 'i' in the os9k_stabs case. */
if (type_descriptor == 'i' && !os9k_stabs)
- return error_type (pp);
+ return error_type (pp, objfile);
type = read_type (pp, objfile);
/* FIXME! For now, we ignore const and volatile qualifiers. */
break;
if (**pp != ',')
/* Invalid member type data format. */
- return error_type (pp);
+ return error_type (pp, objfile);
++*pp;
memtype = read_type (pp, objfile);
if (**pp != ',')
/* Invalid member type data format. */
- return error_type (pp);
+ return error_type (pp, objfile);
else
++(*pp);
case 'a': /* Array type */
if (**pp != 'r')
- return error_type (pp);
+ return error_type (pp, objfile);
++*pp;
type = dbx_alloc_type (typenums, objfile);
default:
--*pp; /* Go back to the symbol in error */
/* Particularly important if it was \0! */
- return error_type (pp);
+ return error_type (pp, objfile);
}
if (type == 0)
{
warning ("GDB internal error, type is NULL in stabsread.c\n");
- return error_type (pp);
+ return error_type (pp, objfile);
}
/* Size specified in a type attribute overrides any other size. */
/* Skip past '::'. */
*pp = p + 2;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
p = *pp;
while (*p != '.')
{
if (look_ahead_type == NULL)
{
/* Normal case. */
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
new_sublist -> fn_field.type = read_type (pp, objfile);
if (**pp != ':')
break;
}
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
switch (**pp)
{
case 'A': /* Normal functions. */
if (nbits != 0)
return 0;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
if (**pp == ';' || **pp == '\0')
{
/* Must be g++ version 1. */
new_sublist -> next = sublist;
sublist = new_sublist;
length++;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
}
while (**pp != ';' && **pp != '\0');
fip -> fnlist = new_fnlist;
nfn_fields++;
total_length += length;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
}
if (nfn_fields)
while (**pp != ';')
{
if (os9k_stabs && **pp == ',') break;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
/* Get space to record the next field's data. */
new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
make_cleanup (free, new);
fip -> list = new;
new -> field.bitsize = 0; /* this should be an unpacked field! */
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
switch (**pp)
{
case '0':
{
register char *p;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
/* If we are positioned at a ';', then skip it. */
if (**pp == ';')
int nbits;
TYPE_LENGTH (type) = read_huge_number (pp, 0, &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
}
/* Now read the baseclasses, if any, read the regular C struct or C++
|| !read_tilde_fields (&fi, pp, type, objfile))
{
do_cleanups (back_to);
- return (error_type (pp));
+ return (error_type (pp, objfile));
}
do_cleanups (back_to);
index_type = read_type (pp, objfile);
if (**pp != ';')
/* Improper format of array type decl. */
- return error_type (pp);
+ return error_type (pp, objfile);
++*pp;
}
}
lower = read_huge_number (pp, os9k_stabs ? ',' : ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
if (!(**pp >= '0' && **pp <= '9') && **pp != '-')
{
}
upper = read_huge_number (pp, ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
element_type = read_type (pp, objfile);
with a digit). */
read_huge_number (pp, 0, &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
}
/* The aix4 compiler emits an extra field before the enum members;
A semicolon or comma instead of a NAME means the end. */
while (**pp && **pp != ';' && **pp != ',')
{
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
p = *pp;
while (*p != ':') p++;
name = obsavestring (*pp, p - *pp, &objfile -> symbol_obstack);
*pp = p + 1;
n = read_huge_number (pp, ',', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
sym = (struct symbol *)
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
signed_type = 0;
break;
default:
- return error_type (pp);
+ return error_type (pp, objfile);
}
(*pp)++;
we will ignore it. */
read_huge_number (pp, ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
/* The second number is always 0, so ignore it too. */
read_huge_number (pp, ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
/* The third number is the number of bits for this type. */
type_bits = read_huge_number (pp, 0, &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
/* The type *should* end with a semicolon. If it are embedded
in a larger type the semicolon may be the only way to know where
the type ends. If this type is at the end of the stabstring we
FN_COMPLEX. */
details = read_huge_number (pp, ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
/* The second number is the number of bytes occupied by this type */
nbytes = read_huge_number (pp, ';', &nbits);
if (nbits != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
if (details == NF_COMPLEX || details == NF_COMPLEX16
|| details == NF_COMPLEX32)
/* First comes a type we are a subrange of.
In C it is usually 0, 1 or the type being defined. */
if (read_type_number (pp, rangenums) != 0)
- return error_type (pp);
+ return error_type (pp, objfile);
self_subrange = (rangenums[0] == typenums[0] &&
rangenums[1] == typenums[1]);
n3 = read_huge_number (pp, ';', &n3bits);
if (n2bits == -1 || n3bits == -1)
- return error_type (pp);
+ return error_type (pp, objfile);
if (index_type)
goto handle_true_range;
objfile);
}
else
- return error_type (pp);
+ return error_type (pp, objfile);
}
/* A type defined as a subrange of itself, with bounds both 0, is void. */
a self_subrange type; I'm going to assume that this is used
as an idiom, and that all of them are special cases. So . . . */
if (self_subrange)
- return error_type (pp);
+ return error_type (pp, objfile);
index_type = *dbx_lookup_type (rangenums);
if (index_type == NULL)
/* Invalid argument list: no ','. */
return (struct type **)-1;
(*pp)++;
- STABS_CONTINUE (pp);
+ STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
(*pp)++; /* get past `end' (the ':' character) */