Is it possible to see the value of a variant or property? lazarus / 12-Debugger ---------------------------------------------------------------------- markus_ja · 2016-06-16 07:45 Hello, so far I found in the internet, the lazarus debugger is not able to show the value of an variant variable or property. Is there any option, to investigate the content of such a variable or property? ---------------------------------------------------------------------- howardpc · 2016-06-16 07:54 One option is something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1; {$R *.res} uses LazLogger; var  v: variant; begin  v:=True;  DebugLn('v=',v);  v:=123.456;  DebugLn('v=',v);  v:='this is a variant';  DebugLn('v=',v);end. ---------------------------------------------------------------------- molly · 2016-06-16 08:21 Quote from: markus_ja on June 16, 2016, 09:45:54 amso far I found in the internet, the lazarus debugger is not able to show the value of an variant variable or property. Any reference ? QuoteIs there any option, to investigate the content of such a variable or property? When step debugging, i hover my mouse over the variant variable, use inspector to inspect the contents and/or add a watch on the variant variable. Seeing the responses from others, i must be interpreting something wrong here ? ---------------------------------------------------------------------- Michl · 2016-06-16 08:25 Quote from: markus_ja on June 16, 2016, 09:45:54 amthe lazarus debugger is not able to show the value of an variant variable or propertyA variable can be shown with the GDB, a property not. If you have something like:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TForm1 = class(TForm)...  private    FVari: Variant;  public    property Vari: Variant read FVari write FVari;  end;...procedure TForm1.Button1Click(Sender: TObject);begin  Vari := 'Test';  // <- Breakpoint  Vari := 1.234;  Vari := 789;  Vari := False;end;With + you can add "FVari" to your Watch List. If you set a breakpoint in the code above and you step through the code with , you will see the changes of FVari (Lazarus 1.6 with GBD 7.7.1). [Edit] molly was even faster. ---------------------------------------------------------------------- markus_ja · 2016-06-16 08:37 Hm ... in my test project I see the variant as well. But in my multithreaded REST server project, I was not able to see it in the debugger. Can it be, that in a multithreaded environment, the debugger has some issues? ---------------------------------------------------------------------- Thaddy · 2016-06-16 08:44 Yes. You will need a more recent GDB than the one that comes with Lazarus. ---------------------------------------------------------------------- Martin_fr · 2016-06-16 09:25 About properties: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Inspecting_data_t ypes_.28Watch.2FHint.29 ---------------------------------------------------------------------- markus_ja · 2016-06-16 13:10 Quote from: Thaddy on June 16, 2016, 10:44:32 amYes. You will need a more recent GDB than the one that comes with Lazarus. How to get / install the latest GDB debugger? ---------------------------------------------------------------------- Martin_fr · 2016-06-16 13:24 If you are on Windows, then look at our Sourceforge page. the 32 bit setup already comes with gdb 7.7. (You can also get that in the alternative gdb folder in win32) the 64 bit comes with an older and 7.7 can be downloaded (the alternative gdb folder in win64) 7.7 is not the latest gdb, but according to my tests, any later gdb has a higher likelihood of crashing. (I have testcases that crash 7.8 and up, but run on 7.7) ---------- gdb version does NOT affect what properties you can see. Not sure about variant, but I dont think that gdb version will make a diff. dwarf vs stabs may make a diff ---------------------------------------------------------------------- markus_ja · 2016-06-16 15:25 Thanks