&coff_data(abfd)->dwarf2_find_line_info))
return TRUE;
+ sec_data = coff_section_data (abfd, section);
+
/* If the DWARF lookup failed, but there is DWARF information available
then the problem might be that the file has been rebased. This tool
changes the VMAs of all the sections, but it does not update the DWARF
{
bfd_signed_vma bias;
- bias = _bfd_dwarf2_find_symbol_bias (symbols,
- & coff_data (abfd)->dwarf2_find_line_info);
+ /* Create a cache of the result for the next call. */
+ if (sec_data == NULL && section->owner == abfd)
+ {
+ amt = sizeof (struct coff_section_tdata);
+ section->used_by_bfd = bfd_zalloc (abfd, amt);
+ sec_data = (struct coff_section_tdata *) section->used_by_bfd;
+ }
+
+ if (sec_data != NULL && sec_data->saved_bias)
+ bias = sec_data->saved_bias;
+ else
+ {
+ bias = _bfd_dwarf2_find_symbol_bias (symbols,
+ & coff_data (abfd)->dwarf2_find_line_info);
+ if (sec_data)
+ {
+ sec_data->saved_bias = TRUE;
+ sec_data->bias = bias;
+ }
+ }
if (bias
&& _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section,
}
}
- /* Now wander though the raw linenumbers of the section. */
- /* If we have been called on this section before, and the offset we
- want is further down then we can prime the lookup loop. */
- sec_data = coff_section_data (abfd, section);
+ if (section->lineno_count == 0)
+ {
+ *functionname_ptr = NULL;
+ *line_ptr = 0;
+ return TRUE;
+ }
+
+ /* Now wander though the raw linenumbers of the section.
+ If we have been called on this section before, and the offset
+ we want is further down then we can prime the lookup loop. */
if (sec_data != NULL
&& sec_data->i > 0
&& offset >= sec_data->offset)
coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
if (coff->symbol.value > offset)
break;
+
*functionname_ptr = coff->symbol.name;
last_value = coff->symbol.value;
if (coff->native)
section->used_by_bfd = bfd_zalloc (abfd, amt);
sec_data = (struct coff_section_tdata *) section->used_by_bfd;
}
+
if (sec_data != NULL)
{
sec_data->offset = offset;
continue;
}
- abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
+ abbrev = lookup_abbrev (abbrev_number, unit->abbrevs);
if (! abbrev)
{
- _bfd_error_handler
- (_("Dwarf Error: Could not find abbrev number %u."),
- abbrev_number);
+ static unsigned int previous_failed_abbrev = -1U;
+
+ /* Avoid multiple reports of the same missing abbrev. */
+ if (abbrev_number != previous_failed_abbrev)
+ {
+ _bfd_error_handler
+ (_("Dwarf Error: Could not find abbrev number %u."),
+ abbrev_number);
+ previous_failed_abbrev = abbrev_number;
+ }
bfd_set_error (bfd_error_bad_value);
goto fail;
}
func->tag = abbrev->tag;
func->prev_func = unit->function_table;
unit->function_table = func;
- unit->number_of_functions++;
+ unit->number_of_functions++;
BFD_ASSERT (!unit->cached);
if (func->tag == DW_TAG_inlined_subroutine)
var->stack = 1;
var->prev_var = unit->variable_table;
unit->variable_table = var;
- BFD_ASSERT (!unit->cached);
+ /* PR 18205: Missing debug information can cause this
+ var to be attached to an already cached unit. */
}
/* No inline function in scope at this nesting level. */