From: Tom Tromey Date: Wed, 17 Jan 2024 02:10:12 +0000 (-0700) Subject: Fix crash in struct-with-sig-2.exp with debug-names target board X-Git-Tag: gdb-15-branchpoint~1242 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2002c0099f9fb4d737930acd66733cfad39f68f1;p=thirdparty%2Fbinutils-gdb.git Fix crash in struct-with-sig-2.exp with debug-names target board When I run the struct-with-sig-2.exp test with the .debug_names-using target board, I see a gdb crash. This happens because the reader throws an exception without calling finalize_all_units. This causes an assertion failure later because the number of CUs and TUs doesn't match. The fix is to clear 'all_units' on failure. Approved-By: Tom de Vries --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1b5e566bb01..8f2b7a35f27 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5193,6 +5193,8 @@ create_all_units (dwarf2_per_objfile *per_objfile) if (!dwz->types.empty ()) { + per_objfile->per_bfd->all_units.clear (); + /* See enhancement PR symtab/30838. */ error (_("Dwarf Error: .debug_types section not supported in dwz file")); }