On 18/12/2025 11:27, mailinglists--- via fpc-pascal wrote:
Hi. If FPC supports these extra DWARF generation improvement, enabled via compiler arguments like: -godwarfsets -godwarfmethodclassprefix

Then why aren't those defaults when you enable DWARF debug generation via -g or -gw? Is it because those settings might not be supported for the DWARFv2 (FPC's default DWARF generation)?

-godwarfsets
This actually breaks the dwarf standard.
DWARF can encode "sets" only from version 3 upwards. This option only has an effect if used with DWARF-2, and it then against the standard uses DWARF-3 tags but within a DWARF-2 encoding.
Most debuggers don't mind that, but that doesn't make it right.

It is still useful, if a debugger does not "like" DWARF-3 the way fpc uses it. (which even if correct, differs from gcc, and e.g. gdb has more testing against gcc / and gdb still sometimes crashes, which is more likely with FPC generated DWARF 3).

-godwarfmethodclassprefix
Methods are encoded inside their classes. The class name therefore is already available (in all of the DWARF versions). However, if some debuggers don't use that information, then this switch can add extra info to force them showing this.
If you use FpDebug, then you don't need this option.
GDB, I don't know if it has a configuration...
LLDB not tested



On that note, what is the recommended DWARF version to use for up-to-date Linux and FreeBSD systems?

Afaik that depends also on the debugger backend you use.

My personal experience says that gdb is still sensitive when it comes to FPC generated DWARF 3 (or 4). (Btw DWARF-4 had an encoding bug, which got fixed some month/ a year? ago... Not sure if merged)
-godwarfcpp may or may not help.

LLDB, I have no experience.

On Linux, if i386 or x86, and if you use FpDebug => use Dwarf 3. (Dwarf 4 has no advantage yet).

-------------
See also: https://wiki.freepascal.org/DWARF#DWARF_version_comparison
Some of the diffs also depend on the debugger used...

E.g. string vs pchar
None of the dwarf versions yet clearly marks a string as such. They are encoded as pchar or array (or record). And then the debugger may work it out on internal encoding details. Or may not.

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to