summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-20 17:23:40 -0600
committerTom Tromey <tom@tromey.com>2021-03-20 17:23:43 -0600
commit79cc99f69b97e8bc6aa109c937095d34ecdf3762 (patch)
treebb3f5ecb5dfe3161d880a27aad959b1543b9d679
parent4829711b6ba57568d5fec3c2e8c747a2edb2aa8f (diff)
downloadbinutils-gdb-79cc99f69b97e8bc6aa109c937095d34ecdf3762.tar.gz
Change how DWARF index writer finds address map
This changes the DWARF index writer to find the psymtab address map in the per_bfd object, rather than go via the objfile. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * dwarf2/index-write.c (struct addrmap_index_data) <objfile>: Remove. (add_address_entry): Remove objfile parameter. (add_address_entry_worker): Update. (write_address_map): Replace objfile parameter with per_bfd. (write_gdbindex, write_psymtabs_to_index): Update.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2/index-write.c21
2 files changed, 19 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 47aa9ea0a8d..171623ba04b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2021-03-20 Tom Tromey <tom@tromey.com>
+ * dwarf2/index-write.c (struct addrmap_index_data) <objfile>:
+ Remove.
+ (add_address_entry): Remove objfile parameter.
+ (add_address_entry_worker): Update.
+ (write_address_map): Replace objfile parameter with per_bfd.
+ (write_gdbindex, write_psymtabs_to_index): Update.
+
+2021-03-20 Tom Tromey <tom@tromey.com>
+
* dwarf2/read.c (dwarf2_base_index_functions::print_stats): Add
print_bcache parameter.
* symfile-debug.c (objfile::print_stats): Add print_bcache
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index a7b9ae66cae..f42a25331f8 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -413,7 +413,6 @@ struct addrmap_index_data
: addr_vec (addr_vec_), cu_index_htab (cu_index_htab_)
{}
- struct objfile *objfile;
data_buf &addr_vec;
psym_index_map &cu_index_htab;
@@ -430,7 +429,7 @@ struct addrmap_index_data
/* Write an address entry to ADDR_VEC. */
static void
-add_address_entry (struct objfile *objfile, data_buf &addr_vec,
+add_address_entry (data_buf &addr_vec,
CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
{
addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start);
@@ -447,7 +446,7 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
partial_symtab *pst = (partial_symtab *) obj;
if (data->previous_valid)
- add_address_entry (data->objfile, data->addr_vec,
+ add_address_entry (data->addr_vec,
data->previous_cu_start, start_addr,
data->previous_cu_index);
@@ -465,12 +464,12 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
return 0;
}
-/* Write OBJFILE's address map to ADDR_VEC.
+/* Write PER_BFD's address map to ADDR_VEC.
CU_INDEX_HTAB is used to map addrmap entries to their CU indices
in the index file. */
static void
-write_address_map (struct objfile *objfile, data_buf &addr_vec,
+write_address_map (dwarf2_per_bfd *per_bfd, data_buf &addr_vec,
psym_index_map &cu_index_htab)
{
struct addrmap_index_data addrmap_index_data (addr_vec, cu_index_htab);
@@ -479,10 +478,9 @@ write_address_map (struct objfile *objfile, data_buf &addr_vec,
the addrmap iterator only provides the start of a region; we have to
wait until the next invocation to get the start of the next region. */
- addrmap_index_data.objfile = objfile;
addrmap_index_data.previous_valid = 0;
- addrmap_foreach (objfile->partial_symtabs->psymtabs_addrmap,
+ addrmap_foreach (per_bfd->partial_symtabs->psymtabs_addrmap,
add_address_entry_worker, &addrmap_index_data);
/* It's highly unlikely the last entry (end address = 0xff...ff)
@@ -491,7 +489,7 @@ write_address_map (struct objfile *objfile, data_buf &addr_vec,
doesn't work here. To cope we pass 0xff...ff, this is a rare situation
anyway. */
if (addrmap_index_data.previous_valid)
- add_address_entry (objfile, addr_vec,
+ add_address_entry (addr_vec,
addrmap_index_data.previous_cu_start, (CORE_ADDR) -1,
addrmap_index_data.previous_cu_index);
}
@@ -1463,7 +1461,7 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE *out_file,
/* Dump the address map. */
data_buf addr_vec;
- write_address_map (objfile, addr_vec, cu_index_htab);
+ write_address_map (per_objfile->per_bfd, addr_vec, cu_index_htab);
/* Write out the .debug_type entries, if any. */
data_buf types_cu_list;
@@ -1686,6 +1684,7 @@ write_psymtabs_to_index (dwarf2_per_objfile *per_objfile, const char *dir,
const char *basename, const char *dwz_basename,
dw_index_kind index_kind)
{
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
struct objfile *objfile = per_objfile->objfile;
if (per_objfile->per_bfd->using_index)
@@ -1694,8 +1693,8 @@ write_psymtabs_to_index (dwarf2_per_objfile *per_objfile, const char *dir,
if (per_objfile->per_bfd->types.size () > 1)
error (_("Cannot make an index when the file has multiple .debug_types sections"));
- if (!objfile->partial_symtabs->psymtabs
- || !objfile->partial_symtabs->psymtabs_addrmap)
+ if (!per_bfd->partial_symtabs->psymtabs
+ || !per_bfd->partial_symtabs->psymtabs_addrmap)
return;
struct stat st;