lowpc += baseaddr;
highpc += baseaddr;
+ /* Find the filename. Do not use dwarf2_name here, since the filename
+ is not a source language identifier. */
attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr)
{
}
/* Get name of field. */
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- fieldname = DW_STRING (attr);
+ fieldname = dwarf2_name (die, cu);
+ if (fieldname == NULL)
+ fieldname = "";
/* The name is already allocated along with this objfile, so we don't
need to duplicate it for the type. */
char *physname;
/* Get name of field. */
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- fieldname = DW_STRING (attr);
- else
+ fieldname = dwarf2_name (die, cu);
+ if (fieldname == NULL)
return;
/* Get physical name. */
struct nextfnfield *new_fnfield;
/* Get name of member function. */
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- fieldname = DW_STRING (attr);
- else
+ fieldname = dwarf2_name (die, cu);
+ if (fieldname == NULL)
return;
/* Get the mangled name. */
struct attribute *attr;
const char *previous_prefix = processing_current_prefix;
struct cleanup *back_to = NULL;
+ char *name;
if (die->type)
return;
type = alloc_type (objfile);
INIT_CPLUS_SPECIFIC (type);
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
+ name = dwarf2_name (die, cu);
+ if (name != NULL)
{
if (cu->language == language_cplus
|| cu->language == language_java)
{
/* The name is already allocated along with this objfile, so
we don't need to duplicate it for the type. */
- TYPE_TAG_NAME (type) = DW_STRING (attr);
+ TYPE_TAG_NAME (type) = name;
}
}
struct objfile *objfile = cu->objfile;
struct type *type;
struct attribute *attr;
+ char *name;
if (die->type)
return;
type = alloc_type (objfile);
TYPE_CODE (type) = TYPE_CODE_ENUM;
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
+ name = dwarf2_name (die, cu);
+ if (name != NULL)
{
- char *name = DW_STRING (attr);
-
if (processing_has_namespace_info)
{
TYPE_TAG_NAME (type) = typename_concat (&objfile->objfile_obstack,
struct objfile *objfile = cu->objfile;
struct die_info *child_die;
struct field *fields;
- struct attribute *attr;
struct symbol *sym;
int num_fields;
int unsigned_enum = 1;
+ char *name;
num_fields = 0;
fields = NULL;
}
else
{
- attr = dwarf2_attr (child_die, DW_AT_name, cu);
- if (attr)
+ name = dwarf2_name (child_die, cu);
+ if (name)
{
sym = new_symbol (child_die, die->type, cu);
if (SYMBOL_VALUE (sym) < 0)
struct attribute *attr;
int ndim = 0;
struct cleanup *back_to;
+ char *name;
/* Return if we've already decoded this type. */
if (die->type)
if (attr)
make_vector_type (type);
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- TYPE_NAME (type) = DW_STRING (attr);
+ name = dwarf2_name (die, cu);
+ if (name)
+ TYPE_NAME (type) = name;
do_cleanups (back_to);
if (!die->type)
{
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- {
- name = DW_STRING (attr);
- }
+ name = dwarf2_name (die, cu);
set_die_type (die, init_type (TYPE_CODE_TYPEDEF, 0,
TYPE_FLAG_TARGET_STUB, name, objfile),
cu);
struct type *type;
struct attribute *attr;
int encoding = 0, size = 0;
+ char *name;
/* If we've already decoded this die, this is a no-op. */
if (die->type)
{
size = DW_UNSND (attr);
}
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
+ name = dwarf2_name (die, cu);
+ if (name)
{
enum type_code code = TYPE_CODE_INT;
int type_flags = 0;
case DW_ATE_complex_float:
code = TYPE_CODE_COMPLEX;
break;
+ case DW_ATE_decimal_float:
+ code = TYPE_CODE_DECFLOAT;
+ break;
case DW_ATE_float:
code = TYPE_CODE_FLT;
break;
dwarf_type_encoding_name (encoding));
break;
}
- type = init_type (code, size, type_flags, DW_STRING (attr), objfile);
+ type = init_type (code, size, type_flags, name, objfile);
if (encoding == DW_ATE_address)
TYPE_TARGET_TYPE (type) = dwarf2_fundamental_type (objfile, FT_VOID,
cu);
struct attribute *attr;
int low = 0;
int high = -1;
+ char *name;
/* If we have already decoded this die, then nothing more to do. */
if (die->type)
range_type = create_range_type (NULL, base_type, low, high);
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- TYPE_NAME (range_type) = DW_STRING (attr);
+ name = dwarf2_name (die, cu);
+ if (name)
+ TYPE_NAME (range_type) = name;
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct type *type;
- struct attribute *attr;
if (die->type)
return;
/* For now, we only support the C meaning of an unspecified type: void. */
- attr = dwarf2_attr (die, DW_AT_name, cu);
- type = init_type (TYPE_CODE_VOID, 0, 0, attr ? DW_STRING (attr) : "",
+ type = init_type (TYPE_CODE_VOID, 0, 0, dwarf2_name (die, cu),
cu->objfile);
set_die_type (die, type, cu);
type = dwarf2_fundamental_type (objfile, FT_FLOAT, cu);
}
return type;
+ case DW_ATE_decimal_float:
+ if (size == 16)
+ type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_DECFLOAT, cu);
+ else if (size == 8)
+ type = dwarf2_fundamental_type (objfile, FT_EXT_PREC_DECFLOAT, cu);
+ else
+ type = dwarf2_fundamental_type (objfile, FT_DECFLOAT, cu);
+ return type;
case DW_ATE_signed:
switch (size)
{
}
}
+/* Release all extra memory associated with OBJFILE. */
+
+void
+dwarf2_free_objfile (struct objfile *objfile)
+{
+ dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
+
+ if (dwarf2_per_objfile == NULL)
+ return;
+
+ /* Cached DIE trees use xmalloc and the comp_unit_obstack. */
+ free_cached_comp_units (NULL);
+
+ /* Everything else should be on the objfile obstack. */
+}
+
/* A pair of DIE offset and GDB type pointer. We store these
in a hash table separate from the DIEs, and preserve them
when the DIEs are flushed out of cache. */