* dwarf2read.c (lookup_dwo_unit): Return NULL if DWO not found.

(init_cutu_and_read_dies): Flag a complaint, not error, for bad
	DWO stub.  If DWO isn't found, just use stub.
	(lookup_dwo_cutu): Don't try DWO if there's a DWP file.
This commit is contained in:
Doug Evans 2013-04-30 23:19:41 +00:00
parent a98c29a089
commit 6a506a2dcb
2 changed files with 73 additions and 56 deletions

View File

@ -1,5 +1,10 @@
2013-04-30 Doug Evans <dje@google.com>
* dwarf2read.c (lookup_dwo_unit): Return NULL if DWO not found.
(init_cutu_and_read_dies): Flag a complaint, not error, for bad
DWO stub. If DWO isn't found, just use stub.
(lookup_dwo_cutu): Don't try DWO if there's a DWP file.
* dwarf2read.c (dw2_find_symbol_file): Initialize filename before
calling init_cutu_and_read_dies.

View File

@ -4605,7 +4605,7 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
/* Subroutine of init_cutu_and_read_dies to simplify it.
Look up the DWO unit specified by COMP_UNIT_DIE of THIS_CU.
If the specified DWO unit cannot be found an error is thrown. */
Returns NULL if the specified DWO unit cannot be found. */
static struct dwo_unit *
lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
@ -4650,14 +4650,6 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
signature);
}
if (dwo_unit == NULL)
{
error (_("Dwarf Error: CU at offset 0x%x references unknown DWO"
" with ID %s [in module %s]"),
this_cu->offset.sect_off, hex_string (signature),
this_cu->objfile->name);
}
return dwo_unit;
}
@ -4834,10 +4826,15 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
struct die_info *dwo_comp_unit_die;
if (has_children)
error (_("Dwarf Error: compilation unit with DW_AT_GNU_dwo_name"
{
complaint (&symfile_complaints,
_("compilation unit with DW_AT_GNU_dwo_name"
" has children (offset 0x%x) [in module %s]"),
this_cu->offset.sect_off, bfd_get_filename (abfd));
}
dwo_unit = lookup_dwo_unit (this_cu, comp_unit_die);
if (dwo_unit != NULL)
{
if (read_cutu_die_from_dwo (this_cu, dwo_unit,
abbrev_table != NULL,
comp_unit_die,
@ -4850,6 +4847,15 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
}
comp_unit_die = dwo_comp_unit_die;
}
else
{
/* Yikes, we couldn't find the rest of the DIE, we only have
the stub. A complaint has already been logged. There's
not much more we can do except pass on the stub DIE to
die_reader_func. We don't want to throw an error on bad
debug info. */
}
}
/* All of the above is setup for this call. Yikes. */
die_reader_func (&reader, info_ptr, comp_unit_die, has_children, data);
@ -9294,7 +9300,10 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
struct dwo_file *dwo_file;
struct dwp_file *dwp_file;
/* Have we already read SIGNATURE from a DWP file? */
/* First see if there's a DWP file.
If we have a DWP file but didn't find the DWO inside it, don't
look for the original DWO file. It makes gdb behave differently
depending on whether one is debugging in the build tree. */
dwp_file = get_dwp_file ();
if (dwp_file != NULL)
@ -9321,13 +9330,14 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
}
}
}
/* Have we already seen DWO_NAME? */
else
{
/* No DWP file, look for the DWO file. */
dwo_file_slot = lookup_dwo_file_slot (dwo_name, comp_dir);
if (*dwo_file_slot == NULL)
{
/* Read in the file and build a table of the DWOs it contains. */
/* Read in the file and build a table of the CUs/TUs it contains. */
*dwo_file_slot = open_and_init_dwo_file (this_unit, dwo_name, comp_dir);
}
/* NOTE: This will be NULL if unable to open the file. */
@ -9362,6 +9372,7 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
return dwo_cutu;
}
}
}
/* We didn't find it. This could mean a dwo_id mismatch, or
someone deleted the DWO/DWP file, or the search path isn't set up
@ -9374,9 +9385,10 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
}
complaint (&symfile_complaints,
_("Could not find DWO %s referenced by CU at offset 0x%x"
_("Could not find DWO %s %s(%s) referenced by CU at offset 0x%x"
" [in module %s]"),
kind, this_unit->offset.sect_off, objfile->name);
kind, dwo_name, hex_string (signature),
this_unit->offset.sect_off, objfile->name);
return NULL;
}