]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: generate dwarf-5 index identically as worker-thread count changes
authorAndrew Burgess <aburgess@redhat.com>
Mon, 27 Nov 2023 13:19:39 +0000 (13:19 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 28 Nov 2023 10:23:19 +0000 (10:23 +0000)
commit3644f41dc805b38943009bed3d15ed36326406d6
tree9eeea7ef65386e76406572feadfc323b9ba70410
parentaff250145af6c7a8ea9332bc1306c1219f4a63db
gdb: generate dwarf-5 index identically as worker-thread count changes

Similar to the previous commit, this commit ensures that the dwarf-5
index files are generated identically as the number of worker-threads
changes.

Building the dwarf-5 index makes use of a closed hash table, the
bucket_hash local within debug_names::build().  Entries are added to
bucket_hash from m_name_to_value_set, which, in turn, is populated
by calls to debug_names::insert() in write_debug_names.  The insert
calls are ordered based on the entries within the cooked_index, and
the ordering within cooked_index depends on the number of worker
threads that GDB is using.

My proposal is to sort each chain within the bucket_hash closed hash
table prior to using this to build the dwarf-5 index.

The buckets within bucket_hash will always have the same ordering (for
a given GDB build with a given executable), and by sorting the chains
within each bucket, we can be sure that GDB will see each entry in a
deterministic order.

I've extended the index creation test to cover this case.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/index-write.c
gdb/testsuite/gdb.gdb/index-file.exp