Likely bug in Lazarus v1.8.2 (and maybe other versions) lazarus / 67-Windows ---------------------------------------------------------------------- 440bx · 2020-05-13 21:07 Hello, When debugging and hovering over a local nested variable that is "absolute"(d) on a variable that belongs to the containing function/procedure, the debugger does not show the correct variable value.  This is shown in the small test program: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 {$APPTYPE CONSOLE} { NOTE: this test program runs as intended under Windows ONLY                 } program NestedAbsolute;   type    BOOL = longbool;   function IsDebuggerPresent()         : BOOL; stdcall; external 'kernel32.dll';    { determines if the program is being run under a debugger                 }   procedure ProcedureA();  var    ProcedureAVariable : integer = 5;     procedure ProcedureB();    var    { absolute clause on nested variable                                  }       ProcedureBVariable : integer absolute ProcedureAVariable;     begin      { hover over ProcedureBVariable in the debugger                         }       writeln(ProcedureBVariable);    { hover on ProcedureBVariable         }                                      { it should show a value of 5         }       if IsDebuggerPresent() then asm int 3 end;       { execution stops here - hover over ProcedureBVariable now              }       writeln;    end;   begin    ProcedureB();  end; begin  ProcedureA();  { output is correct.  The compiler handles "absolute" correctly.   }   writeln('Press enter/return to end this program');  readln;end. ---------------------------------------------------------------------- Martin_fr · 2020-05-13 22:57 Just tested. (with fpc 3.0.4) It actually is a problem in the compiler. The generated DWARF info is incorrect. Local variables are encoded relative to the StackBasePointer. FPC repeats the literal dwarf info of ProcedureAVariable. But since ProcedureAVariable  is only correct when in the outer procedure, the literal copy is incorrect when in the nested procedure. ---------------------------------------------------------------------- 440bx · 2020-05-13 23:48 Quote from: Martin_fr on May 14, 2020, 12:57:29 amIt actually is a problem in the compiler. The generated DWARF info is incorrect. Thank you for checking it out and, I'm pleased you found the cause. Obviously, I don't know if the problem occurs in the trunk version.  I believe you probably have a trunk version available to test with.  Since not only the problem involves how the compiler generates DWARF information and, you obviously know a lot more about that than I do, I'll leave it at your discretion whether a bug report against the compiler should be created. ---------------------------------------------------------------------- Martin_fr · 2020-05-14 00:47 https://bugs.freepascal.org/view.php?id=37069 But the code is procedural. That is your domain ---------------------------------------------------------------------- jiaxing2 · 2020-05-14 06:16 Quote from: Martin_fr on May 14, 2020, 02:47:08 amhttps://bugs.freepascal.org/view.php?id=37069 But the code is procedural. That is your domain Great joke! ---------------------------------------------------------------------- BrunoK · 2020-05-14 11:20 Dont know if it is the same issue but hovering on absolute variables has never worked for me, CTRL-F7 does not show the absolute'd value either. 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;{$APPTYPE CONSOLE}var  ProcedureAVariable: integer = 5;  { absolute clause on variable }  ProcedureBVariable: integer absolute ProcedureAVariable;begin  WriteLn(ProcedureBVariable); // Hover on ProcedureBVariable                               //   displays : ProcedureBVariable = No symbol \"PROCEDUREBVARIABLE\" in current context.  writeln('Press enter/return to end this program');  readln;end. Lazarus trunk r. 63021 ~ 19.04.2020 (+/- some  changes) FPC 3.0.4 (the mac os one) from svn + some mods. Windows 10 Pro x64 usualy I386 mode. ---------------------------------------------------------------------- PascalDragon · 2020-05-14 11:26 Quote from: BrunoK on May 14, 2020, 01:20:49 pmDont know if it is the same issue but hovering on absolute variables has never worked for me, CTRL-F7 does not show the absolute'd value either. You need to make sure that you set the debug format to DWARF. For i386 the default is Stabs. ---------------------------------------------------------------------- BrunoK · 2020-05-14 15:18 Quote from: PascalDragon on May 14, 2020, 01:26:12 pmYou need to make sure that you set the debug format to DWARF. For i386 the default is Stabs. Your are right for my specific bit of code. Using -gw2 -godwarfsets (which I normally use but forgot for this program) effectively shows the absolute var. I must have experienced this type of problem in situations described in the OP situation, forget it.