PR symtab/16426

* dwarf2read.c (dwarf2_get_dwz_file): Call gdb_bfd_record_inclusion.
	(try_open_dwop_file): Ditto.
	* gdb_bfd.c: #include "vec.h".
	(bfdp): New typedef.
	(struct gdb_bfd_data): New member included_bfds.
	(gdb_bfd_unref): Unref all included bfds.
	(gdb_bfd_record_inclusion): New function.
	* gdb_bfd.h (gdb_bfd_record_inclusion): Declare.
This commit is contained in:
Doug Evans 2014-01-13 17:15:42 -08:00
parent 067c5c1de2
commit 13aaf45454
4 changed files with 62 additions and 1 deletions

View file

@ -2432,6 +2432,7 @@ dwarf2_get_dwz_file (void)
do_cleanups (cleanup);
gdb_bfd_record_inclusion (dwarf2_per_objfile->objfile->obfd, dwz_bfd);
dwarf2_per_objfile->dwz_file = result;
return result;
}
@ -10122,6 +10123,8 @@ lookup_dwo_unit_in_dwp (struct dwp_file *dwp_file, const char *comp_dir,
If IS_DWP is TRUE, we're opening a DWP file, otherwise a DWO file.
SEARCH_CWD is true if the current directory is to be searched.
It will be searched before debug-file-directory.
If successful, the file is added to the bfd include table of the
objfile's bfd (see gdb_bfd_record_inclusion).
If unable to find/open the file, return NULL.
NOTE: This function is derived from symfile_bfd_open. */
@ -10169,6 +10172,12 @@ try_open_dwop_file (const char *file_name, int is_dwp, int search_cwd)
return NULL;
}
/* Success. Record the bfd as having been included by the objfile's bfd.
This is important because things like demangled_names_hash lives in the
objfile's per_bfd space and may have references to things like symbol
names that live in the DWO/DWP file's per_bfd space. PR 16426. */
gdb_bfd_record_inclusion (dwarf2_per_objfile->objfile->obfd, sym_bfd);
return sym_bfd;
}