Recent

Author Topic: Evaluate functions in the debugger  (Read 724 times)

paulvanderlinden

  • New Member
  • *
  • Posts: 14
Evaluate functions in the debugger
« on: July 14, 2022, 09:16:19 am »
Hi all,

Is it possible to see the result of a function in the evaluate window when debugging a program?
f.e. when stepping through
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. type
  3.  
  4.   { TClass }
  5.  
  6.   TClass=class
  7.     function Res:integer;
  8.   end;
  9.  
  10. { TClass }
  11.  
  12. function TClass.Res:integer;
  13. begin
  14.   Result := 42;
  15. end;
  16.  
  17. var C:TClass;
  18. begin
  19.   C := TClass.Create;
  20.   C.Res;
  21. end.
  22.  

If I try to see the value of C.Res I get a
"Type TCLASS has no component named RES."
Is this dependent on debugger/os/?? or is this not possible in general?

Paul

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

paulvanderlinden

  • New Member
  • *
  • Posts: 14
Re: Evaluate functions in the debugger
« Reply #2 on: July 14, 2022, 09:33:29 am »
Thanks!
Not the answer I was hoping for, but at least it clarifies it

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Evaluate functions in the debugger
« Reply #3 on: July 14, 2022, 10:51:41 am »
Yes, for some functions. (only retuning, int or ordinal value / not returning string or managed types / strings work in trunk when using dwarf-3)

Tools > Debugger > General: enable function calling
And enable for each watch individually in its properties.

Should work if the function body is in your code. And in case of methods, in the same unit.



If I try to see the value of C.Res I get a
"Type TCLASS has no component named RES."
Is this dependent on debugger/os/?? or is this not possible in general?

Only with FpDebug (tools > debugger > backend)

On Win 64/32 and Linux 64.  (And Linux 32 bit with Lazarus 2.3 main-branch)
« Last Edit: July 14, 2022, 11:06:19 am by Martin_fr »

 

TinyPortal © 2005-2018