|
|
@ -407,9 +407,6 @@ struct dwarf2_cu
|
|
|
|
after all type information has been read. */
|
|
|
|
after all type information has been read. */
|
|
|
|
VEC (delayed_method_info) *method_list;
|
|
|
|
VEC (delayed_method_info) *method_list;
|
|
|
|
|
|
|
|
|
|
|
|
/* To be copied to symtab->call_site_htab. */
|
|
|
|
|
|
|
|
htab_t call_site_htab;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Mark used when releasing cached dies. */
|
|
|
|
/* Mark used when releasing cached dies. */
|
|
|
|
unsigned int mark : 1;
|
|
|
|
unsigned int mark : 1;
|
|
|
|
|
|
|
|
|
|
|
@ -1082,8 +1079,6 @@ static void read_func_scope (struct die_info *, struct dwarf2_cu *);
|
|
|
|
|
|
|
|
|
|
|
|
static void read_lexical_block_scope (struct die_info *, struct dwarf2_cu *);
|
|
|
|
static void read_lexical_block_scope (struct die_info *, struct dwarf2_cu *);
|
|
|
|
|
|
|
|
|
|
|
|
static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
|
|
|
|
static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
|
|
|
|
struct dwarf2_cu *, struct partial_symtab *);
|
|
|
|
struct dwarf2_cu *, struct partial_symtab *);
|
|
|
|
|
|
|
|
|
|
|
@ -2655,21 +2650,7 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name)
|
|
|
|
|
|
|
|
|
|
|
|
/* index_table is NULL if OBJF_READNOW. */
|
|
|
|
/* index_table is NULL if OBJF_READNOW. */
|
|
|
|
if (!dwarf2_per_objfile->index_table)
|
|
|
|
if (!dwarf2_per_objfile->index_table)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
struct symtab *s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALL_OBJFILE_SYMTABS (objfile, s)
|
|
|
|
|
|
|
|
if (s->primary)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct blockvector *bv = BLOCKVECTOR (s);
|
|
|
|
|
|
|
|
const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
|
|
|
|
|
|
|
struct symbol *sym = lookup_block_symbol (block, name, VAR_DOMAIN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sym)
|
|
|
|
|
|
|
|
return sym->symtab->filename;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!find_slot_in_mapped_hash (dwarf2_per_objfile->index_table,
|
|
|
|
if (!find_slot_in_mapped_hash (dwarf2_per_objfile->index_table,
|
|
|
|
name, &vec))
|
|
|
|
name, &vec))
|
|
|
@ -3897,7 +3878,10 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (parent->tag == DW_TAG_namespace
|
|
|
|
if (pdi->tag == DW_TAG_enumerator)
|
|
|
|
|
|
|
|
/* Enumerators should not get the name of the enumeration as a prefix. */
|
|
|
|
|
|
|
|
parent->scope = grandparent_scope;
|
|
|
|
|
|
|
|
else if (parent->tag == DW_TAG_namespace
|
|
|
|
|| parent->tag == DW_TAG_module
|
|
|
|
|| parent->tag == DW_TAG_module
|
|
|
|
|| parent->tag == DW_TAG_structure_type
|
|
|
|
|| parent->tag == DW_TAG_structure_type
|
|
|
|
|| parent->tag == DW_TAG_class_type
|
|
|
|
|| parent->tag == DW_TAG_class_type
|
|
|
@ -3912,9 +3896,6 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|
|
|
|
grandparent_scope,
|
|
|
|
grandparent_scope,
|
|
|
|
parent->name, 0, cu);
|
|
|
|
parent->name, 0, cu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (parent->tag == DW_TAG_enumerator)
|
|
|
|
|
|
|
|
/* Enumerators should not get the name of the enumeration as a prefix. */
|
|
|
|
|
|
|
|
parent->scope = grandparent_scope;
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* FIXME drow/2004-04-01: What should we be doing with
|
|
|
|
/* FIXME drow/2004-04-01: What should we be doing with
|
|
|
@ -4804,8 +4785,6 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
|
|
|
|
|
|
|
|
if (gcc_4_minor >= 5)
|
|
|
|
if (gcc_4_minor >= 5)
|
|
|
|
symtab->epilogue_unwind_valid = 1;
|
|
|
|
symtab->epilogue_unwind_valid = 1;
|
|
|
|
|
|
|
|
|
|
|
|
symtab->call_site_htab = cu->call_site_htab;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (dwarf2_per_objfile->using_index)
|
|
|
|
if (dwarf2_per_objfile->using_index)
|
|
|
@ -4844,9 +4823,6 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
case DW_TAG_catch_block:
|
|
|
|
case DW_TAG_catch_block:
|
|
|
|
read_lexical_block_scope (die, cu);
|
|
|
|
read_lexical_block_scope (die, cu);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DW_TAG_GNU_call_site:
|
|
|
|
|
|
|
|
read_call_site_scope (die, cu);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DW_TAG_class_type:
|
|
|
|
case DW_TAG_class_type:
|
|
|
|
case DW_TAG_interface_type:
|
|
|
|
case DW_TAG_interface_type:
|
|
|
|
case DW_TAG_structure_type:
|
|
|
|
case DW_TAG_structure_type:
|
|
|
@ -6141,258 +6117,6 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
using_directives = new->using_directives;
|
|
|
|
using_directives = new->using_directives;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Read in DW_TAG_GNU_call_site and insert it to CU->call_site_htab. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
|
|
read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct objfile *objfile = cu->objfile;
|
|
|
|
|
|
|
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
|
|
|
|
|
|
|
CORE_ADDR pc, baseaddr;
|
|
|
|
|
|
|
|
struct attribute *attr;
|
|
|
|
|
|
|
|
struct call_site *call_site, call_site_local;
|
|
|
|
|
|
|
|
void **slot;
|
|
|
|
|
|
|
|
int nparams;
|
|
|
|
|
|
|
|
struct die_info *child_die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_low_pc, cu);
|
|
|
|
|
|
|
|
if (!attr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("missing DW_AT_low_pc for DW_TAG_GNU_call_site "
|
|
|
|
|
|
|
|
"DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = DW_ADDR (attr) + baseaddr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cu->call_site_htab == NULL)
|
|
|
|
|
|
|
|
cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq,
|
|
|
|
|
|
|
|
NULL, &objfile->objfile_obstack,
|
|
|
|
|
|
|
|
hashtab_obstack_allocate, NULL);
|
|
|
|
|
|
|
|
call_site_local.pc = pc;
|
|
|
|
|
|
|
|
slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
|
|
|
|
|
|
|
|
if (*slot != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("Duplicate PC %s for DW_TAG_GNU_call_site "
|
|
|
|
|
|
|
|
"DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
paddress (gdbarch, pc), die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Count parameters at the caller. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nparams = 0;
|
|
|
|
|
|
|
|
for (child_die = die->child; child_die && child_die->tag;
|
|
|
|
|
|
|
|
child_die = sibling_die (child_die))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (child_die->tag != DW_TAG_GNU_call_site_parameter)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("Tag %d is not DW_TAG_GNU_call_site_parameter in "
|
|
|
|
|
|
|
|
"DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
child_die->tag, child_die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nparams++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call_site = obstack_alloc (&objfile->objfile_obstack,
|
|
|
|
|
|
|
|
(sizeof (*call_site)
|
|
|
|
|
|
|
|
+ (sizeof (*call_site->parameter)
|
|
|
|
|
|
|
|
* (nparams - 1))));
|
|
|
|
|
|
|
|
*slot = call_site;
|
|
|
|
|
|
|
|
memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
|
|
|
|
|
|
|
|
call_site->pc = pc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct die_info *func_die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Skip also over DW_TAG_inlined_subroutine. */
|
|
|
|
|
|
|
|
for (func_die = die->parent;
|
|
|
|
|
|
|
|
func_die && func_die->tag != DW_TAG_subprogram
|
|
|
|
|
|
|
|
&& func_die->tag != DW_TAG_subroutine_type;
|
|
|
|
|
|
|
|
func_die = func_die->parent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* DW_AT_GNU_all_call_sites is a superset
|
|
|
|
|
|
|
|
of DW_AT_GNU_all_tail_call_sites. */
|
|
|
|
|
|
|
|
if (func_die
|
|
|
|
|
|
|
|
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
|
|
|
|
|
|
|
|
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_tail_call_sites, cu))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* TYPE_TAIL_CALL_LIST is not interesting in functions where it is
|
|
|
|
|
|
|
|
not complete. But keep CALL_SITE for look ups via call_site_htab,
|
|
|
|
|
|
|
|
both the initial caller containing the real return address PC and
|
|
|
|
|
|
|
|
the final callee containing the current PC of a chain of tail
|
|
|
|
|
|
|
|
calls do not need to have the tail call list complete. But any
|
|
|
|
|
|
|
|
function candidate for a virtual tail call frame searched via
|
|
|
|
|
|
|
|
TYPE_TAIL_CALL_LIST must have the tail call list complete to be
|
|
|
|
|
|
|
|
determined unambiguously. */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct type *func_type = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (func_die)
|
|
|
|
|
|
|
|
func_type = get_die_type (func_die, cu);
|
|
|
|
|
|
|
|
if (func_type != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Enlist this call site to the function. */
|
|
|
|
|
|
|
|
call_site->tail_call_next = TYPE_TAIL_CALL_LIST (func_type);
|
|
|
|
|
|
|
|
TYPE_TAIL_CALL_LIST (func_type) = call_site;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("Cannot find function owning DW_TAG_GNU_call_site "
|
|
|
|
|
|
|
|
"DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
|
|
|
|
|
|
|
|
if (attr == NULL)
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
|
|
|
|
|
|
|
|
SET_FIELD_DWARF_BLOCK (call_site->target, NULL);
|
|
|
|
|
|
|
|
if (!attr || (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0))
|
|
|
|
|
|
|
|
/* Keep NULL DWARF_BLOCK. */;
|
|
|
|
|
|
|
|
else if (attr_form_is_block (attr))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct dwarf2_locexpr_baton *dlbaton;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlbaton = obstack_alloc (&objfile->objfile_obstack, sizeof (*dlbaton));
|
|
|
|
|
|
|
|
dlbaton->data = DW_BLOCK (attr)->data;
|
|
|
|
|
|
|
|
dlbaton->size = DW_BLOCK (attr)->size;
|
|
|
|
|
|
|
|
dlbaton->per_cu = cu->per_cu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (is_ref_attr (attr))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct objfile *objfile = cu->objfile;
|
|
|
|
|
|
|
|
struct dwarf2_cu *target_cu = cu;
|
|
|
|
|
|
|
|
struct die_info *target_die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_die = follow_die_ref_or_sig (die, attr, &target_cu);
|
|
|
|
|
|
|
|
gdb_assert (target_cu->objfile == objfile);
|
|
|
|
|
|
|
|
if (die_is_declaration (target_die, target_cu))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const char *target_physname;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_physname = dwarf2_physname (NULL, target_die, target_cu);
|
|
|
|
|
|
|
|
if (target_physname == NULL)
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("DW_AT_GNU_call_site_target target DIE has invalid "
|
|
|
|
|
|
|
|
"physname, for referencing DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
SET_FIELD_PHYSNAME (call_site->target, (char *) target_physname);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CORE_ADDR lowpc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* DW_AT_entry_pc should be preferred. */
|
|
|
|
|
|
|
|
if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("DW_AT_GNU_call_site_target target DIE has invalid "
|
|
|
|
|
|
|
|
"low pc, for referencing DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
SET_FIELD_PHYSADDR (call_site->target, lowpc + baseaddr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("DW_TAG_GNU_call_site DW_AT_GNU_call_site_target is neither "
|
|
|
|
|
|
|
|
"block nor reference, for DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call_site->per_cu = cu->per_cu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (child_die = die->child;
|
|
|
|
|
|
|
|
child_die && child_die->tag;
|
|
|
|
|
|
|
|
child_die = sibling_die (child_die))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct dwarf2_locexpr_baton *dlbaton;
|
|
|
|
|
|
|
|
struct call_site_parameter *parameter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (child_die->tag != DW_TAG_GNU_call_site_parameter)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Already printed the complaint above. */
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdb_assert (call_site->parameter_count < nparams);
|
|
|
|
|
|
|
|
parameter = &call_site->parameter[call_site->parameter_count];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* DW_AT_location specifies the register number. Value of the data
|
|
|
|
|
|
|
|
assumed for the register is contained in DW_AT_GNU_call_site_value. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (child_die, DW_AT_location, cu);
|
|
|
|
|
|
|
|
if (!attr || !attr_form_is_block (attr))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("No DW_FORM_block* DW_AT_location for "
|
|
|
|
|
|
|
|
"DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
child_die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
parameter->dwarf_reg = dwarf_block_to_dwarf_reg (DW_BLOCK (attr)->data,
|
|
|
|
|
|
|
|
&DW_BLOCK (attr)->data[DW_BLOCK (attr)->size]);
|
|
|
|
|
|
|
|
if (parameter->dwarf_reg == -1
|
|
|
|
|
|
|
|
&& !dwarf_block_to_sp_offset (gdbarch, DW_BLOCK (attr)->data,
|
|
|
|
|
|
|
|
&DW_BLOCK (attr)->data[DW_BLOCK (attr)->size],
|
|
|
|
|
|
|
|
¶meter->fb_offset))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("Only single DW_OP_reg or DW_OP_fbreg is supported "
|
|
|
|
|
|
|
|
"for DW_FORM_block* DW_AT_location for "
|
|
|
|
|
|
|
|
"DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
child_die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
|
|
|
|
|
|
|
|
if (!attr_form_is_block (attr))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("No DW_FORM_block* DW_AT_GNU_call_site_value for "
|
|
|
|
|
|
|
|
"DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
child_die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
parameter->value = DW_BLOCK (attr)->data;
|
|
|
|
|
|
|
|
parameter->value_size = DW_BLOCK (attr)->size;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parameters are not pre-cleared by memset above. */
|
|
|
|
|
|
|
|
parameter->data_value = NULL;
|
|
|
|
|
|
|
|
parameter->data_value_size = 0;
|
|
|
|
|
|
|
|
call_site->parameter_count++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
|
|
|
|
|
|
|
|
if (attr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!attr_form_is_block (attr))
|
|
|
|
|
|
|
|
complaint (&symfile_complaints,
|
|
|
|
|
|
|
|
_("No DW_FORM_block* DW_AT_GNU_call_site_data_value for "
|
|
|
|
|
|
|
|
"DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
|
|
|
|
|
|
|
|
child_die->offset, cu->objfile->name);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
parameter->data_value = DW_BLOCK (attr)->data;
|
|
|
|
|
|
|
|
parameter->data_value_size = DW_BLOCK (attr)->size;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET.
|
|
|
|
/* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET.
|
|
|
|
Return 1 if the attributes are present and valid, otherwise, return 0.
|
|
|
|
Return 1 if the attributes are present and valid, otherwise, return 0.
|
|
|
|
If RANGES_PST is not NULL we should setup `objfile->psymtabs_addrmap'. */
|
|
|
|
If RANGES_PST is not NULL we should setup `objfile->psymtabs_addrmap'. */
|
|
|
@ -6592,8 +6316,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
*lowpc = low;
|
|
|
|
*lowpc = low;
|
|
|
|
if (highpc)
|
|
|
|
*highpc = high;
|
|
|
|
*highpc = high;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -10078,10 +9801,9 @@ fixup_partial_die (struct partial_die_info *part_die,
|
|
|
|
/* GCC might emit a nameless struct or union that has a linkage
|
|
|
|
/* GCC might emit a nameless struct or union that has a linkage
|
|
|
|
name. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510. */
|
|
|
|
name. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510. */
|
|
|
|
if (part_die->name == NULL
|
|
|
|
if (part_die->name == NULL
|
|
|
|
&& (part_die->tag == DW_TAG_class_type
|
|
|
|
&& (part_die->tag == DW_TAG_structure_type
|
|
|
|
|| part_die->tag == DW_TAG_interface_type
|
|
|
|
|| part_die->tag == DW_TAG_union_type
|
|
|
|
|| part_die->tag == DW_TAG_structure_type
|
|
|
|
|| part_die->tag == DW_TAG_class_type)
|
|
|
|
|| part_die->tag == DW_TAG_union_type)
|
|
|
|
|
|
|
|
&& part_die->linkage_name != NULL)
|
|
|
|
&& part_die->linkage_name != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *demangled;
|
|
|
|
char *demangled;
|
|
|
@ -10089,17 +9811,7 @@ fixup_partial_die (struct partial_die_info *part_die,
|
|
|
|
demangled = cplus_demangle (part_die->linkage_name, DMGL_TYPES);
|
|
|
|
demangled = cplus_demangle (part_die->linkage_name, DMGL_TYPES);
|
|
|
|
if (demangled)
|
|
|
|
if (demangled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const char *base;
|
|
|
|
part_die->name = obsavestring (demangled, strlen (demangled),
|
|
|
|
|
|
|
|
|
|
|
|
/* Strip any leading namespaces/classes, keep only the base name.
|
|
|
|
|
|
|
|
DW_AT_name for named DIEs does not contain the prefixes. */
|
|
|
|
|
|
|
|
base = strrchr (demangled, ':');
|
|
|
|
|
|
|
|
if (base && base > demangled && base[-1] == ':')
|
|
|
|
|
|
|
|
base++;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
base = demangled;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
part_die->name = obsavestring (base, strlen (base),
|
|
|
|
|
|
|
|
&cu->objfile->objfile_obstack);
|
|
|
|
&cu->objfile->objfile_obstack);
|
|
|
|
xfree (demangled);
|
|
|
|
xfree (demangled);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -12448,42 +12160,6 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* GCC might emit a nameless typedef that has a linkage name. Determine the
|
|
|
|
|
|
|
|
prefix part in such case. See
|
|
|
|
|
|
|
|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
|
|
|
anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct attribute *attr;
|
|
|
|
|
|
|
|
char *base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (die->tag != DW_TAG_class_type && die->tag != DW_TAG_interface_type
|
|
|
|
|
|
|
|
&& die->tag != DW_TAG_structure_type && die->tag != DW_TAG_union_type)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_name, cu);
|
|
|
|
|
|
|
|
if (attr != NULL && DW_STRING (attr) != NULL)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
|
|
|
|
|
|
|
|
if (attr == NULL)
|
|
|
|
|
|
|
|
attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
|
|
|
|
|
|
|
|
if (attr == NULL || DW_STRING (attr) == NULL)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* dwarf2_name had to be already called. */
|
|
|
|
|
|
|
|
gdb_assert (DW_STRING_IS_CANONICAL (attr));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Strip the base name, keep any leading namespaces/classes. */
|
|
|
|
|
|
|
|
base = strrchr (DW_STRING (attr), ':');
|
|
|
|
|
|
|
|
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return obsavestring (DW_STRING (attr), &base[-1] - DW_STRING (attr),
|
|
|
|
|
|
|
|
&cu->objfile->objfile_obstack);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the name of the namespace/class that DIE is defined within,
|
|
|
|
/* Return the name of the namespace/class that DIE is defined within,
|
|
|
|
or "" if we can't tell. The caller should not xfree the result.
|
|
|
|
or "" if we can't tell. The caller should not xfree the result.
|
|
|
|
|
|
|
|
|
|
|
@ -12505,16 +12181,11 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
struct die_info *parent, *spec_die;
|
|
|
|
struct die_info *parent, *spec_die;
|
|
|
|
struct dwarf2_cu *spec_cu;
|
|
|
|
struct dwarf2_cu *spec_cu;
|
|
|
|
struct type *parent_type;
|
|
|
|
struct type *parent_type;
|
|
|
|
char *retval;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cu->language != language_cplus && cu->language != language_java
|
|
|
|
if (cu->language != language_cplus && cu->language != language_java
|
|
|
|
&& cu->language != language_fortran)
|
|
|
|
&& cu->language != language_fortran)
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
|
|
retval = anonymous_struct_prefix (die, cu);
|
|
|
|
|
|
|
|
if (retval)
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* We have to be careful in the presence of DW_AT_specification.
|
|
|
|
/* We have to be careful in the presence of DW_AT_specification.
|
|
|
|
For example, with GCC 3.4, given the code
|
|
|
|
For example, with GCC 3.4, given the code
|
|
|
|
|
|
|
|
|
|
|
@ -12806,21 +12477,12 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
|
|
|
|
|
|
|
|
|
|
|
|
if (demangled)
|
|
|
|
if (demangled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* FIXME: we already did this for the partial symbol... */
|
|
|
|
/* FIXME: we already did this for the partial symbol... */
|
|
|
|
DW_STRING (attr) = obsavestring (demangled, strlen (demangled),
|
|
|
|
DW_STRING (attr)
|
|
|
|
&cu->objfile->objfile_obstack);
|
|
|
|
= obsavestring (demangled, strlen (demangled),
|
|
|
|
|
|
|
|
&cu->objfile->objfile_obstack);
|
|
|
|
DW_STRING_IS_CANONICAL (attr) = 1;
|
|
|
|
DW_STRING_IS_CANONICAL (attr) = 1;
|
|
|
|
xfree (demangled);
|
|
|
|
xfree (demangled);
|
|
|
|
|
|
|
|
|
|
|
|
/* Strip any leading namespaces/classes, keep only the base name.
|
|
|
|
|
|
|
|
DW_AT_name for named DIEs does not contain the prefixes. */
|
|
|
|
|
|
|
|
base = strrchr (DW_STRING (attr), ':');
|
|
|
|
|
|
|
|
if (base && base > DW_STRING (attr) && base[-1] == ':')
|
|
|
|
|
|
|
|
return &base[1];
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return DW_STRING (attr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -13004,8 +12666,6 @@ dwarf_tag_name (unsigned tag)
|
|
|
|
return "DW_TAG_PGI_kanji_type";
|
|
|
|
return "DW_TAG_PGI_kanji_type";
|
|
|
|
case DW_TAG_PGI_interface_block:
|
|
|
|
case DW_TAG_PGI_interface_block:
|
|
|
|
return "DW_TAG_PGI_interface_block";
|
|
|
|
return "DW_TAG_PGI_interface_block";
|
|
|
|
case DW_TAG_GNU_call_site:
|
|
|
|
|
|
|
|
return "DW_TAG_GNU_call_site";
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return "DW_TAG_<unknown>";
|
|
|
|
return "DW_TAG_<unknown>";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -14488,7 +14148,6 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
|
|
|
|
|
|
|
|
|
|
|
|
ctx->gdbarch = get_objfile_arch (objfile);
|
|
|
|
ctx->gdbarch = get_objfile_arch (objfile);
|
|
|
|
ctx->addr_size = cu->header.addr_size;
|
|
|
|
ctx->addr_size = cu->header.addr_size;
|
|
|
|
ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (cu->per_cu);
|
|
|
|
|
|
|
|
ctx->offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
|
|
|
ctx->offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
|
|
|
ctx->baton = ctx;
|
|
|
|
ctx->baton = ctx;
|
|
|
|
ctx->funcs = &decode_locdesc_ctx_funcs;
|
|
|
|
ctx->funcs = &decode_locdesc_ctx_funcs;
|
|
|
@ -15528,42 +15187,26 @@ dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
return objfile;
|
|
|
|
return objfile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return comp_unit_head for PER_CU, either already available in PER_CU->CU
|
|
|
|
|
|
|
|
(CU_HEADERP is unused in such case) or prepare a temporary copy at
|
|
|
|
|
|
|
|
CU_HEADERP first. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const struct comp_unit_head *
|
|
|
|
|
|
|
|
per_cu_header_read_in (struct comp_unit_head *cu_headerp,
|
|
|
|
|
|
|
|
struct dwarf2_per_cu_data *per_cu)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct objfile *objfile;
|
|
|
|
|
|
|
|
struct dwarf2_per_objfile *per_objfile;
|
|
|
|
|
|
|
|
gdb_byte *info_ptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (per_cu->cu)
|
|
|
|
|
|
|
|
return &per_cu->cu->header;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objfile = per_cu->objfile;
|
|
|
|
|
|
|
|
per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
|
|
|
|
|
|
|
|
info_ptr = per_objfile->info.buffer + per_cu->offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset (cu_headerp, 0, sizeof (*cu_headerp));
|
|
|
|
|
|
|
|
read_comp_unit_head (cu_headerp, info_ptr, objfile->obfd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return cu_headerp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the address size given in the compilation unit header for CU. */
|
|
|
|
/* Return the address size given in the compilation unit header for CU. */
|
|
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
CORE_ADDR
|
|
|
|
dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct comp_unit_head cu_header_local;
|
|
|
|
if (per_cu->cu)
|
|
|
|
const struct comp_unit_head *cu_headerp;
|
|
|
|
return per_cu->cu->header.addr_size;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* If the CU is not currently read in, we re-read its header. */
|
|
|
|
|
|
|
|
struct objfile *objfile = per_cu->objfile;
|
|
|
|
|
|
|
|
struct dwarf2_per_objfile *per_objfile
|
|
|
|
|
|
|
|
= objfile_data (objfile, dwarf2_objfile_data_key);
|
|
|
|
|
|
|
|
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
|
|
|
|
|
|
|
|
struct comp_unit_head cu_header;
|
|
|
|
|
|
|
|
|
|
|
|
cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu);
|
|
|
|
memset (&cu_header, 0, sizeof cu_header);
|
|
|
|
|
|
|
|
read_comp_unit_head (&cu_header, info_ptr, objfile->obfd);
|
|
|
|
return cu_headerp->addr_size;
|
|
|
|
return cu_header.addr_size;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the offset size given in the compilation unit header for CU. */
|
|
|
|
/* Return the offset size given in the compilation unit header for CU. */
|
|
|
@ -15571,28 +15214,21 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
int
|
|
|
|
int
|
|
|
|
dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct comp_unit_head cu_header_local;
|
|
|
|
if (per_cu->cu)
|
|
|
|
const struct comp_unit_head *cu_headerp;
|
|
|
|
return per_cu->cu->header.offset_size;
|
|
|
|
|
|
|
|
|
|
|
|
cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return cu_headerp->offset_size;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* See its dwarf2loc.h declaration. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
|
|
dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *per_cu)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct comp_unit_head cu_header_local;
|
|
|
|
|
|
|
|
const struct comp_unit_head *cu_headerp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cu_headerp->version == 2)
|
|
|
|
|
|
|
|
return cu_headerp->addr_size;
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return cu_headerp->offset_size;
|
|
|
|
{
|
|
|
|
|
|
|
|
/* If the CU is not currently read in, we re-read its header. */
|
|
|
|
|
|
|
|
struct objfile *objfile = per_cu->objfile;
|
|
|
|
|
|
|
|
struct dwarf2_per_objfile *per_objfile
|
|
|
|
|
|
|
|
= objfile_data (objfile, dwarf2_objfile_data_key);
|
|
|
|
|
|
|
|
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
|
|
|
|
|
|
|
|
struct comp_unit_head cu_header;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset (&cu_header, 0, sizeof cu_header);
|
|
|
|
|
|
|
|
read_comp_unit_head (&cu_header, info_ptr, objfile->obfd);
|
|
|
|
|
|
|
|
return cu_header.offset_size;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the text offset of the CU. The returned offset comes from
|
|
|
|
/* Return the text offset of the CU. The returned offset comes from
|
|
|
@ -16691,6 +16327,14 @@ write_one_signatured_type (void **slot, void *d)
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* A cleanup function for an htab_t. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
|
|
cleanup_htab (void *arg)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
htab_delete (arg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create an index file for OBJFILE in the directory DIR. */
|
|
|
|
/* Create an index file for OBJFILE in the directory DIR. */
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
@ -16747,7 +16391,7 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
|
|
|
|
|
|
|
|
|
|
|
|
psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer,
|
|
|
|
psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer,
|
|
|
|
NULL, xcalloc, xfree);
|
|
|
|
NULL, xcalloc, xfree);
|
|
|
|
make_cleanup_htab_delete (psyms_seen);
|
|
|
|
make_cleanup (cleanup_htab, psyms_seen);
|
|
|
|
|
|
|
|
|
|
|
|
/* While we're scanning CU's create a table that maps a psymtab pointer
|
|
|
|
/* While we're scanning CU's create a table that maps a psymtab pointer
|
|
|
|
(which is what addrmap records) to its index (which is what is recorded
|
|
|
|
(which is what addrmap records) to its index (which is what is recorded
|
|
|
@ -16757,7 +16401,7 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
|
|
|
|
hash_psymtab_cu_index,
|
|
|
|
hash_psymtab_cu_index,
|
|
|
|
eq_psymtab_cu_index,
|
|
|
|
eq_psymtab_cu_index,
|
|
|
|
NULL, xcalloc, xfree);
|
|
|
|
NULL, xcalloc, xfree);
|
|
|
|
make_cleanup_htab_delete (cu_index_htab);
|
|
|
|
make_cleanup (cleanup_htab, cu_index_htab);
|
|
|
|
psymtab_cu_index_map = (struct psymtab_cu_index_map *)
|
|
|
|
psymtab_cu_index_map = (struct psymtab_cu_index_map *)
|
|
|
|
xmalloc (sizeof (struct psymtab_cu_index_map)
|
|
|
|
xmalloc (sizeof (struct psymtab_cu_index_map)
|
|
|
|
* dwarf2_per_objfile->n_comp_units);
|
|
|
|
* dwarf2_per_objfile->n_comp_units);
|
|
|
|