Recent

Author Topic: FpDebug/GDB class variables  (Read 175 times)

ALLIGATOR

  • Sr. Member
  • ****
  • Posts: 305
  • I use FPC [main] 💪🐯💪
FpDebug/GDB class variables
« on: November 20, 2025, 08:35:26 pm »
I can't figure out how to add a class variable to Watches

FPC [main]
Lazarus [main]


Code: Pascal  [Select][+][-]
  1. program app;
  2.  
  3. type
  4.   TMyClass = class
  5.     class var
  6.       kek: Integer;
  7.   end;
  8.  
  9. begin
  10.   TMyClass.kek := 5;
  11.  
  12.   TMyClass.kek := 7;
  13.  
  14.   TMyClass.kek := 13;
  15. end.
🤔
I may seem rude - please don't take it personally

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11901
  • Debugger - SynEdit - and more
    • wiki
Re: FpDebug/GDB class variables
« Reply #1 on: November 20, 2025, 10:12:36 pm »
FPC doesn't really attribute them to the class in the debug info.

It creates a global variable $_static_tmyclass_KEK
(exact name depends on dwarf version)

But the watches wont accept the $.

FpDebug knows that, and deals with it. But currently (according to a quick test) ONLY if you are paused in a method of the class. (otherwise it does not get the classname, it apparently wont take the classname from the expression.

So if you are in procedure TMyClass.Foo then you can add KEK to the watches.




Actually, for DWarf2, fpc doesn't add the $.
So you can watch
  _static_tmyclass_kek


 

TinyPortal © 2005-2018