bool symbol_name_slot_invalid (offset_type idx) const override
{
const auto &bucket = this->symbol_table[idx];
- return bucket.name == 0 && bucket.vec;
+ return bucket.name == 0 && bucket.vec == 0;
}
/* Convenience method to get at the name of the symbol at IDX in the
struct dwarf2_cu *cu;
/* A partial_die_info. */
struct partial_die_info *pdi;
+
+ cu_partial_die_info (struct dwarf2_cu *cu, struct partial_die_info *pdi)
+ : cu (cu),
+ pdi (pdi)
+ { /* Nothhing. */ }
+
+private:
+ cu_partial_die_info () = delete;
};
-static struct cu_partial_die_info find_partial_die (sect_offset, int,
- struct dwarf2_cu *);
+static const struct cu_partial_die_info find_partial_die (sect_offset, int,
+ struct dwarf2_cu *);
static const gdb_byte *read_attribute (const struct die_reader_specs *,
struct attribute *, struct attr_abbrev *,
{
const char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
- struct cu_partial_die_info res;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
then this means the parent of the specification DIE. */
real_pdi = pdi;
while (real_pdi->has_specification)
{
- res = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ auto res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
real_pdi = res.pdi;
cu = res.cu;
}
/* FIXME drow/2004-04-01: What should we be doing with
function-local names? For partial symbols, we should probably be
ignoring them. */
- complaint (_("unhandled containing DIE tag %d for DIE at %s"),
- parent->tag, sect_offset_str (pdi->sect_off));
+ complaint (_("unhandled containing DIE tag %s for DIE at %s"),
+ dwarf_tag_name (parent->tag),
+ sect_offset_str (pdi->sect_off));
parent->scope = grandparent_scope;
}
0, cu->language, objfile);
break;
case DW_TAG_module:
- add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name != NULL,
- MODULE_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::GLOBAL,
- 0, cu->language, objfile);
+ /* With Fortran 77 there might be a "BLOCK DATA" module
+ available without any name. If so, we skip the module as it
+ doesn't bring any value. */
+ if (actual_name != nullptr)
+ add_psymbol_to_list (actual_name, strlen (actual_name),
+ built_actual_name != NULL,
+ MODULE_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::GLOBAL,
+ 0, cu->language, objfile);
break;
case DW_TAG_class_type:
case DW_TAG_interface_type:
newobj->name = new_symbol (die, read_type_die (die, cu), cu,
(struct symbol *) templ_func);
+ if (dwarf2_flag_true_p (die, DW_AT_main_subprogram, cu))
+ set_objfile_main_name (objfile, SYMBOL_LINKAGE_NAME (newobj->name),
+ cu->language);
+
/* If there is a location expression for DW_AT_frame_base, record
it. */
attr = dwarf2_attr (die, DW_AT_frame_base, cu);
struct type *type;
module_name = dwarf2_name (die, cu);
- if (!module_name)
- complaint (_("DW_TAG_module has no name, offset %s"),
- sect_offset_str (die->sect_off));
type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
return set_die_type (die, type, cu);
outside their CU (they do however referencing other types via
DW_FORM_ref_sig8). */
-static struct cu_partial_die_info
+static const struct cu_partial_die_info
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
{
struct dwarf2_per_objfile *dwarf2_per_objfile
struct partial_die_info *real_pdi;
struct partial_die_info *child_pdi;
- struct cu_partial_die_info res;
/* If this DIE (this DIE's specification, if any) has a parent, then
we should not do this. We'll prepend the parent's fully qualified
real_pdi = struct_pdi;
while (real_pdi->has_specification)
{
- res = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ auto res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
real_pdi = res.pdi;
cu = res.cu;
}
if (name == NULL && has_specification)
{
struct partial_die_info *spec_die;
- struct cu_partial_die_info res;
- res = find_partial_die (spec_offset, spec_is_dwz, cu);
+ auto res = find_partial_die (spec_offset, spec_is_dwz, cu);
spec_die = res.pdi;
cu = res.cu;
return follow_die_ref (die, attr, ext_cu);
}
+/* A convenience function that returns an "unknown" DWARF name,
+ including the value of V. STR is the name of the entity being
+ printed, e.g., "TAG". */
+
+static const char *
+dwarf_unknown (const char *str, unsigned v)
+{
+ char *cell = get_print_cell ();
+ xsnprintf (cell, PRINT_CELL_SIZE, "DW_%s_<unknown: %u>", str, v);
+ return cell;
+}
+
/* Convert a DIE tag into its string name. */
static const char *
const char *name = get_DW_TAG_name (tag);
if (name == NULL)
- return "DW_TAG_<unknown>";
+ return dwarf_unknown ("TAG", tag);
return name;
}
name = get_DW_AT_name (attr);
if (name == NULL)
- return "DW_AT_<unknown>";
+ return dwarf_unknown ("AT", attr);
return name;
}
const char *name = get_DW_FORM_name (form);
if (name == NULL)
- return "DW_FORM_<unknown>";
+ return dwarf_unknown ("FORM", form);
return name;
}
const char *name = get_DW_ATE_name (enc);
if (name == NULL)
- return "DW_ATE_<unknown>";
+ return dwarf_unknown ("ATE", enc);
return name;
}
is_define ? _("definition") : _("undefinition"),
line == 0 ? _("zero") : _("non-zero"), line, body);
- if (is_define)
+ if (body == NULL)
{
- if (body != NULL)
- parse_macro_definition (current_file, line, body);
- else
- {
- /* Fedora's rpm-build's "debugedit" binary
- corrupted .debug_macro sections.
-
- For more info, see
- https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
- complaint (_("debug info gives %s invalid macro definition "
- "without body (corrupted?) at line %d"
- "on file %s"),
- at_commandline ? _("command-line")
- : _("in-file"),
- line, current_file->filename);
- }
+ /* Fedora's rpm-build's "debugedit" binary
+ corrupted .debug_macro sections.
+
+ For more info, see
+ https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
+ complaint (_("debug info gives %s invalid macro %s "
+ "without body (corrupted?) at line %d "
+ "on file %s"),
+ at_commandline ? _("command-line") : _("in-file"),
+ is_define ? _("definition") : _("undefinition"),
+ line, current_file->filename);
}
+ else if (is_define)
+ parse_macro_definition (current_file, line, body);
else
{
gdb_assert (macinfo_type == DW_MACRO_undef