]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Introduce dwarf2_per_objfile::obstack
authorTom Tromey <tom@tromey.com>
Wed, 27 May 2020 15:13:48 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:13:48 +0000 (11:13 -0400)
commit45940949265417e8a21b5936e906cf24a3177001
tree4115741e2941a046a063eb4dafe27cf2c2f60d4b
parentf8c6d1528c19b11fdaa3ec949147280e500446e2
Introduce dwarf2_per_objfile::obstack

Currently much of the DWARF-related data is stored on the objfile
obstack.  This prevents sharing this data across objfiles, so this patch
adds a new obstack to dwarf2_per_objfile.  Note that the
dwarf2_per_objfile type is going to become "dwarf2_per_bfd" in a
subsequent patch, which is indeed going to be shared between objfiles.

One way to check whether this is correct is to look at the remaining
uses of objfile_obstack in the DWARF code and note that they all
appear in the "full CU" code paths.

The converse -- storing per-objfile data on the shared obstack -- is
not good, but it is just a memory leak, not a potential
use-after-free.  Double-checking this would also be useful, though.

gdb/ChangeLog:

* dwarf2/read.h (struct dwarf2_per_objfile) <obstack>: New
member.
* dwarf2/read.c (delete_file_name_entry): Fix comment.
(create_cu_from_index_list)
(create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names)
(dw2_get_file_names_reader, dwarf2_initialize_objfile)
(dwarf2_create_include_psymtab)
(create_debug_type_hash_table, add_type_unit)
(create_type_unit_group, read_comp_units_from_section)
(dwarf2_compute_name, create_cus_hash_table)
(create_dwp_hash_table, create_dwo_unit_in_dwp_v1)
(create_dwo_unit_in_dwp_v2, open_and_init_dwp_file): Use new
obstack.
(dw2_get_real_path): Likewise.  Change argument to
dwarf2_per_objfile.

Change-Id: Icdec7be7c4d9f33d1dce4f807284f3077f7d3f03
gdb/ChangeLog
gdb/dwarf2/read.c
gdb/dwarf2/read.h