#include "defs.h"
#include "gdb_string.h"
#include "bfd.h"
-#include "obstack.h"
+#include "gdb_obstack.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "demangle.h"
#include "language.h"
#include "doublest.h"
+#include "cp-abi.h"
+#include "cp-support.h"
#include <ctype.h>
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)
\f
/* This page contains subroutines of read_type. */
+/* Replace *OLD_NAME with the method name portion of PHYSNAME. */
+
+static void
+update_method_name_from_physname (char **old_name, char *physname)
+{
+ char *method_name;
+
+ method_name = method_name_from_physname (physname);
+
+ if (method_name == NULL)
+ error ("bad physname %s\n", physname);
+
+ if (strcmp (*old_name, method_name) != 0)
+ {
+ xfree (*old_name);
+ *old_name = method_name;
+ }
+ else
+ xfree (method_name);
+}
+
/* Read member function stabs info for C++ classes. The form of each member
function data is:
/* 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 '.':
}
else
{
+ int has_stub = 0;
+ int has_destructor = 0, has_other = 0;
+ int is_v3 = 0;
+ struct next_fnfield *tmp_sublist;
+
+ /* Various versions of GCC emit various mostly-useless
+ strings in the name field for special member functions.
+
+ For stub methods, we need to defer correcting the name
+ until we are ready to unstub the method, because the current
+ name string is used by gdb_mangle_name. The only stub methods
+ of concern here are GNU v2 operators; other methods have their
+ names correct (see caveat below).
+
+ For non-stub methods, in GNU v3, we have a complete physname.
+ Therefore we can safely correct the name now. This primarily
+ affects constructors and destructors, whose name will be
+ __comp_ctor or __comp_dtor instead of Foo or ~Foo. Cast
+ operators will also have incorrect names; for instance,
+ "operator int" will be named "operator i" (i.e. the type is
+ mangled).
+
+ For non-stub methods in GNU v2, we have no easy way to
+ know if we have a complete physname or not. For most
+ methods the result depends on the platform (if CPLUS_MARKER
+ can be `$' or `.', it will use minimal debug information, or
+ otherwise the full physname will be included).
+
+ Rather than dealing with this, we take a different approach.
+ For v3 mangled names, we can use the full physname; for v2,
+ we use cplus_demangle_opname (which is actually v2 specific),
+ because the only interesting names are all operators - once again
+ barring the caveat below. Skip this process if any method in the
+ group is a stub, to prevent our fouling up the workings of
+ gdb_mangle_name.
+
+ The caveat: GCC 2.95.x (and earlier?) put constructors and
+ destructors in the same method group. We need to split this
+ into two groups, because they should have different names.
+ So for each method group we check whether it contains both
+ routines whose physname appears to be a destructor (the physnames
+ for and destructors are always provided, due to quirks in v2
+ mangling) and routines whose physname does not appear to be a
+ destructor. If so then we break up the list into two halves.
+ Even if the constructors and destructors aren't in the same group
+ the destructor will still lack the leading tilde, so that also
+ needs to be fixed.
+
+ So, to summarize what we expect and handle here:
+
+ Given Given Real Real Action
+ method name physname physname method name
+
+ __opi [none] __opi__3Foo operator int opname
+ [now or later]
+ Foo _._3Foo _._3Foo ~Foo separate and
+ rename
+ operator i _ZN3FoocviEv _ZN3FoocviEv operator int demangle
+ __comp_ctor _ZN3FooC1ERKS_ _ZN3FooC1ERKS_ Foo demangle
+ */
+
+ tmp_sublist = sublist;
+ while (tmp_sublist != NULL)
+ {
+ if (tmp_sublist->fn_field.is_stub)
+ has_stub = 1;
+ if (tmp_sublist->fn_field.physname[0] == '_'
+ && tmp_sublist->fn_field.physname[1] == 'Z')
+ is_v3 = 1;
+
+ if (is_destructor_name (tmp_sublist->fn_field.physname))
+ has_destructor++;
+ else
+ has_other++;
+
+ tmp_sublist = tmp_sublist->next;
+ }
+
+ if (has_destructor && has_other)
+ {
+ struct next_fnfieldlist *destr_fnlist;
+ struct next_fnfield *last_sublist;
+
+ /* Create a new fn_fieldlist for the destructors. */
+
+ destr_fnlist = (struct next_fnfieldlist *)
+ xmalloc (sizeof (struct next_fnfieldlist));
+ make_cleanup (xfree, destr_fnlist);
+ memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist));
+ destr_fnlist->fn_fieldlist.name
+ = obconcat (&objfile->type_obstack, "", "~",
+ new_fnlist->fn_fieldlist.name);
+
+ destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
+ obstack_alloc (&objfile->type_obstack,
+ sizeof (struct fn_field) * has_destructor);
+ memset (destr_fnlist->fn_fieldlist.fn_fields, 0,
+ sizeof (struct fn_field) * has_destructor);
+ tmp_sublist = sublist;
+ last_sublist = NULL;
+ i = 0;
+ while (tmp_sublist != NULL)
+ {
+ if (!is_destructor_name (tmp_sublist->fn_field.physname))
+ {
+ tmp_sublist = tmp_sublist->next;
+ continue;
+ }
+
+ destr_fnlist->fn_fieldlist.fn_fields[i++]
+ = tmp_sublist->fn_field;
+ if (last_sublist)
+ last_sublist->next = tmp_sublist->next;
+ else
+ sublist = tmp_sublist->next;
+ last_sublist = tmp_sublist;
+ tmp_sublist = tmp_sublist->next;
+ }
+
+ destr_fnlist->fn_fieldlist.length = has_destructor;
+ destr_fnlist->next = fip->fnlist;
+ fip->fnlist = destr_fnlist;
+ nfn_fields++;
+ total_length += has_destructor;
+ length -= has_destructor;
+ }
+ else if (is_v3)
+ {
+ /* v3 mangling prevents the use of abbreviated physnames,
+ so we can do this here. There are stubbed methods in v3
+ only:
+ - in -gstabs instead of -gstabs+
+ - or for static methods, which are output as a function type
+ instead of a method type. */
+
+ update_method_name_from_physname (&new_fnlist->fn_fieldlist.name,
+ sublist->fn_field.physname);
+ }
+ else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~')
+ {
+ new_fnlist->fn_fieldlist.name = concat ("~", main_fn_name, NULL);
+ xfree (main_fn_name);
+ }
+ else if (!has_stub)
+ {
+ char dem_opname[256];
+ int ret;
+ ret = cplus_demangle_opname (new_fnlist->fn_fieldlist.name,
+ dem_opname, DMGL_ANSI);
+ if (!ret)
+ ret = cplus_demangle_opname (new_fnlist->fn_fieldlist.name,
+ dem_opname, 0);
+ if (ret)
+ new_fnlist->fn_fieldlist.name
+ = obsavestring (dem_opname, strlen (dem_opname),
+ &objfile->type_obstack);
+ }
+
new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
obstack_alloc (&objfile->type_obstack,
sizeof (struct fn_field) * length);
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;
}
}
}
if (p[0] == ':' && p[1] == ':')
{
- /* chill the list of fields: the last entry (at the head) is a
- partially constructed entry which we now scrub. */
+ /* (OBSOLETE) chill (OBSOLETE) the list of fields: the last
+ entry (at the head) is a partially constructed entry which we
+ now scrub. */
fip->list = fip->list->next;
}
return 1;
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);
}
else if (self_subrange && n2 == 0 && n3 == 127)
return init_type (TYPE_CODE_INT, 1, 0, NULL, objfile);
- else if (current_symbol && SYMBOL_LANGUAGE (current_symbol) == language_chill
- && !self_subrange)
- goto handle_true_range;
+#if 0
+ /* OBSOLETE else if (current_symbol && SYMBOL_LANGUAGE (current_symbol) == language_chill */
+ /* OBSOLETE && !self_subrange) */
+ /* OBSOLETE goto handle_true_range; */
+#endif
/* We used to do this only for subrange of self or subrange of int. */
else if (n2 == 0)
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