aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2013-04-30 23:19:41 +0000
committerDoug Evans <dje@google.com>2013-04-30 23:19:41 +0000
commit6a506a2dcb9b406afc0df3425be19ed865a7d69d (patch)
treed4347b5a097e0bc49e0095643dc5e55fc79412b7
parenta98c29a089b946b7ab955a0cc3b3e7cf740a940c (diff)
downloadgdb-6a506a2dcb9b406afc0df3425be19ed865a7d69d.zip
gdb-6a506a2dcb9b406afc0df3425be19ed865a7d69d.tar.gz
gdb-6a506a2dcb9b406afc0df3425be19ed865a7d69d.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2read.c122
2 files changed, 72 insertions, 55 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 16f4357..86e8660 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f640a40..2b4d8ad 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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,21 +4826,35 @@ 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"
- " has children (offset 0x%x) [in module %s]"),
- this_cu->offset.sect_off, bfd_get_filename (abfd));
+ {
+ 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 (read_cutu_die_from_dwo (this_cu, dwo_unit,
- abbrev_table != NULL,
- comp_unit_die,
- &reader, &info_ptr,
- &dwo_comp_unit_die, &has_children) == 0)
+ if (dwo_unit != NULL)
{
- /* Dummy die. */
- do_cleanups (cleanups);
- return;
+ if (read_cutu_die_from_dwo (this_cu, dwo_unit,
+ abbrev_table != NULL,
+ comp_unit_die,
+ &reader, &info_ptr,
+ &dwo_comp_unit_die, &has_children) == 0)
+ {
+ /* Dummy die. */
+ do_cleanups (cleanups);
+ return;
+ }
+ 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. */
}
- comp_unit_die = dwo_comp_unit_die;
}
/* All of the above is setup for this call. Yikes. */
@@ -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,45 +9330,47 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
}
}
}
-
- /* Have we already seen DWO_NAME? */
-
- 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. */
- *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. */
- dwo_file = *dwo_file_slot;
-
- if (dwo_file != NULL)
+ else
{
- struct dwo_unit *dwo_cutu = NULL;
+ /* No DWP file, look for the DWO file. */
- if (is_debug_types && dwo_file->tus)
+ dwo_file_slot = lookup_dwo_file_slot (dwo_name, comp_dir);
+ if (*dwo_file_slot == NULL)
{
- struct dwo_unit find_dwo_cutu;
-
- memset (&find_dwo_cutu, 0, sizeof (find_dwo_cutu));
- find_dwo_cutu.signature = signature;
- dwo_cutu = htab_find (dwo_file->tus, &find_dwo_cutu);
- }
- else if (!is_debug_types && dwo_file->cu)
- {
- if (signature == dwo_file->cu->signature)
- dwo_cutu = dwo_file->cu;
+ /* 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. */
+ dwo_file = *dwo_file_slot;
- if (dwo_cutu != NULL)
+ if (dwo_file != NULL)
{
- if (dwarf2_read_debug)
+ struct dwo_unit *dwo_cutu = NULL;
+
+ if (is_debug_types && dwo_file->tus)
+ {
+ struct dwo_unit find_dwo_cutu;
+
+ memset (&find_dwo_cutu, 0, sizeof (find_dwo_cutu));
+ find_dwo_cutu.signature = signature;
+ dwo_cutu = htab_find (dwo_file->tus, &find_dwo_cutu);
+ }
+ else if (!is_debug_types && dwo_file->cu)
{
- fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) found: @%s\n",
- kind, dwo_name, hex_string (signature),
- host_address_to_string (dwo_cutu));
+ if (signature == dwo_file->cu->signature)
+ dwo_cutu = dwo_file->cu;
+ }
+
+ if (dwo_cutu != NULL)
+ {
+ if (dwarf2_read_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) found: @%s\n",
+ kind, dwo_name, hex_string (signature),
+ host_address_to_string (dwo_cutu));
+ }
+ return dwo_cutu;
}
- return dwo_cutu;
}
}
@@ -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;
}