Le 29/04/2026 à 22:45, Martin Frb via fpc-devel a écrit :
The below mention commit removes writing of class constants.
I did commit this indeed.
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...
GDB is generating an assertion error when trying to dispaly the value of these constants.
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)....
I do not understand what you mean by saying that it is now fixed, before my commit, I wasn't able to debug the Free Pascal trunk compiler using GDB.
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).
I still have not enough knowledge about Dwarf internal to understand all those issues. For that reason, I would prefer that Jonas or Florian would look at you MR concerning DWarf improvement and FpDebug specifics.
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.
I am still the official Pascal maintainer of GDB, but I didn't do anything to improve GDB for a looonng time. I would maybe make more sense if you would directly step up to volunteer as Pascal maintainer of GDB?
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.
Adding support for Dwarf-5 is certainly a good move, but again, I do not feel competent in that area, sorry.
--------------------------------------- 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)?
This is how I did on several test machines to be able to use GDB to debug Free Pascal compiler. I pushed this local change by accident, that is why I reverted it. We had a discussion on core when I raised the issue about the fact that adding a constant field to the system TObject (which is the base class of all classes) completely broke the usage of GDB, as any inspection of a class instance led to a internal assertion error inside GDB. Pierre _______________________________________________ fpc-devel maillist - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
