]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix crash in struct-with-sig-2.exp with debug-names target board
authorTom Tromey <tom@tromey.com>
Wed, 17 Jan 2024 02:10:12 +0000 (19:10 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jan 2024 13:15:27 +0000 (06:15 -0700)
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 <tdevries@suse.de>
gdb/dwarf2/read.c

index 1b5e566bb016ee837fd78116d64e8f115744f885..8f2b7a35f272ca58254436c85e7830cf1ed9d8fc 100644 (file)
@@ -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"));
        }