Gcc13 DWARF version

Just updated my system including gcc to release 13. To my dismay, the executable produced is not well digested by the Debugger when built in debug mode. Not anymore.
gcc13 may now default to a newer version of DWARF like 5 maybe but the release notes for gcc11 reads it defaults to version 5 as well.
Nevertheless, -gdwarf-3 fixes it for gcc (we already know that clang needed this regardless).

Does anybody know what has changed in gcc?

We had patches to prevent GCC 11 from defaulting to the newer DWARF version. Perhaps those got lost in the upgrade? CC @nielx.

Tried to do a quick search (and I may have overlooked things), but it seems like that the patch is still there.

It needs more investigation to find out what has happened. Please open a ticket.

2 Likes

Will do. Thanks

ticket filed here.

I think there’s something more complicated going on. Variables still show up in the “Variables” view in Debugger, complete with enum descriptors, struct contents, etc. It’s just source code that doesn’t show up. So, something’s changed specifically related to that, it appears.

Ah, no, it just seems to be some problem with GCC after all. The problem is encountered in Debugger’s DwarfFile.cpp; the version check in _ParseLineInfo fails (it’s 5, not 2 or 3.)

Adding -gdwarf-3 to the command line fixes the problem. It seems that function cannot even parse the DWARF4 headers much less DWARF5 ones.

Perhaps we should implement dwarf5 instead of forcing it down to 3 or 2 again?

I agree this would be the best option after all. Perhaps, we should proceed step by step and implement v4 first? I don’t have a clue of the effort required to transition to v5.

Best to follow GCC/GDB parsing with DWARF v5. This helps keep things in a cross-compatibility debugging state if local/remote debugging with Clang/LLDB across various platforms like macOS.

DWARF4 is mostly implemented, it only isn’t for line-info specifically. (Past GCC versions generated DWARFv4 with v3 line-info … who knows.)

So for this happened the commit

hrev57248 Debugger – implement parsing for v4 line-info