]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Don't use .debug_names if .debug_aranges is missing
authorTom Tromey <tom@tromey.com>
Tue, 27 Jan 2026 03:49:26 +0000 (20:49 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 14 Feb 2026 18:24:35 +0000 (11:24 -0700)
commit169c87848f5b565475fea22b44bdf078a3d9ea6e
tree9de8f057ddb217878044fa3132c8fb35c31e86e4
parent52caa25438f412c1a6eb8626ee2a30e281b4d934
Don't use .debug_names if .debug_aranges is missing

gdb's .debug_names reader depends on .debug_aranges as well, because
if the ranges are missing, it won't be able to create a map from PC to
CU.

However, this requirement isn't enforced by gdb.  I no longer recall
know why, but I can see in commit b371f07c ("Rewrite .debug_names
reader") that I made this choice on purpose:

    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.

However, the current setup now seems clearly incorrect to me.  And, it
was causing problems for another patch I'm working on.

Fixing this required patching a few tests to add a .debug_aranges
section.  I've also updated the intro comment to
read_addrmap_from_aranges to reflect how it ought to be used.

Regression tested on x86-64 Fedora 41 with both the default and the
cc-with-debug-names target boards.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33847
gdb/dwarf2/aranges.c
gdb/dwarf2/aranges.h
gdb/dwarf2/read-debug-names.c
gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
gdb/testsuite/gdb.dwarf2/debug-names.exp