unsigned int checked_producer : 1;
unsigned int producer_is_gxx_lt_4_6 : 1;
unsigned int producer_is_gcc_lt_4_3 : 1;
+ bool producer_is_icc : 1;
unsigned int producer_is_icc_lt_14 : 1;
bool producer_is_codewarrior : 1;
included by PER_CU. */
static void
-recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result,
+recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
htab_t all_children, htab_t all_type_symtabs,
struct dwarf2_per_cu_data *per_cu,
struct compunit_symtab *immediate_parent)
if (*slot == NULL)
{
*slot = cust;
- VEC_safe_push (compunit_symtab_ptr, *result, cust);
+ result->push_back (cust);
if (cust->user == NULL)
cust->user = immediate_parent;
}
}
else
{
- VEC_safe_push (compunit_symtab_ptr, *result, cust);
+ result->push_back (cust);
if (cust->user == NULL)
cust->user = immediate_parent;
}
{
int ix, len;
struct dwarf2_per_cu_data *per_cu_iter;
- struct compunit_symtab *compunit_symtab_iter;
- VEC (compunit_symtab_ptr) *result_symtabs = NULL;
+ std::vector<compunit_symtab *> result_symtabs;
htab_t all_children, all_type_symtabs;
struct compunit_symtab *cust = get_compunit_symtab (per_cu);
}
/* Now we have a transitive closure of all the included symtabs. */
- len = VEC_length (compunit_symtab_ptr, result_symtabs);
+ len = result_symtabs.size ();
cust->includes
= XOBNEWVEC (&per_cu->dwarf2_per_objfile->objfile->objfile_obstack,
struct compunit_symtab *, len + 1);
- for (ix = 0;
- VEC_iterate (compunit_symtab_ptr, result_symtabs, ix,
- compunit_symtab_iter);
- ++ix)
- cust->includes[ix] = compunit_symtab_iter;
+ memcpy (cust->includes, result_symtabs.data (),
+ len * sizeof (compunit_symtab *));
cust->includes[len] = NULL;
- VEC_free (compunit_symtab_ptr, result_symtabs);
htab_delete (all_children);
htab_delete (all_type_symtabs);
}
return cu->producer_is_icc_lt_14;
}
+/* ICC generates a DW_AT_type for C void functions. This was observed on
+ ICC 14.0.5.212, and appears to be against the DWARF spec (V5 3.3.2)
+ which says that void functions should not have a DW_AT_type. */
+
+static bool
+producer_is_icc (struct dwarf2_cu *cu)
+{
+ if (!cu->checked_producer)
+ check_producer (cu);
+
+ return cu->producer_is_icc;
+}
+
/* Check for possibly missing DW_AT_comp_dir with relative .debug_line
directory paths. GCC SVN r127613 (new option -fdebug-prefix-map) fixed
this, it was first present in GCC release 4.3.0. */
{
const gdb_byte *ids_ptr = htab->unit_table + sizeof (uint32_t) * nr_slots;
int *ids = htab->section_pool.v2.section_ids;
+ size_t sizeof_ids = sizeof (htab->section_pool.v2.section_ids);
/* Reverse map for error checking. */
int ids_seen[DW_SECT_MAX + 1];
int i;
" in section table [in module %s]"),
dwp_file->name);
}
- memset (ids, 255, (DW_SECT_MAX + 1) * sizeof (int32_t));
- memset (ids_seen, 255, (DW_SECT_MAX + 1) * sizeof (int32_t));
+ memset (ids, 255, sizeof_ids);
+ memset (ids_seen, 255, sizeof (ids_seen));
for (i = 0; i < nr_columns; ++i)
{
int id = read_4_bytes (dbfd, ids_ptr + i * sizeof (uint32_t));
cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
}
else if (producer_is_icc (cu->producer, &major, &minor))
- cu->producer_is_icc_lt_14 = major < 14;
+ {
+ cu->producer_is_icc = true;
+ cu->producer_is_icc_lt_14 = major < 14;
+ }
else if (startswith (cu->producer, "CodeWarrior S12/L-ISA"))
cu->producer_is_codewarrior = true;
else
return type;
}
+/* Allocate an integer type of size BITS and name NAME. */
+
+static struct type *
+dwarf2_init_integer_type (struct dwarf2_cu *cu, struct objfile *objfile,
+ int bits, int unsigned_p, const char *name)
+{
+ struct type *type;
+
+ /* Versions of Intel's C Compiler generate an integer type called "void"
+ instead of using DW_TAG_unspecified_type. This has been seen on
+ at least versions 14, 17, and 18. */
+ if (bits == 0 && producer_is_icc (cu) && strcmp (name, "void") == 0)
+ type = objfile_type (objfile)->builtin_void;
+ else
+ type = init_integer_type (objfile, bits, unsigned_p, name);
+
+ return type;
+}
+
/* Find a representation of a given base type and install
it in the TYPE field of the die. */
type = dwarf2_init_float_type (objfile, bits, name, name);
break;
case DW_ATE_signed:
- type = init_integer_type (objfile, bits, 0, name);
+ type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
break;
case DW_ATE_unsigned:
if (cu->language == language_fortran
&& startswith (name, "character("))
type = init_character_type (objfile, bits, 1, name);
else
- type = init_integer_type (objfile, bits, 1, name);
+ type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
break;
case DW_ATE_signed_char:
if (cu->language == language_ada || cu->language == language_m2
|| cu->language == language_fortran)
type = init_character_type (objfile, bits, 0, name);
else
- type = init_integer_type (objfile, bits, 0, name);
+ type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
break;
case DW_ATE_unsigned_char:
if (cu->language == language_ada || cu->language == language_m2
|| cu->language == language_rust)
type = init_character_type (objfile, bits, 1, name);
else
- type = init_integer_type (objfile, bits, 1, name);
+ type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
break;
case DW_ATE_UTF:
{
{
complaint (_("unsupported DW_ATE_UTF bit size: '%d'"),
bits);
- type = init_integer_type (objfile, bits, 1, name);
+ type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
}
return set_die_type (die, type, cu);
}
checked_producer (0),
producer_is_gxx_lt_4_6 (0),
producer_is_gcc_lt_4_3 (0),
+ producer_is_icc (false),
producer_is_icc_lt_14 (0),
producer_is_codewarrior (false),
processing_has_namespace_info (0)