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

Tom de Vries
2025-01-21T15:09:16Z

On 1/21/25 14:32, Tom Tromey wrote:
>>>>>> "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.

Hi Tom,

thanks for the review.

The v1 (
https://sourceware.org/pipermail/gdb-patches/2024-October/212676.html )
takes the approach of making sure "cu->per_cu->version ()" is set.

Do you prefer that one?

Thanks,
- Tom

> 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