[fpc-devel] RECENT Commit breaking FpDebug - Dwarf / and not even fully fixing the original issue
Martin Frb
lazarus at mfriebe.de
Wed Apr 29 22:45:46 CEST 2026
The below mention commit removes writing of class constants.
It also breaks this for FpDebug, which was able to show them. (btw, gdb
can too)
Though, it is still correct.... (more or less).
I agree, we do need DWARF that works with GDB...
Which leads to an interesting question
- Why wasn't it fixed?
It now works for classes, but is left broken for advanced records (see
example at the end)....
It breaks GDB. But not because GDB doesn't deal with "incorrect dwarf"
It breaks GDB because GDB's Pascal mode is severely broken, and declining.
GDB has comments "we haven't seen that by any producer, so we don't
support it yet" (that may include: just not seen, because not tried hard
enough).
And yes its the Pascal part of GDB:
When compiled with -godwarfcpp then this incorrect dwarf works => so
maybe that could have been kept?
Yes, its still wrong Dwarf, so ok, still correct to remove.
But then, why not: REPLACE?
Wouldn't that be better?
There is correct and valid DWARF to implement this.
In DWARF-5 => but I made an MR for DWARF-5, and then can easily make one
for the "class const" as follow up.
Only problem: gdb is broken if the language is set to Pascal.
The valid DWARF-5 works if the language is c++. But of course not, if it
is Pascal.
Given that we have a switch -godwarfcpp => should we not then also have
one for -godwarffpdebug ?
If we go by the minimum between gdb and lldb => given that gdb is
shrinking its minimum (the string tag worked in gdb 12 but no longer in
gdb 17 at least not for pascal) there wont be much left.
---------------------------------------
Out of sheer curiosity:
Why is there a (reverted) commit that attempts to fix this by removing
the constant from TObject (and leaving the dwarf info as is)?
---------------------------------------
Revision: f6173555587ac61276919f37fac6b308dad53acd
Author: Pierre Muller <pierre at freepascal.org>
Date: 28/04/2026 23:08:18
Message:
Disable writing dwarf debug information for constants inside object or
class (as it leads to crashes in GDB)
program ClassVar;
{$Mode objfpc}{$H+}
{$ModeSwitch advancedrecords}
type
TTest = record
ab: word;
public const
d = 5;
end;
var a,b:TTest;
begin
a.ab:=1;
end.
More information about the fpc-devel
mailing list