static struct symbol *new_symbol_full (struct die_info *, struct type *,
struct dwarf2_cu *, struct symbol *);
-static void dwarf2_const_value (struct attribute *, struct symbol *,
+static void dwarf2_const_value (const struct attribute *, struct symbol *,
struct dwarf2_cu *);
-static void dwarf2_const_value_attr (struct attribute *attr,
+static void dwarf2_const_value_attr (const struct attribute *attr,
struct type *type,
const char *name,
struct obstack *obstack,
static struct type *die_containing_type (struct die_info *,
struct dwarf2_cu *);
-static struct type *lookup_die_type (struct die_info *, struct attribute *,
+static struct type *lookup_die_type (struct die_info *, const struct attribute *,
struct dwarf2_cu *);
static struct type *read_type_die (struct die_info *, struct dwarf2_cu *);
static void store_in_ref_table (struct die_info *,
struct dwarf2_cu *);
-static int is_ref_attr (struct attribute *);
+static sect_offset dwarf2_get_ref_die_offset (const struct attribute *);
-static sect_offset dwarf2_get_ref_die_offset (struct attribute *);
-
-static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int);
+static LONGEST dwarf2_get_attr_constant_value (const struct attribute *, int);
static struct die_info *follow_die_ref_or_sig (struct die_info *,
- struct attribute *,
+ const struct attribute *,
struct dwarf2_cu **);
static struct die_info *follow_die_ref (struct die_info *,
- struct attribute *,
+ const struct attribute *,
struct dwarf2_cu **);
static struct die_info *follow_die_sig (struct die_info *,
- struct attribute *,
+ const struct attribute *,
struct dwarf2_cu **);
static struct type *get_signatured_type (struct die_info *, ULONGEST,
struct dwarf2_cu *);
static struct type *get_DW_AT_signature_type (struct die_info *,
- struct attribute *,
+ const struct attribute *,
struct dwarf2_cu *);
static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu);
static void read_signatured_type (struct signatured_type *);
static struct type_unit_group *get_type_unit_group
- (struct dwarf2_cu *, struct attribute *);
+ (struct dwarf2_cu *, const struct attribute *);
static void build_type_unit_groups (die_reader_func_ftype *, void *);
static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int,
const char *, int);
-static int attr_form_is_block (struct attribute *);
+static int attr_form_is_block (const struct attribute *);
+
+static int attr_form_is_section_offset (const struct attribute *);
-static int attr_form_is_section_offset (struct attribute *);
+static int attr_form_is_constant (const struct attribute *);
-static int attr_form_is_constant (struct attribute *);
+static int attr_form_is_ref (const struct attribute *);
static void fill_in_loclist_baton (struct dwarf2_cu *cu,
struct dwarf2_loclist_baton *baton,
- struct attribute *attr);
+ const struct attribute *attr);
-static void dwarf2_symbol_mark_computed (struct attribute *attr,
+static void dwarf2_symbol_mark_computed (const struct attribute *attr,
struct symbol *sym,
struct dwarf2_cu *cu,
int is_block);
STMT_LIST is a DW_AT_stmt_list attribute. */
static struct type_unit_group *
-get_type_unit_group (struct dwarf2_cu *cu, struct attribute *stmt_list)
+get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
{
struct tu_stats *tu_stats = &dwarf2_per_objfile->tu_stats;
struct type_unit_group *tu_group;
: (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
{
struct dwarf2_per_cu_data *per_cu = item->per_cu;
+ char buf[100];
- if (dwarf2_read_debug)
+ if (per_cu->is_debug_types)
{
- fprintf_unfiltered (gdb_stdlog,
- "Expanding symtab of %s at offset 0x%x\n",
- per_cu->is_debug_types ? "TU" : "CU",
- per_cu->offset.sect_off);
+ struct signatured_type *sig_type =
+ (struct signatured_type *) per_cu;
+
+ sprintf (buf, "TU %s at offset 0x%x",
+ hex_string (sig_type->signature), per_cu->offset.sect_off);
}
+ else
+ sprintf (buf, "CU at offset 0x%x", per_cu->offset.sect_off);
+
+ if (dwarf2_read_debug)
+ fprintf_unfiltered (gdb_stdlog, "Expanding symtab of %s\n", buf);
if (per_cu->is_debug_types)
process_full_type_unit (per_cu, item->pretend_language);
process_full_comp_unit (per_cu, item->pretend_language);
if (dwarf2_read_debug)
- {
- fprintf_unfiltered (gdb_stdlog,
- "Done expanding %s at offset 0x%x\n",
- per_cu->is_debug_types ? "TU" : "CU",
- per_cu->offset.sect_off);
- }
+ fprintf_unfiltered (gdb_stdlog, "Done expanding %s\n", buf);
}
item->per_cu->queued = 0;
kind, dwo_name, hex_string (signature));
}
- complaint (&symfile_complaints,
- _("Could not find DWO %s %s(%s) referenced by %s at offset 0x%x"
- " [in module %s]"),
- kind, dwo_name, hex_string (signature),
- this_unit->is_debug_types ? "TU" : "CU",
- this_unit->offset.sect_off, objfile->name);
+ /* This is a warning and not a complaint because it can be caused by
+ pilot error (e.g., user accidentally deleting the DWO). */
+ warning (_("Could not find DWO %s %s(%s) referenced by %s at offset 0x%x"
+ " [in module %s]"),
+ kind, dwo_name, hex_string (signature),
+ this_unit->is_debug_types ? "TU" : "CU",
+ this_unit->offset.sect_off, objfile->name);
return NULL;
}
SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton);
}
- else if (is_ref_attr (attr))
+ else if (attr_form_is_ref (attr))
{
struct dwarf2_cu *target_cu = cu;
struct die_info *target_die;
loc = dwarf2_attr (child_die, DW_AT_location, cu);
origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
- if (loc == NULL && origin != NULL && is_ref_attr (origin))
+ if (loc == NULL && origin != NULL && attr_form_is_ref (origin))
{
sect_offset offset;
attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
if (attr)
{
- if (attr_form_is_block (attr) || is_ref_attr (attr))
+ if (attr_form_is_block (attr) || attr_form_is_ref (attr))
{
/* GCC encodes arrays with unspecified or dynamic length
with a DW_FORM_block1 attribute or a reference attribute.
}
/* Super hack. */
- if (cu->per_cu->is_dwz && is_ref_attr (attr))
+ if (cu->per_cu->is_dwz && attr_form_is_ref (attr))
attr->form = DW_FORM_GNU_ref_alt;
/* We have seen instances where the compiler tried to emit a byte
if (line_ptr + lh->total_length > (section->buffer + section->size))
{
dwarf2_statement_list_fits_in_line_number_section_complaint ();
+ do_cleanups (back_to);
return 0;
}
lh->statement_program_end = line_ptr + lh->total_length;
because that is the interpretation long in use by GCC. */
static gdb_byte *
-dwarf2_const_value_data (struct attribute *attr, struct obstack *obstack,
+dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
struct dwarf2_cu *cu, LONGEST *value, int bits)
{
struct objfile *objfile = cu->objfile;
expression. */
static void
-dwarf2_const_value_attr (struct attribute *attr, struct type *type,
+dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
const char *name, struct obstack *obstack,
struct dwarf2_cu *cu,
LONGEST *value, const gdb_byte **bytes,
/* Copy constant value from an attribute to a symbol. */
static void
-dwarf2_const_value (struct attribute *attr, struct symbol *sym,
+dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
If there is no type substitute an error marker. */
static struct type *
-lookup_die_type (struct die_info *die, struct attribute *attr,
+lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile);
this_type = get_die_type_at_offset (offset, per_cu);
}
- else if (is_ref_attr (attr))
+ else if (attr_form_is_ref (attr))
{
sect_offset offset = dwarf2_get_ref_die_offset (attr);
struct die_info *type_die = NULL;
struct dwarf2_cu *type_cu = cu;
- if (is_ref_attr (attr))
+ if (attr_form_is_ref (attr))
type_die = follow_die_ref (die, attr, &type_cu);
if (type_die == NULL)
return build_error_marker_type (cu, die);
*slot = die;
}
-/* DW_ADDR is always stored already as sect_offset; despite for the forms
- besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */
-
-static int
-is_ref_attr (struct attribute *attr)
-{
- switch (attr->form)
- {
- case DW_FORM_ref_addr:
- case DW_FORM_ref1:
- case DW_FORM_ref2:
- case DW_FORM_ref4:
- case DW_FORM_ref8:
- case DW_FORM_ref_udata:
- case DW_FORM_GNU_ref_alt:
- return 1;
- default:
- return 0;
- }
-}
-
/* Return DIE offset of ATTR. Return 0 with complaint if ATTR is not of the
required kind. */
static sect_offset
-dwarf2_get_ref_die_offset (struct attribute *attr)
+dwarf2_get_ref_die_offset (const struct attribute *attr)
{
sect_offset retval = { DW_UNSND (attr) };
- if (is_ref_attr (attr))
+ if (attr_form_is_ref (attr))
return retval;
retval.sect_off = 0;
* the value held by the attribute is not constant. */
static LONGEST
-dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
+dwarf2_get_attr_constant_value (const struct attribute *attr, int default_value)
{
if (attr->form == DW_FORM_sdata)
return DW_SND (attr);
On exit *REF_CU is the CU of the result. */
static struct die_info *
-follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr,
+follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr,
struct dwarf2_cu **ref_cu)
{
struct die_info *die;
- if (is_ref_attr (attr))
+ if (attr_form_is_ref (attr))
die = follow_die_ref (src_die, attr, ref_cu);
else if (attr->form == DW_FORM_ref_sig8)
die = follow_die_sig (src_die, attr, ref_cu);
On exit *REF_CU is the CU of the result. */
static struct die_info *
-follow_die_ref (struct die_info *src_die, struct attribute *attr,
+follow_die_ref (struct die_info *src_die, const struct attribute *attr,
struct dwarf2_cu **ref_cu)
{
sect_offset offset = dwarf2_get_ref_die_offset (attr);
If the referenced type cannot be found an error is thrown. */
static struct die_info *
-follow_die_sig (struct die_info *src_die, struct attribute *attr,
+follow_die_sig (struct die_info *src_die, const struct attribute *attr,
struct dwarf2_cu **ref_cu)
{
ULONGEST signature = DW_SIGNATURE (attr);
reading in and processing the type unit if necessary. */
static struct type *
-get_DW_AT_signature_type (struct die_info *die, struct attribute *attr,
+get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_cu *cu) /* ARI: editCase function */
{
/* Yes, DW_AT_signature can use a non-ref_sig8 reference. */
- if (is_ref_attr (attr))
+ if (attr_form_is_ref (attr))
{
struct dwarf2_cu *type_cu = cu;
struct die_info *type_die = follow_die_ref (die, attr, &type_cu);
if so return true else false. */
static int
-attr_form_is_block (struct attribute *attr)
+attr_form_is_block (const struct attribute *attr)
{
return (attr == NULL ? 0 :
attr->form == DW_FORM_block1
of them. */
static int
-attr_form_is_section_offset (struct attribute *attr)
+attr_form_is_section_offset (const struct attribute *attr)
{
return (attr->form == DW_FORM_data4
|| attr->form == DW_FORM_data8
taken as section offsets, not constants. */
static int
-attr_form_is_constant (struct attribute *attr)
+attr_form_is_constant (const struct attribute *attr)
{
switch (attr->form)
{
}
}
+
+/* DW_ADDR is always stored already as sect_offset; despite for the forms
+ besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */
+
+static int
+attr_form_is_ref (const struct attribute *attr)
+{
+ switch (attr->form)
+ {
+ case DW_FORM_ref_addr:
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
+ case DW_FORM_GNU_ref_alt:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
/* Return the .debug_loc section to use for CU.
For DWO files use .debug_loc.dwo. */
static void
fill_in_loclist_baton (struct dwarf2_cu *cu,
struct dwarf2_loclist_baton *baton,
- struct attribute *attr)
+ const struct attribute *attr)
{
struct dwarf2_section_info *section = cu_debug_loc_section (cu);
}
static void
-dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu, int is_block)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct dwarf2_per_objfile *data = d;
int ix;
+ /* Make sure we don't accidentally use dwarf2_per_objfile while
+ cleaning up. */
+ dwarf2_per_objfile = NULL;
+
for (ix = 0; ix < data->n_comp_units; ++ix)
VEC_free (dwarf2_per_cu_ptr, data->all_comp_units[ix]->imported_symtabs);