forked from Imagelibrary/binutils-gdb
Remove init_type
This removes init_type, replacing all uses with the new type allocator. Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -372,11 +372,12 @@ ctf_init_float_type (struct objfile *objfile,
|
|||||||
const struct floatformat **format;
|
const struct floatformat **format;
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits);
|
format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits);
|
||||||
if (format != nullptr)
|
if (format != nullptr)
|
||||||
type = init_float_type (objfile, bits, name, format);
|
type = init_float_type (objfile, bits, name, format);
|
||||||
else
|
else
|
||||||
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
|
type = alloc.new_type (TYPE_CODE_ERROR, bits, name);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -554,6 +555,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
|
|||||||
ctf_errmsg (ctf_errno (fp)));
|
ctf_errmsg (ctf_errno (fp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_allocator alloc (of);
|
||||||
kind = ctf_type_kind (fp, tid);
|
kind = ctf_type_kind (fp, tid);
|
||||||
if (kind == CTF_K_INTEGER)
|
if (kind == CTF_K_INTEGER)
|
||||||
{
|
{
|
||||||
@@ -596,7 +598,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
complaint (_("read_base_type: unsupported base kind (%d)"), kind);
|
complaint (_("read_base_type: unsupported base kind (%d)"), kind);
|
||||||
type = init_type (of, TYPE_CODE_ERROR, cet.cte_bits, name);
|
type = alloc.new_type (TYPE_CODE_ERROR, cet.cte_bits, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name != nullptr && strcmp (name, "char") == 0)
|
if (name != nullptr && strcmp (name, "char") == 0)
|
||||||
@@ -928,7 +930,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
|
|||||||
struct type *this_type, *target_type;
|
struct type *this_type, *target_type;
|
||||||
|
|
||||||
char *aname = obstack_strdup (&objfile->objfile_obstack, name);
|
char *aname = obstack_strdup (&objfile->objfile_obstack, name);
|
||||||
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, aname);
|
this_type = type_allocator (objfile).new_type (TYPE_CODE_TYPEDEF, 0, aname);
|
||||||
set_tid_type (objfile, tid, this_type);
|
set_tid_type (objfile, tid, this_type);
|
||||||
target_type = fetch_tid_type (ccp, btid);
|
target_type = fetch_tid_type (ccp, btid);
|
||||||
if (target_type != this_type)
|
if (target_type != this_type)
|
||||||
|
|||||||
@@ -5860,7 +5860,8 @@ fixup_go_packaging (struct dwarf2_cu *cu)
|
|||||||
{
|
{
|
||||||
struct objfile *objfile = cu->per_objfile->objfile;
|
struct objfile *objfile = cu->per_objfile->objfile;
|
||||||
const char *saved_package_name = objfile->intern (package_name.get ());
|
const char *saved_package_name = objfile->intern (package_name.get ());
|
||||||
struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
|
struct type *type
|
||||||
|
= type_allocator (objfile).new_type (TYPE_CODE_MODULE, 0,
|
||||||
saved_package_name);
|
saved_package_name);
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
@@ -6048,7 +6049,8 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
|
|||||||
const char *dataless_name
|
const char *dataless_name
|
||||||
= rust_fully_qualify (&objfile->objfile_obstack, type->name (),
|
= rust_fully_qualify (&objfile->objfile_obstack, type->name (),
|
||||||
name);
|
name);
|
||||||
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
|
struct type *dataless_type
|
||||||
|
= type_allocator (objfile).new_type (TYPE_CODE_VOID, 0,
|
||||||
dataless_name);
|
dataless_name);
|
||||||
type->field (2).set_type (dataless_type);
|
type->field (2).set_type (dataless_type);
|
||||||
/* NAME points into the original discriminant name, which
|
/* NAME points into the original discriminant name, which
|
||||||
@@ -14039,7 +14041,7 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
previous_prefix, name, 0, cu);
|
previous_prefix, name, 0, cu);
|
||||||
|
|
||||||
/* Create the type. */
|
/* Create the type. */
|
||||||
type = init_type (objfile, TYPE_CODE_NAMESPACE, 0, name);
|
type = type_allocator (objfile).new_type (TYPE_CODE_NAMESPACE, 0, name);
|
||||||
|
|
||||||
return set_die_type (die, type, cu);
|
return set_die_type (die, type, cu);
|
||||||
}
|
}
|
||||||
@@ -14101,7 +14103,7 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
module_name = dwarf2_name (die, cu);
|
module_name = dwarf2_name (die, cu);
|
||||||
type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
|
type = type_allocator (objfile).new_type (TYPE_CODE_MODULE, 0, module_name);
|
||||||
|
|
||||||
return set_die_type (die, type, cu);
|
return set_die_type (die, type, cu);
|
||||||
}
|
}
|
||||||
@@ -14700,7 +14702,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
struct type *this_type, *target_type;
|
struct type *this_type, *target_type;
|
||||||
|
|
||||||
name = dwarf2_full_name (NULL, die, cu);
|
name = dwarf2_full_name (NULL, die, cu);
|
||||||
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
|
this_type = type_allocator (objfile).new_type (TYPE_CODE_TYPEDEF, 0, name);
|
||||||
this_type->set_target_is_stub (true);
|
this_type->set_target_is_stub (true);
|
||||||
set_die_type (die, this_type, cu);
|
set_die_type (die, this_type, cu);
|
||||||
target_type = die_type (die, cu);
|
target_type = die_type (die, cu);
|
||||||
@@ -15009,11 +15011,12 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name,
|
|||||||
const struct floatformat **format;
|
const struct floatformat **format;
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits);
|
format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits);
|
||||||
if (format)
|
if (format)
|
||||||
type = init_float_type (objfile, bits, name, format, byte_order);
|
type = init_float_type (objfile, bits, name, format, byte_order);
|
||||||
else
|
else
|
||||||
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
|
type = alloc.new_type (TYPE_CODE_ERROR, bits, name);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -15217,11 +15220,12 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
switch (encoding)
|
switch (encoding)
|
||||||
{
|
{
|
||||||
case DW_ATE_address:
|
case DW_ATE_address:
|
||||||
/* Turn DW_ATE_address into a void * pointer. */
|
/* Turn DW_ATE_address into a void * pointer. */
|
||||||
type = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
|
type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
|
||||||
type = init_pointer_type (objfile, bits, name, type);
|
type = init_pointer_type (objfile, bits, name, type);
|
||||||
break;
|
break;
|
||||||
case DW_ATE_boolean:
|
case DW_ATE_boolean:
|
||||||
@@ -15239,7 +15243,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
name = obconcat (obstack, "_Complex ", type->name (),
|
name = obconcat (obstack, "_Complex ", type->name (),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
|
type = alloc.new_type (TYPE_CODE_ERROR, bits, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
type = init_complex_type (name, type);
|
type = init_complex_type (name, type);
|
||||||
@@ -15298,7 +15302,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
default:
|
default:
|
||||||
complaint (_("unsupported DW_AT_encoding: '%s'"),
|
complaint (_("unsupported DW_AT_encoding: '%s'"),
|
||||||
dwarf_type_encoding_name (encoding));
|
dwarf_type_encoding_name (encoding));
|
||||||
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
|
type = alloc.new_type (TYPE_CODE_ERROR, bits, name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15744,7 +15748,8 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
type = init_type (cu->per_objfile->objfile, TYPE_CODE_VOID, 0, NULL);
|
type = (type_allocator (cu->per_objfile->objfile)
|
||||||
|
.new_type (TYPE_CODE_VOID, 0, nullptr));
|
||||||
type->set_name (dwarf2_name (die, cu));
|
type->set_name (dwarf2_name (die, cu));
|
||||||
|
|
||||||
/* In Ada, an unspecified type is typically used when the description
|
/* In Ada, an unspecified type is typically used when the description
|
||||||
@@ -19461,7 +19466,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
|
|||||||
sect_offset_str (die->sect_off));
|
sect_offset_str (die->sect_off));
|
||||||
saved = obstack_strdup (&objfile->objfile_obstack, message);
|
saved = obstack_strdup (&objfile->objfile_obstack, message);
|
||||||
|
|
||||||
return init_type (objfile, TYPE_CODE_ERROR, 0, saved);
|
return type_allocator (objfile).new_type (TYPE_CODE_ERROR, 0, saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up the type of DIE in CU using its type attribute ATTR.
|
/* Look up the type of DIE in CU using its type attribute ATTR.
|
||||||
|
|||||||
@@ -3398,37 +3398,6 @@ floatformat_from_type (const struct type *type)
|
|||||||
return TYPE_FLOATFORMAT (type);
|
return TYPE_FLOATFORMAT (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function to initialize the standard scalar types.
|
|
||||||
|
|
||||||
If NAME is non-NULL, then it is used to initialize the type name.
|
|
||||||
Note that NAME is not copied; it is required to have a lifetime at
|
|
||||||
least as long as OBJFILE. */
|
|
||||||
|
|
||||||
struct type *
|
|
||||||
init_type (struct objfile *objfile, enum type_code code, int bit,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
struct type *type;
|
|
||||||
|
|
||||||
type = type_allocator (objfile).new_type ();
|
|
||||||
set_type_code (type, code);
|
|
||||||
gdb_assert ((bit % TARGET_CHAR_BIT) == 0);
|
|
||||||
type->set_length (bit / TARGET_CHAR_BIT);
|
|
||||||
type->set_name (name);
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate a TYPE_CODE_ERROR type structure associated with OBJFILE,
|
|
||||||
to use with variables that have no debug info. NAME is the type
|
|
||||||
name. */
|
|
||||||
|
|
||||||
static struct type *
|
|
||||||
init_nodebug_var_type (struct objfile *objfile, const char *name)
|
|
||||||
{
|
|
||||||
return init_type (objfile, TYPE_CODE_ERROR, 0, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE.
|
/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE.
|
||||||
BIT is the type size in bits. If UNSIGNED_P is non-zero, set
|
BIT is the type size in bits. If UNSIGNED_P is non-zero, set
|
||||||
the type's TYPE_UNSIGNED flag. NAME is the type name. */
|
the type's TYPE_UNSIGNED flag. NAME is the type name. */
|
||||||
@@ -3439,7 +3408,7 @@ init_integer_type (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_INT, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_INT, bit, name);
|
||||||
if (unsigned_p)
|
if (unsigned_p)
|
||||||
t->set_is_unsigned (true);
|
t->set_is_unsigned (true);
|
||||||
|
|
||||||
@@ -3460,7 +3429,7 @@ init_character_type (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_CHAR, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_CHAR, bit, name);
|
||||||
if (unsigned_p)
|
if (unsigned_p)
|
||||||
t->set_is_unsigned (true);
|
t->set_is_unsigned (true);
|
||||||
|
|
||||||
@@ -3477,7 +3446,7 @@ init_boolean_type (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_BOOL, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_BOOL, bit, name);
|
||||||
if (unsigned_p)
|
if (unsigned_p)
|
||||||
t->set_is_unsigned (true);
|
t->set_is_unsigned (true);
|
||||||
|
|
||||||
@@ -3510,7 +3479,7 @@ init_float_type (struct objfile *objfile,
|
|||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
bit = verify_floatformat (bit, fmt);
|
bit = verify_floatformat (bit, fmt);
|
||||||
t = init_type (objfile, TYPE_CODE_FLT, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_FLT, bit, name);
|
||||||
TYPE_FLOATFORMAT (t) = fmt;
|
TYPE_FLOATFORMAT (t) = fmt;
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
@@ -3522,10 +3491,7 @@ init_float_type (struct objfile *objfile,
|
|||||||
struct type *
|
struct type *
|
||||||
init_decfloat_type (struct objfile *objfile, int bit, const char *name)
|
init_decfloat_type (struct objfile *objfile, int bit, const char *name)
|
||||||
{
|
{
|
||||||
struct type *t;
|
return type_allocator (objfile).new_type (TYPE_CODE_DECFLOAT, bit, name);
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_DECFLOAT, bit, name);
|
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if init_complex_type can be called with TARGET_TYPE. */
|
/* Return true if init_complex_type can be called with TARGET_TYPE. */
|
||||||
@@ -3583,7 +3549,7 @@ init_pointer_type (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_PTR, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_PTR, bit, name);
|
||||||
t->set_target_type (target_type);
|
t->set_target_type (target_type);
|
||||||
t->set_is_unsigned (true);
|
t->set_is_unsigned (true);
|
||||||
return t;
|
return t;
|
||||||
@@ -3600,7 +3566,7 @@ init_fixed_point_type (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
t = init_type (objfile, TYPE_CODE_FIXED_POINT, bit, name);
|
t = type_allocator (objfile).new_type (TYPE_CODE_FIXED_POINT, bit, name);
|
||||||
if (unsigned_p)
|
if (unsigned_p)
|
||||||
t->set_is_unsigned (true);
|
t->set_is_unsigned (true);
|
||||||
|
|
||||||
@@ -6291,9 +6257,11 @@ objfile_type (struct objfile *objfile)
|
|||||||
/* Use the objfile architecture to determine basic type properties. */
|
/* Use the objfile architecture to determine basic type properties. */
|
||||||
gdbarch = objfile->arch ();
|
gdbarch = objfile->arch ();
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
|
|
||||||
/* Basic types. */
|
/* Basic types. */
|
||||||
objfile_type->builtin_void
|
objfile_type->builtin_void
|
||||||
= init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
|
= alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
|
||||||
objfile_type->builtin_char
|
objfile_type->builtin_char
|
||||||
= init_integer_type (objfile, TARGET_CHAR_BIT,
|
= init_integer_type (objfile, TARGET_CHAR_BIT,
|
||||||
!gdbarch_char_signed (gdbarch), "char");
|
!gdbarch_char_signed (gdbarch), "char");
|
||||||
@@ -6340,16 +6308,16 @@ objfile_type (struct objfile *objfile)
|
|||||||
|
|
||||||
/* This type represents a type that was unrecognized in symbol read-in. */
|
/* This type represents a type that was unrecognized in symbol read-in. */
|
||||||
objfile_type->builtin_error
|
objfile_type->builtin_error
|
||||||
= init_type (objfile, TYPE_CODE_ERROR, 0, "<unknown type>");
|
= alloc.new_type (TYPE_CODE_ERROR, 0, "<unknown type>");
|
||||||
|
|
||||||
/* The following set of types is used for symbols with no
|
/* The following set of types is used for symbols with no
|
||||||
debug information. */
|
debug information. */
|
||||||
objfile_type->nodebug_text_symbol
|
objfile_type->nodebug_text_symbol
|
||||||
= init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
|
= alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT,
|
||||||
"<text variable, no debug info>");
|
"<text variable, no debug info>");
|
||||||
|
|
||||||
objfile_type->nodebug_text_gnu_ifunc_symbol
|
objfile_type->nodebug_text_gnu_ifunc_symbol
|
||||||
= init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
|
= alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT,
|
||||||
"<text gnu-indirect-function variable, no debug info>");
|
"<text gnu-indirect-function variable, no debug info>");
|
||||||
objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
|
objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
|
||||||
|
|
||||||
@@ -6358,11 +6326,13 @@ objfile_type (struct objfile *objfile)
|
|||||||
"<text from jump slot in .got.plt, no debug info>",
|
"<text from jump slot in .got.plt, no debug info>",
|
||||||
objfile_type->nodebug_text_symbol);
|
objfile_type->nodebug_text_symbol);
|
||||||
objfile_type->nodebug_data_symbol
|
objfile_type->nodebug_data_symbol
|
||||||
= init_nodebug_var_type (objfile, "<data variable, no debug info>");
|
= alloc.new_type (TYPE_CODE_ERROR, 0, "<data variable, no debug info>");
|
||||||
objfile_type->nodebug_unknown_symbol
|
objfile_type->nodebug_unknown_symbol
|
||||||
= init_nodebug_var_type (objfile, "<variable (not text or data), no debug info>");
|
= alloc.new_type (TYPE_CODE_ERROR, 0,
|
||||||
|
"<variable (not text or data), no debug info>");
|
||||||
objfile_type->nodebug_tls_symbol
|
objfile_type->nodebug_tls_symbol
|
||||||
= init_nodebug_var_type (objfile, "<thread local variable, no debug info>");
|
= alloc.new_type (TYPE_CODE_ERROR, 0,
|
||||||
|
"<thread local variable, no debug info>");
|
||||||
|
|
||||||
/* NOTE: on some targets, addresses and pointers are not necessarily
|
/* NOTE: on some targets, addresses and pointers are not necessarily
|
||||||
the same.
|
the same.
|
||||||
|
|||||||
@@ -2296,8 +2296,6 @@ private:
|
|||||||
|
|
||||||
/* * Helper function to construct objfile-owned types. */
|
/* * Helper function to construct objfile-owned types. */
|
||||||
|
|
||||||
extern struct type *init_type (struct objfile *, enum type_code, int,
|
|
||||||
const char *);
|
|
||||||
extern struct type *init_integer_type (struct objfile *, int, int,
|
extern struct type *init_integer_type (struct objfile *, int, int,
|
||||||
const char *);
|
const char *);
|
||||||
extern struct type *init_character_type (struct objfile *, int, int,
|
extern struct type *init_character_type (struct objfile *, int, int,
|
||||||
|
|||||||
@@ -1386,6 +1386,8 @@ basic_type (int bt, struct objfile *objfile)
|
|||||||
if (map_bt[bt])
|
if (map_bt[bt])
|
||||||
return map_bt[bt];
|
return map_bt[bt];
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
|
|
||||||
switch (bt)
|
switch (bt)
|
||||||
{
|
{
|
||||||
case btNil:
|
case btNil:
|
||||||
@@ -1457,14 +1459,14 @@ basic_type (int bt, struct objfile *objfile)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case btFloatDec:
|
case btFloatDec:
|
||||||
tp = init_type (objfile, TYPE_CODE_ERROR,
|
tp = alloc.new_type (TYPE_CODE_ERROR,
|
||||||
gdbarch_double_bit (gdbarch), "floating decimal");
|
gdbarch_double_bit (gdbarch), "floating decimal");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case btString:
|
case btString:
|
||||||
/* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
|
/* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
|
||||||
FIXME. */
|
FIXME. */
|
||||||
tp = init_type (objfile, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
|
tp = alloc.new_type (TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case btVoid:
|
case btVoid:
|
||||||
@@ -1573,6 +1575,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_allocator alloc (mdebugread_objfile);
|
||||||
|
|
||||||
/* Move on to next aux. */
|
/* Move on to next aux. */
|
||||||
ax++;
|
ax++;
|
||||||
|
|
||||||
@@ -1647,7 +1651,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
|
|||||||
/* Try to cross reference this type, build new type on failure. */
|
/* Try to cross reference this type, build new type on failure. */
|
||||||
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
||||||
if (tp == NULL)
|
if (tp == NULL)
|
||||||
tp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
tp = alloc.new_type (type_code, 0, NULL);
|
||||||
|
|
||||||
/* DEC c89 produces cross references to qualified aggregate types,
|
/* DEC c89 produces cross references to qualified aggregate types,
|
||||||
dereference them. */
|
dereference them. */
|
||||||
@@ -1705,7 +1709,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
|
|||||||
/* Try to cross reference this type, build new type on failure. */
|
/* Try to cross reference this type, build new type on failure. */
|
||||||
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
||||||
if (tp == NULL)
|
if (tp == NULL)
|
||||||
tp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
tp = alloc.new_type (type_code, 0, NULL);
|
||||||
|
|
||||||
/* Make sure that TYPE_CODE(tp) has an expected type code.
|
/* Make sure that TYPE_CODE(tp) has an expected type code.
|
||||||
Any type may be returned from cross_ref if file indirect entries
|
Any type may be returned from cross_ref if file indirect entries
|
||||||
@@ -4266,13 +4270,15 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
|
|||||||
rf = rn->rfd;
|
rf = rn->rfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_allocator alloc (mdebugread_objfile);
|
||||||
|
|
||||||
/* mips cc uses a rf of -1 for opaque struct definitions.
|
/* mips cc uses a rf of -1 for opaque struct definitions.
|
||||||
Set TYPE_STUB for these types so that check_typedef will
|
Set TYPE_STUB for these types so that check_typedef will
|
||||||
resolve them if the struct gets defined in another compilation unit. */
|
resolve them if the struct gets defined in another compilation unit. */
|
||||||
if (rf == -1)
|
if (rf == -1)
|
||||||
{
|
{
|
||||||
*pname = "<undefined>";
|
*pname = "<undefined>";
|
||||||
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
*tpp = alloc.new_type (type_code, 0, NULL);
|
||||||
(*tpp)->set_is_stub (true);
|
(*tpp)->set_is_stub (true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -4358,7 +4364,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
|
|||||||
switch (tir.bt)
|
switch (tir.bt)
|
||||||
{
|
{
|
||||||
case btVoid:
|
case btVoid:
|
||||||
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
*tpp = alloc.new_type (type_code, 0, NULL);
|
||||||
*pname = "<undefined>";
|
*pname = "<undefined>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -4392,7 +4398,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
|
|||||||
default:
|
default:
|
||||||
complaint (_("illegal bt %d in forward typedef for %s"), tir.bt,
|
complaint (_("illegal bt %d in forward typedef for %s"), tir.bt,
|
||||||
sym_name);
|
sym_name);
|
||||||
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
*tpp = alloc.new_type (type_code, 0, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -4420,7 +4426,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
|
|||||||
has not been parsed yet.
|
has not been parsed yet.
|
||||||
Initialize the type only, it will be filled in when
|
Initialize the type only, it will be filled in when
|
||||||
it's definition is parsed. */
|
it's definition is parsed. */
|
||||||
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
*tpp = alloc.new_type (type_code, 0, NULL);
|
||||||
}
|
}
|
||||||
add_pending (fh, esh, *tpp);
|
add_pending (fh, esh, *tpp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,10 +372,11 @@ dbx_init_float_type (struct objfile *objfile, int bits)
|
|||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
format = gdbarch_floatformat_for_type (gdbarch, NULL, bits);
|
format = gdbarch_floatformat_for_type (gdbarch, NULL, bits);
|
||||||
|
type_allocator alloc (objfile);
|
||||||
if (format)
|
if (format)
|
||||||
type = init_float_type (objfile, bits, NULL, format);
|
type = init_float_type (objfile, bits, NULL, format);
|
||||||
else
|
else
|
||||||
type = init_type (objfile, TYPE_CODE_ERROR, bits, NULL);
|
type = alloc.new_type (TYPE_CODE_ERROR, bits, NULL);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -2080,6 +2081,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
|
|||||||
TARGET_CHAR_BIT. */
|
TARGET_CHAR_BIT. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
switch (-typenum)
|
switch (-typenum)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@@ -2119,7 +2121,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
|
|||||||
rettype = init_integer_type (objfile, 32, 1, "unsigned long");
|
rettype = init_integer_type (objfile, 32, 1, "unsigned long");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
rettype = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
|
rettype = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
/* IEEE single precision (32 bit). */
|
/* IEEE single precision (32 bit). */
|
||||||
@@ -2153,7 +2155,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
|
|||||||
floatformats_ieee_double);
|
floatformats_ieee_double);
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");
|
rettype = alloc.new_type (TYPE_CODE_ERROR, 0, "stringptr");
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
rettype = init_character_type (objfile, 8, 1, "character");
|
rettype = init_character_type (objfile, 8, 1, "character");
|
||||||
@@ -3745,10 +3747,11 @@ read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile
|
|||||||
if (**pp == ';')
|
if (**pp == ';')
|
||||||
++(*pp);
|
++(*pp);
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
if (type_bits == 0)
|
if (type_bits == 0)
|
||||||
{
|
{
|
||||||
struct type *type = init_type (objfile, TYPE_CODE_VOID,
|
struct type *type = alloc.new_type (TYPE_CODE_VOID,
|
||||||
TARGET_CHAR_BIT, NULL);
|
TARGET_CHAR_BIT, nullptr);
|
||||||
if (unsigned_type)
|
if (unsigned_type)
|
||||||
type->set_is_unsigned (true);
|
type->set_is_unsigned (true);
|
||||||
|
|
||||||
@@ -4013,6 +4016,8 @@ read_range_type (const char **pp, int typenums[2], int type_size,
|
|||||||
if (n2bits == -1 || n3bits == -1)
|
if (n2bits == -1 || n3bits == -1)
|
||||||
return error_type (pp, objfile);
|
return error_type (pp, objfile);
|
||||||
|
|
||||||
|
type_allocator alloc (objfile);
|
||||||
|
|
||||||
if (index_type)
|
if (index_type)
|
||||||
goto handle_true_range;
|
goto handle_true_range;
|
||||||
|
|
||||||
@@ -4061,7 +4066,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
|
|||||||
|
|
||||||
/* A type defined as a subrange of itself, with bounds both 0, is void. */
|
/* A type defined as a subrange of itself, with bounds both 0, is void. */
|
||||||
if (self_subrange && n2 == 0 && n3 == 0)
|
if (self_subrange && n2 == 0 && n3 == 0)
|
||||||
return init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
|
return alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, nullptr);
|
||||||
|
|
||||||
/* If n3 is zero and n2 is positive, we want a floating type, and n2
|
/* If n3 is zero and n2 is positive, we want a floating type, and n2
|
||||||
is the width in bytes.
|
is the width in bytes.
|
||||||
|
|||||||
Reference in New Issue
Block a user