On 8/12/22 17:48, Tom de Vries via Gdb-patches wrote: > Hi, > > [ Requires "[gdb/symtab] Fix assert in set_length" submitted here ( > https://sourceware.org/pipermail/gdb-patches/2022-August/191313.html ). ] > > When running test-case gdb.cp/cpexprs-debug-types.exp on target board > cc-with-debug-names/gdb:debug_flags=-gdwarf-5, we get an executable with > a .debug_names section, but no .debug_types section. For dwarf-5, the TUs > are no longer put in a separate unit, but instead they're put in the > .debug_info section. > > When loading the executable, the .debug_names section is silently ignored > because of this check in dwarf2_read_debug_names: > ... > if (map->tu_count != 0) > { > /* We can only handle a single .debug_types when we have an > index. */ > if (per_bfd->types.size () != 1) > return false; > ... > which triggers because per_bfd->types.size () == 0. > > The intention of the check is to make sure we don't have both .debug_types and > .zdebug_types sections. > Well, that's what I thought when I read the code, but I actually found back the corresponding PR: PR12984, and it turns out it's about object files, which can contain: ... $ grep "\.debug_types" 11.s .section .debug_types,"G",@progbits,wt.75c042c23a9a07ee,comdat .section .debug_types,"G",@progbits,wt.c59c413bf50a4607,comdat ... I've updated the rationale to reflect this. Also, I've added a test-case. Committed as attached. Thanks, - Tom