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