Re: [PATCH v2] [gdb/symtab] Fix dwarf version of DWO TU

Tom Tromey
2025-01-21T13:33:37Z

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> When running test-case gdb.ada/access_tagged_param.exp with target board
Tom> fission, we run into:
Tom> ...
Tom> (gdb) break pck.adb:19^M
Tom> gdb/dwarf2/read.h:289: internal-error: version: \
Tom> Assertion `m_dwarf_version != 0' failed.^M
Tom> ...

Tom> - && (cu->per_cu->version () == 2
Tom> + && (cu->header.version == 2

All the stuff in this area seems kind of horrible to me. Like, first of
all, how can this even fail? It seems like the CU version should be set
when setting up the reader. And if not, what's gone wrong there?
Relatedly, can the other callers of version() fail in the same way?
Finally there aren't really that many callers of this method so I wonder
if it can be removed, maybe making this code less fragile. Looking at
it, I feel pretty sure if I needed a version check I'd probably write
code to call this method but ... maybe that's unsafe?

Tom