read_cfront_member_functions (struct field_info *, char **,
struct type *, struct objfile *);
+static char *find_name_end (char *name);
+
/* end new functions added for cfront support */
static void
void stabsread_clear_cache (void);
-static const char vptr_name[] =
-{'_', 'v', 'p', 't', 'r', CPLUS_MARKER, '\0'};
-static const char vb_name[] =
-{'_', 'v', 'b', CPLUS_MARKER, '\0'};
+static const char vptr_name[] = "_vptr$";
+static const char vb_name[] = "_vb$";
/* Define this as 1 if a pcc declaration of a char or short argument
gives the correct address. Otherwise assume pcc gives the
#define BELIEVE_PCC_PROMOTION_TYPE 0
#endif
-static struct complaint invalid_cpp_abbrev_complaint =
-{"invalid C++ abbreviation `%s'", 0, 0};
-
-static struct complaint invalid_cpp_type_complaint =
-{"C++ abbreviated type name unknown at symtab pos %d", 0, 0};
-
-static struct complaint member_fn_complaint =
-{"member function type missing, got '%c'", 0, 0};
-
-static struct complaint const_vol_complaint =
-{"const/volatile indicator missing, got '%c'", 0, 0};
-
-static struct complaint error_type_complaint =
-{"couldn't parse type; debugger out of date?", 0, 0};
-
-static struct complaint invalid_member_complaint =
-{"invalid (minimal) member type data format at symtab pos %d.", 0, 0};
-
-static struct complaint range_type_base_complaint =
-{"base type %d of range type is not defined", 0, 0};
-
-static struct complaint reg_value_complaint =
-{"register number %d too large (max %d) in symbol %s", 0, 0};
-
-static struct complaint vtbl_notfound_complaint =
-{"virtual function table pointer not found when defining class `%s'", 0, 0};
-
-static struct complaint unrecognized_cplus_name_complaint =
-{"Unknown C++ symbol name `%s'", 0, 0};
-
-static struct complaint rs6000_builtin_complaint =
-{"Unknown builtin type %d", 0, 0};
+static void
+invalid_cpp_abbrev_complaint (const char *arg1)
+{
+ complaint (&symfile_complaints, "invalid C++ abbreviation `%s'", arg1);
+}
-static struct complaint unresolved_sym_chain_complaint =
-{"%s: common block `%s' from global_sym_chain unresolved", 0, 0};
+static void
+reg_value_complaint (int arg1, int arg2, const char *arg3)
+{
+ complaint (&symfile_complaints,
+ "register number %d too large (max %d) in symbol %s", arg1, arg2,
+ arg3);
+}
-static struct complaint stabs_general_complaint =
-{"%s", 0, 0};
+static void
+stabs_general_complaint (const char *arg1)
+{
+ complaint (&symfile_complaints, "%s", arg1);
+}
-static struct complaint lrs_general_complaint =
-{"%s", 0, 0};
+static void
+lrs_general_complaint (const char *arg1)
+{
+ complaint (&symfile_complaints, "%s", arg1);
+}
/* Make a list of forward references which haven't been defined. */
if (filenum < 0 || filenum >= n_this_object_header_files)
{
- static struct complaint msg =
- {"\
-Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
- 0, 0};
- complain (&msg, filenum, index, symnum);
+ complaint (&symfile_complaints,
+ "Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
+ filenum, index, symnum);
goto error_return;
}
return p;
}
+static void
+msg_unknown_complaint (const char *arg1)
+{
+ complaint (&symfile_complaints, "Unsupported token in stabs string %s", arg1);
+}
+
/* Read base classes within cfront class definition.
eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;;
^^^^^^^^^^^^^^^^^^
read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type,
struct objfile *objfile)
{
- static struct complaint msg_unknown =
- {"\
- Unsupported token in stabs string %s.\n",
- 0, 0};
- static struct complaint msg_notfound =
- {"\
- Unable to find base type for %s.\n",
- 0, 0};
int bnum = 0;
char *p;
int i;
/* Bad visibility format. Complain and treat it as
public. */
{
- static struct complaint msg =
- {
- "Unknown visibility `%c' for baseclass", 0, 0};
- complain (&msg, new->visibility);
+ complaint (&symfile_complaints,
+ "Unknown visibility `%c' for baseclass",
+ new->visibility);
new->visibility = VISIBILITY_PUBLIC;
}
}
/* "@" comes next - eg: @Bvir */
if (**pp != '@')
{
- complain (&msg_unknown, *pp);
+ msg_unknown_complaint (*pp);
return 1;
}
++(*pp);
bname = get_substring (pp, ';');
if (!bname || !*bname)
{
- complain (&msg_unknown, *pp);
+ msg_unknown_complaint (*pp);
return 1;
}
/* FIXME! attach base info to type */
}
else
{
- complain (&msg_notfound, *pp);
+ complaint (&symfile_complaints, "Unable to find base type for %s",
+ *pp);
return 1;
}
}
ref_func = lookup_symbol (fname, 0, VAR_NAMESPACE, 0, 0); /* demangled name */
if (!ref_func)
{
- static struct complaint msg =
- {"\
- Unable to find function symbol for %s\n",
- 0, 0};
- complain (&msg, fname);
+ complaint (&symfile_complaints,
+ "Unable to find function symbol for %s", fname);
continue;
}
sublist = NULL;
ref_sym = ref_search (refnum);
if (!ref_sym)
{
- complain (&lrs_general_complaint, "symbol for reference not found");
+ lrs_general_complaint ("symbol for reference not found");
return 0;
}
sizeof (struct alias_list));
if (!alias)
{
- complain (&lrs_general_complaint, "Unable to allocate alias list memory");
+ lrs_general_complaint ("Unable to allocate alias list memory");
return 0;
}
struct objfile *objfile)
{
register struct symbol *sym;
- char *p = (char *) strchr (string, ':');
+ char *p = (char *) find_name_end (string);
int deftype;
int synonym = 0;
register int i;
#endif
default:
- complain (&unrecognized_cplus_name_complaint, string);
+ complaint (&symfile_complaints, "Unknown C++ symbol name `%s'",
+ string);
goto normal; /* Do *something* with it */
}
}
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
{
- complain (®_value_complaint, SYMBOL_VALUE (sym),
- NUM_REGS + NUM_PSEUDO_REGS,
- SYMBOL_SOURCE_NAME (sym));
+ reg_value_complaint (SYMBOL_VALUE (sym),
+ NUM_REGS + NUM_PSEUDO_REGS,
+ SYMBOL_SOURCE_NAME (sym));
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
{
- complain (®_value_complaint, SYMBOL_VALUE (sym),
- NUM_REGS + NUM_PSEUDO_REGS,
- SYMBOL_SOURCE_NAME (sym));
+ reg_value_complaint (SYMBOL_VALUE (sym),
+ NUM_REGS + NUM_PSEUDO_REGS,
+ SYMBOL_SOURCE_NAME (sym));
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
a typedef for "foo". Unfortunately, cfront never makes the typedef
when translating C++ into C. We make the typedef here so that
"ptype foo" works as expected for cfront translated code. */
- else if (current_subfile->language == language_cplus)
+ else if ((current_subfile->language == language_cplus)
+ || (current_subfile->language == language_objc))
synonym = 1;
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
{
- complain (®_value_complaint, SYMBOL_VALUE (sym),
- NUM_REGS + NUM_PSEUDO_REGS,
- SYMBOL_SOURCE_NAME (sym));
+ reg_value_complaint (SYMBOL_VALUE (sym),
+ NUM_REGS + NUM_PSEUDO_REGS,
+ SYMBOL_SOURCE_NAME (sym));
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
p = strchr (p, ')');
if (!*p || *p != ')')
{
- complain (&lrs_general_complaint, "live range format not recognized");
+ lrs_general_complaint ("live range format not recognized");
return NULL;
}
p++;
/* Sanity check the beginning of the stabs string. */
if (!*p || *p != 'l')
{
- complain (&lrs_general_complaint, "live range string 1");
+ lrs_general_complaint ("live range string 1");
return 0;
}
p++;
if (!*p || *p != '(')
{
- complain (&lrs_general_complaint, "live range string 2");
+ lrs_general_complaint ("live range string 2");
return 0;
}
p++;
start = ref_search_value (refnum);
if (!start)
{
- complain (&lrs_general_complaint, "Live range symbol not found 1");
+ lrs_general_complaint ("Live range symbol not found 1");
return 0;
}
if (!*p || *p != ',')
{
- complain (&lrs_general_complaint, "live range string 3");
+ lrs_general_complaint ("live range string 3");
return 0;
}
p++;
end = ref_search_value (refnum);
if (!end)
{
- complain (&lrs_general_complaint, "Live range symbol not found 2");
+ lrs_general_complaint ("Live range symbol not found 2");
return 0;
}
if (!*p || *p != ')')
{
- complain (&lrs_general_complaint, "live range string 4");
+ lrs_general_complaint ("live range string 4");
return 0;
}
if (start >= end)
{
- complain (&lrs_general_complaint, "end of live range follows start");
+ lrs_general_complaint ("end of live range follows start");
return;
}
static struct type *
error_type (char **pp, struct objfile *objfile)
{
- complain (&error_type_complaint);
+ complaint (&symfile_complaints, "couldn't parse type; debugger out of date?");
while (1)
{
/* Skip to end of symbol. */
{
/* Complain and keep going, so compilers can invent new
cross-reference types. */
- static struct complaint msg =
- {"Unrecognized cross-reference type `%c'", 0, 0};
- complain (&msg, (*pp)[0]);
+ complaint (&symfile_complaints,
+ "Unrecognized cross-reference type `%c'", (*pp)[0]);
code = TYPE_CODE_STRUCT;
break;
}
++*pp;
else
{
- static struct complaint msg = {
- "Prototyped function type didn't end arguments with `#':\n%s",
- 0, 0
- };
- complain (&msg, type_start);
+ complaint (&symfile_complaints,
+ "Prototyped function type didn't end arguments with `#':\n%s",
+ type_start);
}
/* If there is just one argument whose type is `void', then
(*pp)++;
return_type = read_type (pp, objfile);
if (*(*pp)++ != ';')
- complain (&invalid_member_complaint, symnum);
+ complaint (&symfile_complaints,
+ "invalid (minimal) member type data format at symtab pos %d.",
+ symnum);
type = allocate_stub_method (return_type);
if (typenums[0] != -1)
*dbx_lookup_type (typenums) = type;
if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
{
- complain (&rs6000_builtin_complaint, typenum);
+ complaint (&symfile_complaints, "Unknown builtin type %d", typenum);
return builtin_type_error;
}
if (negative_types[-typenum] != NULL)
/* This lets the user type "break operator+".
We could just put in "+" as the name, but that wouldn't
work for "*". */
- static char opname[32] =
- {'o', 'p', CPLUS_MARKER};
+ static char opname[32] = "op$";
char *o = opname + 3;
/* Skip past '::'. */
case '.':
break;
default:
- complain (&const_vol_complaint, **pp);
+ complaint (&symfile_complaints,
+ "const/volatile indicator missing, got '%c'", **pp);
break;
}
default:
/* error */
- complain (&member_fn_complaint, (*pp)[-1]);
+ complaint (&symfile_complaints,
+ "member function type missing, got '%c'", (*pp)[-1]);
/* Fall through into normal member function. */
case '.':
name = type_name_no_tag (context);
if (name == NULL)
{
- complain (&invalid_cpp_type_complaint, symnum);
+ complaint (&symfile_complaints,
+ "C++ abbreviated type name unknown at symtab pos %d",
+ symnum);
name = "FOO";
}
fip->list->field.name =
break;
default:
- complain (&invalid_cpp_abbrev_complaint, *pp);
+ invalid_cpp_abbrev_complaint (*pp);
fip->list->field.name =
obconcat (&objfile->type_obstack,
"INVALID_CPLUSPLUS_ABBREV", "", "");
p = ++(*pp);
if (p[-1] != ':')
{
- complain (&invalid_cpp_abbrev_complaint, *pp);
+ invalid_cpp_abbrev_complaint (*pp);
return 0;
}
fip->list->field.type = read_type (pp, objfile);
}
else
{
- complain (&invalid_cpp_abbrev_complaint, *pp);
+ invalid_cpp_abbrev_complaint (*pp);
/* We have no idea what syntax an unrecognized abbrev would have, so
better return 0. If we returned 1, we would need to at least advance
*pp to avoid an infinite loop. */
else if (**pp != ',')
{
/* Bad structure-type format. */
- complain (&stabs_general_complaint, "bad structure-type format");
+ stabs_general_complaint ("bad structure-type format");
return;
}
FIELD_BITPOS (fip->list->field) = read_huge_number (pp, ',', &nbits);
if (nbits != 0)
{
- complain (&stabs_general_complaint, "bad structure-type format");
+ stabs_general_complaint ("bad structure-type format");
return;
}
FIELD_BITSIZE (fip->list->field) = read_huge_number (pp, ';', &nbits);
if (nbits != 0)
{
- complain (&stabs_general_complaint, "bad structure-type format");
+ stabs_general_complaint ("bad structure-type format");
return;
}
}
default:
/* Unknown character. Complain and treat it as non-virtual. */
{
- static struct complaint msg =
- {
- "Unknown virtual character `%c' for baseclass", 0, 0};
- complain (&msg, **pp);
+ complaint (&symfile_complaints,
+ "Unknown virtual character `%c' for baseclass", **pp);
}
}
++(*pp);
/* Bad visibility format. Complain and treat it as
public. */
{
- static struct complaint msg =
- {
- "Unknown visibility `%c' for baseclass", 0, 0
- };
- complain (&msg, new->visibility);
+ complaint (&symfile_complaints,
+ "Unknown visibility `%c' for baseclass",
+ new->visibility);
new->visibility = VISIBILITY_PUBLIC;
}
}
i >= TYPE_N_BASECLASSES (t);
--i)
{
- if (!strncmp (TYPE_FIELD_NAME (t, i), vptr_name,
- sizeof (vptr_name) - 1))
+ char *name = TYPE_FIELD_NAME (t, i);
+ if (!strncmp (name, vptr_name, sizeof (vptr_name) - 2)
+ && is_cplus_marker (name[sizeof (vptr_name) - 2]))
{
TYPE_VPTR_FIELDNO (type) = i;
goto gotit;
}
}
/* Virtual function table field not found. */
- complain (&vtbl_notfound_complaint, TYPE_NAME (type));
+ complaint (&symfile_complaints,
+ "virtual function table pointer not found when defining class `%s'",
+ TYPE_NAME (type));
return 0;
}
else
ref_static = lookup_symbol (sname, 0, VAR_NAMESPACE, 0, 0); /*demangled_name */
if (!ref_static)
{
- static struct complaint msg =
- {"\
- Unable to find symbol for static data field %s\n",
- 0, 0};
- complain (&msg, sname);
+ complaint (&symfile_complaints,
+ "Unable to find symbol for static data field %s", sname);
continue;
}
stype = SYMBOL_TYPE (ref_static);
default:
/* Unknown visibility. Complain and treat it as public. */
{
- static struct complaint msg =
- {
- "Unknown visibility `%c' for field", 0, 0};
- complain (&msg, fip->list->visibility);
+ complaint (&symfile_complaints, "Unknown visibility `%c' for field",
+ fip->list->visibility);
}
break;
}
}
-static struct complaint multiply_defined_struct =
-{"struct/union type gets multiply defined: %s%s", 0, 0};
-
-
/* Complain that the compiler has emitted more than one definition for the
structure type TYPE. */
static void
kind = "";
}
- complain (&multiply_defined_struct, kind, name);
+ complaint (&symfile_complaints,
+ "struct/union type gets multiply defined: %s%s", kind, name);
}
static struct type *range_type_index;
- complain (&range_type_base_complaint, rangenums[1]);
+ complaint (&symfile_complaints,
+ "base type %d of range type is not defined", rangenums[1]);
if (range_type_index == NULL)
range_type_index =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
{
if (common_block_name != NULL)
{
- static struct complaint msg =
- {
- "Invalid symbol data: common block within common block",
- 0, 0};
- complain (&msg);
+ complaint (&symfile_complaints,
+ "Invalid symbol data: common block within common block");
}
common_block = local_symbols;
common_block_i = local_symbols ? local_symbols->nsyms : 0;
if (common_block_name == NULL)
{
- static struct complaint msg =
- {"ECOMM symbol unmatched by BCOMM", 0, 0};
- complain (&msg);
+ complaint (&symfile_complaints, "ECOMM symbol unmatched by BCOMM");
return;
}
if (typename == NULL)
{
- static struct complaint msg =
- {"need a type name", 0, 0};
- complain (&msg);
+ complaint (&symfile_complaints, "need a type name");
break;
}
for (ppt = file_symbols; ppt; ppt = ppt->next)
default:
{
- static struct complaint msg =
- {"\
-GDB internal error. cleanup_undefined_types with bad type %d.", 0, 0};
- complain (&msg, TYPE_CODE (*type));
+ complaint (&symfile_complaints,
+ "GDB internal error. cleanup_undefined_types with bad type %d.",
+ TYPE_CODE (*type));
}
break;
}
if (SYMBOL_CLASS (prev) == LOC_STATIC)
SYMBOL_CLASS (prev) = LOC_UNRESOLVED;
else
- complain (&unresolved_sym_chain_complaint,
- objfile->name, SYMBOL_NAME (prev));
+ complaint (&symfile_complaints,
+ "%s: common block `%s' from global_sym_chain unresolved",
+ objfile->name, SYMBOL_NAME (prev));
}
}
memset (global_sym_chain, 0, sizeof (global_sym_chain));
}
}
+/* Find the end of the name, delimited by a ':', but don't match
+ ObjC symbols which look like -[Foo bar::]:bla. */
+static char *
+find_name_end (char *name)
+{
+ char *s = name;
+ if (s[0] == '-' || *s == '+')
+ {
+ /* Must be an ObjC method symbol. */
+ if (s[1] != '[')
+ {
+ error ("invalid symbol name \"%s\"", name);
+ }
+ s = strchr (s, ']');
+ if (s == NULL)
+ {
+ error ("invalid symbol name \"%s\"", name);
+ }
+ return strchr (s, ':');
+ }
+ else
+ {
+ return strchr (s, ':');
+ }
+}
+
/* Initializer for this module */
void