Add dwarf2_per_cu_data::index
authorTom Tromey <tom@tromey.com>
Wed, 27 May 2020 15:13:49 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:13:49 +0000 (11:13 -0400)
commitd3473f0c4b8e8d791ed87b1919a666bc368497dc
tree5030507a84d80fab2e2856fb031b9970fa6bc756
parent5717c425a62c8e15a5936acdfa2bac2732aeb9b4
Add dwarf2_per_cu_data::index

Currently, a dwarf2_per_cu_data can hold a link to the corresponding
expanded compunit_symtab.  However, the dwarf2_per_cu_data objects are
shared across objfiles, a simple pointer won't work: each objfile
sharing the dwarf2_per_cu_data instance will have a corresponding
compunit_symtab.

Instead, this link will be stored in the dwarf2_per_objfile object
(which will contain the objfile-specific data).  To enable this, we add
an index to each dwarf2_per_cu_data and signatured_type.  The data
structure in the dwarf2_per_objfile will use this new index to map a
dwarf2_per_cu_data to its corresponding compunit_symtab, for this
objfile.

gdb/ChangeLog:

* dwarf2/read.h (struct dwarf2_per_objfile) <allocate_per_cu,
allocate_signatured_type>: Declare new methods.
<m_num_psymtabs>: New member.
(struct dwarf2_per_cu_data) <index>: New member.
* dwarf2/read.c (dwarf2_per_objfile::allocate_per_cu)
(dwarf2_per_objfile::allocate_signatured_type): New methods.
(create_cu_from_index_list): Use allocate_per_cu.
(create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names)
(create_debug_type_hash_table, add_type_unit)
(read_comp_units_from_section): Use allocate_signatured_type.

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