Michael Van Canneyt wrote 23 lines
On Tue, 26 May 2026, Martin Frb via fpc-devel wrote:
> I have updated
>
https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/683
>
> It should provide the new tag as specified by the DWARF
> documentation. (including Dwarf-5 as that was added to FPC).
>
> Given that many debuggers don't yet implement it, or (as gdb) have
> bugs, like failing for if the language is Pascal, I propose to add a
> new dwarf option.
> This also allows it to be combined with the existing -godwarfcpp =>
> in case of gdb actually of some interest (works for some string types).
>
> As for the name of the option, if there are better ideas....
>
> I also hope that this option (or if preferred an additional extra
> option "goDwarfProperty" like "goDwarfWithSets") may be added for the
> new property code (which is based on the not yet released DWARF-6).
Why not simply use -godwarf5/6 ?
Actually those are
-gw4
-gw5
and both exist.
For the moment that would suffice (at least for strings), since they are the only info that is controlled by those yet.
That would mean, anyone using LLDB/GDB must simple keep using -gw3 (or lower, in case of GDB -gw2 may still be better I think)
Immediate plans don't have anything to be added that would be of difference for LLDB/GDB. So the above may hold for a good time to come. But of course, no one knows, if anything will be found where LLDB/GDB would benefit from some DWARF 4/5 encoding.
---------
If -gw4/5 are used then the question is: Should -goDwarfCpp disable the new string tag. As indicated, under GDB it (mostly) works for a byte based strings. (except index access).
On the other hand, the old encoding works fine for "language = c++" too. (and FpDebug should not be used with goDwarfCpp)
---------
The other question is then how to proceed with the new property tag.
I don't think that using -gw6 just yet is a good idea. We don't know if there will be further changes to the CU headers (or other headers).
The DW_TAG_property is unlikely to change. And even if, no consumer except FpDebug would read it, if the DWARF version is 5 (or less).
Since leading members of the DWARF committee have said that is it ok to use tag/attributes outside the documented context, there should be no problem if we generated DWARF-5, and added the property tag to it. We would then double check that it hasn't changed, when DWARF-6 comes, and before we add -gw6.
But then for that we do need a new -goDwarf### option.