extern int
address_space_name_to_int (char *space_identifier)
{
+ struct gdbarch *gdbarch = current_gdbarch;
+ int type_flags;
/* Check for known address space delimiters. */
if (!strcmp (space_identifier, "code"))
return TYPE_FLAG_CODE_SPACE;
else if (!strcmp (space_identifier, "data"))
return TYPE_FLAG_DATA_SPACE;
+ else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
+ && gdbarch_address_class_name_to_type_flags (gdbarch,
+ space_identifier,
+ &type_flags))
+ return type_flags;
else
error ("Unknown address space specifier: \"%s\"", space_identifier);
}
/* Identify address space identifier by integer flag as defined in
gdbtypes.h -- return the string version of the adress space name. */
-extern char *
+const char *
address_space_int_to_name (int space_flag)
{
+ struct gdbarch *gdbarch = current_gdbarch;
if (space_flag & TYPE_FLAG_CODE_SPACE)
return "code";
else if (space_flag & TYPE_FLAG_DATA_SPACE)
return "data";
+ else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL)
+ && gdbarch_address_class_type_flags_to_name_p (gdbarch))
+ return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
else
return NULL;
}
is identical to the one supplied except that it has an address
space attribute attached to it (such as "code" or "data").
- This is for Harvard architectures. */
+ The space attributes "code" and "data" are for Harvard architectures.
+ The address space attributes are for architectures which have
+ alternately sized pointers or pointers with alternate representations. */
struct type *
make_type_with_address_space (struct type *type, int space_flag)
{
struct type *ntype;
int new_flags = ((TYPE_INSTANCE_FLAGS (type)
- & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE))
+ & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE
+ | TYPE_FLAG_ADDRESS_CLASS_ALL))
| space_flag);
return make_qualified_type (type, new_flags, NULL);
virtual (and hence we cannot share the table pointer). */
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
- fill_in_vptr_fieldno (TYPE_BASECLASS (type, i));
- if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)) >= 0)
+ struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
+ fill_in_vptr_fieldno (baseclass);
+ if (TYPE_VPTR_FIELDNO (baseclass) >= 0)
{
- TYPE_VPTR_FIELDNO (type)
- = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i));
- TYPE_VPTR_BASETYPE (type)
- = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type, i));
+ TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (baseclass);
+ TYPE_VPTR_BASETYPE (type) = TYPE_VPTR_BASETYPE (baseclass);
break;
}
}
This used to be coded as a macro, but I don't think it is called
often enough to merit such treatment. */
-struct complaint stub_noname_complaint =
-{"stub type has NULL name", 0, 0};
+static void
+stub_noname_complaint (void)
+{
+ complaint (&symfile_complaints, "stub type has NULL name");
+}
struct type *
check_typedef (struct type *type)
TYPE_TAG_NAME were separate). */
if (name == NULL)
{
- complain (&stub_noname_complaint);
+ stub_noname_complaint ();
return type;
}
sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0,
struct type *newtype;
if (name == NULL)
{
- complain (&stub_noname_complaint);
+ stub_noname_complaint ();
return type;
}
newtype = lookup_transparent_type (name);
struct symbol *sym;
if (name == NULL)
{
- complain (&stub_noname_complaint);
+ stub_noname_complaint ();
return type;
}
sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, (struct symtab **) NULL);
break;
default:
{
-
- static struct complaint msg =
- {"Bad int type code length x%x\n", 0, 0};
-
- complain (&msg, tlen);
-
+ complaint (&symfile_complaints, "Bad int type code length x%x",
+ tlen);
}
}
break;
break;
default:
{
- static struct complaint msg =
- {"Bad float type code length x%x\n", 0, 0};
- complain (&msg, tlen);
+ complaint (&symfile_complaints, "Bad float type code length x%x",
+ tlen);
}
}
break;
break;
case TYPE_CODE_TYPEDEF:
{
- static struct complaint msg =
- {"Typedefs in overloaded functions not yet supported\n", 0, 0};
- complain (&msg);
+ complaint (&symfile_complaints,
+ "Typedefs in overloaded functions not yet supported");
}
/* followed by type bytes & name */
break;
case TYPE_CODE_ERROR:
default:
{
- static struct complaint msg =
- {"Unknown type code x%x\n", 0, 0};
- complain (&msg, tcode);
+ complaint (&symfile_complaints, "Unknown type code x%x", tcode);
}
}
if (TYPE_TARGET_TYPE (t))
which info used to be in the stab's but was removed to hack back
the space required for them. */
-void
+static void
check_stub_method (struct type *type, int method_id, int signature_id)
{
struct fn_field *f;
xfree (demangled_name);
}
+/* This is the external interface to check_stub_method, above. This function
+ unstubs all of the signatures for TYPE's METHOD_ID method name. After
+ calling this function TYPE_FN_FIELD_STUB will be cleared for each signature
+ and TYPE_FN_FIELDLIST_NAME will be correct.
+
+ This function unfortunately can not die until stabs do. */
+
+void
+check_stub_method_group (struct type *type, int method_id)
+{
+ int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id);
+ struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
+ int j, found_stub = 0;
+
+ for (j = 0; j < len; j++)
+ if (TYPE_FN_FIELD_STUB (f, j))
+ {
+ found_stub = 1;
+ check_stub_method (type, method_id, j);
+ }
+
+ /* GNU v3 methods with incorrect names were corrected when we read in
+ type information, because it was cheaper to do it then. The only GNU v2
+ methods with incorrect method names are operators and destructors;
+ destructors were also corrected when we read in type information.
+
+ Therefore the only thing we need to handle here are v2 operator
+ names. */
+ if (found_stub && strncmp (TYPE_FN_FIELD_PHYSNAME (f, 0), "_Z", 2) != 0)
+ {
+ int ret;
+ char dem_opname[256];
+
+ ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id),
+ dem_opname, DMGL_ANSI);
+ if (!ret)
+ ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id),
+ dem_opname, 0);
+ if (ret)
+ TYPE_FN_FIELDLIST_NAME (type, method_id) = xstrdup (dem_opname);
+ }
+}
+
const struct cplus_struct_type cplus_struct_default;
void
|| (TYPE_CODE (t) == TYPE_CODE_BOOL)));
}
-/* (OBSOLETE) Chill (OBSOLETE) varying string and arrays are
- represented as follows:
-
- struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
-
- Return true if TYPE is such a (OBSOLETE) Chill (OBSOLETE) varying
- type. */
-
-/* OBSOLETE int */
-/* OBSOLETE chill_varying_type (struct type *type) */
-/* OBSOLETE { */
-/* OBSOLETE if (TYPE_CODE (type) != TYPE_CODE_STRUCT */
-/* OBSOLETE || TYPE_NFIELDS (type) != 2 */
-/* OBSOLETE || strcmp (TYPE_FIELD_NAME (type, 0), "__var_length") != 0) */
-/* OBSOLETE return 0; */
-/* OBSOLETE return 1; */
-/* OBSOLETE } */
-
/* Check whether BASE is an ancestor or base class or DCLASS
Return 1 if so, and 0 if not.
Note: callers may want to check for identity of the types before
{
puts_filtered (" TYPE_FLAG_DATA_SPACE");
}
+ if (TYPE_ADDRESS_CLASS_1 (type))
+ {
+ puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1");
+ }
+ if (TYPE_ADDRESS_CLASS_2 (type))
+ {
+ puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
+ }
puts_filtered ("\n");
printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
if (TYPE_UNSIGNED (type))
"__bfd_vma", (struct objfile *) NULL);
}
-
extern void _initialize_gdbtypes (void);
void
_initialize_gdbtypes (void)