I did some work on implementing the new (upcoming DWARF-6) properties support into FpDebug.
** However, it will sit idle there, until the compiler catches up. **I done (for testing) some proof of concept implementation in the compiler too (based on trunk).
That currently works for Windows. On Linux it may work for some cases, but fail to link the exe in others...
There is a test build (Windows 64)
https://sourceforge.net/projects/lazarus-snapshots/files/Window%2064/2026-04%20Lazarus%204.99%20--%20property%20test%20--%20with%20modified%20FPC%203.3.1%20based%20on%20%28f724b49d1fcf697%29In this build the new debug info is enabled by default, if DWARF is selected.
It encodes:
- normal properties
- properties with getter
- properties with indexed getter: property Bar[AnIndex: integer]: string read GetBar;
- properties with index and getter: property Bar: string index 3 read GetIndexedBar;
- properties with index and indexed getters
- a wide variety (but not all) properties with access to nested records
property NestedBar: integer read FRecordField.TheNested
Properties with getter function are only evaluated if the "Allow function call" is enabled (global AND in each watch).This means currently they only work in watches, but not in debug hint eval.
(This will be changed later)
About getter functions:The function must be used in your code. If your code does not use it the compiler will not include the code, and then the debugger can not call it.
So for example "TList.Count". The property needs to call GetCount.
- If your code accesses Count or GetCount, then the code will be in the exe, and the debugger can call it.
- If your code does not access either, then the compiler will not include that method, so the debugger can not call it.
- Further, if the method is marked for inlining (e.g. TList.GetCount), then the compiler may refuse to create a stand-alone (call-able) version of it.
Even -O- and {$Inline off} would not change that (not in my tests). Only something like "MethodPtr := @GetCount;" did force the code to be included.
Also the debugger only supports basic result types (including strings).
So property getters returning more complex data (e.g. records) will not work.
Similar for getters needing more complex params.
There is no Linux test build.
FPC modified sources are at
https://gitlab.com/martin_frb/fpc-src/-/tree/mfr/dwarf-6-properties?ref_type=heads(you may need to build the compiler/rtl without debug: -g- )
*** EDIT: pushed a commit that should fix the Linux linking issue
------------
On a side note:
FPC (trunk) removed support for debugging class constantstype TFoo = class
public const Bar = 42; // this was visible in the debugger, but is no longer
end;
This was incorrectly implemented on the compiler side.
Now the incorrect implementation was removed, but the correct replacement has not been added.
This change is included in the provided build above. So such constants wont be shown.