From 1ddd39f58fea3ec9837018506ea1d7b86e51dc7b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 16 Nov 2021 14:25:08 -0700 Subject: [PATCH] Fix latent bug in read_addrmap_from_aranges Tom de Vries found a failure that we tracked down to a latent bug in read_addrmap_from_aranges (previously create_addrmap_from_aranges). The bug is that this code can erroneously reject .debug_aranges when dwz is in use, due to CUs at duplicate offsets. Because aranges can't refer to a CU coming from the dwz file, the fix is to simply skip such CUs in the loop. --- gdb/dwarf2/read.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9c78097bc45..425244358a7 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2602,8 +2602,9 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, { /* A TU will not need aranges, and skipping them here is an easy way of ignoring .debug_types -- and possibly seeing a - duplicate section offset -- entirely. */ - if (per_cu->is_debug_types) + duplicate section offset -- entirely. The same applies to + units coming from a dwz file. */ + if (per_cu->is_debug_types || per_cu->is_dwz) continue; const auto insertpair -- 2.30.2