]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Rewrite .debug_names reader
authorTom Tromey <tom@tromey.com>
Sat, 2 Dec 2023 20:18:13 +0000 (13:18 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 18 Jan 2024 15:20:17 +0000 (08:20 -0700)
commitb371f07c47c73d9597f74f87bc6e22ba04db1963
tree9939ee1e8dadc836c5a18fc57e2748613b70ab0a
parent9b63bc4644da4c91bf93a2332f6701250abec7e2
Rewrite .debug_names reader

This rewrites the .debug_names reader to follow the spec.

Since it was first written, gdb's .debug_names writer has been
incorrect -- while the form of the section has been ok, the contents
have been very gdb-specific.

This patch fixes the reader side of this equation, rewriting the
reader to create a cooked index internally -- an important detail
because it allows for the deletion of a lot of code, and it means the
various readers will agree more often.

This reader checks for a new augmentation string.  For the time being,
all other producers are ignored -- the old GDB ones because they are
wrong, and clang because it does not emit DW_IDX_parent.  (If there
are any other producers, I'm unaware of them.)

While the new reader mostly runs in a worker thread, it does not try
to distribute its work.  This could be done by partitioning the name
table.  The parent computations could also be done in parallel after
all names have been read.  I haven't attempted this.

Note that this patch temporarily regresses gdb.base/gdb-index-err.exp.
This test writes an index using gdb -- but at this particular stage,
gdb cannot read the indexes it creates.  Rather than merge the patches
into a mega-patch, I've chosen to just accept this temporary
regression.

In v1 of this patch, I made the new reader more strict about requiring
.debug_aranges.  In v2, I've backed this out and kept the previous
logic.  This solved a few test failures, though it's arguably not the
right approach.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25950
gdb/dwarf2/read-debug-names.c
gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
gdb/testsuite/lib/dwarf.exp