Add dwarf2_per_bfd field to dwarf2_per_cu_data
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 27 May 2020 15:13:54 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:15:54 +0000 (11:15 -0400)
commit1859c670e9979c1e58ed4e9d83085f732e6936f5
treee41af8237a87c90c2924b16e758981a863e3e6b6
parent5e22e966a02123478a3c5e067f911a3d180060af
Add dwarf2_per_bfd field to dwarf2_per_cu_data

Some code using dwarf2_per_cu_data objects accesses the corresponding
dwarf2_per_bfd using the following pattern:

    per_cu->dwarf2_per_objfile->per_bfd

Since dwarf2_per_cu_data objects are going to become
objfile-independent, the dwarf2_per_objfile link must go.  To replace
it, add a dwarf2_per_cu_data->per_bfd link.  It makes sense to have it
there because the dwarf2_per_cu_data objects belong to the
dwarf2_per_bfd, so this is essentially just a backlink to their owner.

gdb/ChangeLog:

* dwarf2/read.h (struct dwarf2_per_cu_data) <per_bfd>: New
member.
* dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu): Initialize
dwarf2_per_cu_data::per_bfd.
(dwarf2_per_bfd::allocate_signatured_type): Likewise.
(create_type_unit_group): Likewise.
(queue_comp_unit): Remove reference to
per_cu->dwarf2_per_objfile.
(maybe_queue_comp_unit): Likewise.
(fill_in_sig_entry_from_dwo_entry): Assign new field.
(create_cus_hash_table): Assign new field.

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