Jump to content
DelphiDinosaur

Debugger Issue with Delphi 11.3 - Incorrect Evaluation of Breakpoint Results

Recommended Posts

After migrating our project from Delphi 10 to Delphi 11.3, we are experiencing a critical issue with the debugger functionality. The debugger is unable to correctly evaluate and display the result values when breakpoints are set.

Steps to Reproduce:

  • Migrate a project from Delphi 10 to Delphi 11.3.
  • Set a breakpoint on a function that returns a result, e.g., idx := IndexText('3', ['1', '2', '3']);.
  • Run the code in the Delphi 11.3 IDE.
  • Attempt to evaluate the return value of the function where the breakpoint is set, either by using a Watch or by hovering the mouse cursor over the function.
    program DelphiStrings;
    
    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      System.SysUtils,
      strutils;
    
    var idx : integer;
    begin
      try
        { TODO -oUser -cConsole Main : Insert code here }
        idx := IndexText('3',['1', '2', '3']);
        WriteLn( idx.ToString);
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.

    The debugger should correctly display the return value of the function at the breakpoint.

    Actual Result: The debugger displays random large integer numbers instead of the correct return value. This issue has been replicated on two different machines (see the screenshot for more details).

    Windows 11 64-bit Pro, Delphi 11.3 64-bit

 

 

0JhDJ.png

Edited by DelphiDinosaur

Share this post


Link to post
7 hours ago, DelphiDinosaur said:

After migrating our project from Delphi 10 to Delphi 11.3, we are experiencing a critical issue with the debugger functionality. The debugger is unable to correctly evaluate and display the result values when breakpoints are set.

Steps to Reproduce:

  • Migrate a project from Delphi 10 to Delphi 11.3.
  • Set a breakpoint on a function that returns a result, e.g., idx := IndexText('3', ['1', '2', '3']);.
  • Run the code in the Delphi 11.3 IDE.
  • Attempt to evaluate the return value of the function where the breakpoint is set, either by using a Watch or by hovering the mouse cursor over the function.
    
    program DelphiStrings;
    
    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      System.SysUtils,
      strutils;
    
    var idx : integer;
    begin
      try
        { TODO -oUser -cConsole Main : Insert code here }
        idx := IndexText('3',['1', '2', '3']);
        WriteLn( idx.ToString);
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.

    The debugger should correctly display the return value of the function at the breakpoint. 

 

 

Actually I would not expect that. The breakpoint is placed before the call statement to the IndexText funtion (check the assembly view) so the value of idx is unknown at that point;  you have to step over the call to the function to make the result available. If it worked in D10 I would consider it a bug there unless you have tooltip expression evaluation active, in which case the debugger may execute the call to get the result for the tooltip.

Share this post


Link to post
2 hours ago, PeterBelow said:

Actually I would not expect that. The breakpoint is placed before the call statement to the IndexText funtion (check the assembly view) so the value of idx is unknown at that point;  you have to step over the call to the function to make the result available. If it worked in D10 I would consider it a bug there unless you have tooltip expression evaluation active, in which case the debugger may execute the call to get the result for the tooltip.

See the screenshot again.

Share this post


Link to post
1 hour ago, Die Holländer said:

Like Peter said. Check your idx AFTER the call statement.

 

Tested in Delphi 11.3

 

image.png.343c725b5f1cd1cb7edee507295c2006.png


See the original question and the screenshot.

 

 

Share this post


Link to post
1 hour ago, Die Holländer said:

Like Peter said. Check your idx AFTER the call statement.

 

Tested in Delphi 11.3

 

image.png.343c725b5f1cd1cb7edee507295c2006.png

 

 

See the screenshot again.

 

Share this post


Link to post

Well, I tried your example in D12 ( Win32 target) and the evaluator rejected the expression outright:

image.thumb.png.a009b86b41c001f62ab0a0c91492eea0.png

 

Edit: Tried same project in D11.3, same result. I suggest you delete the dproj file carried over from D10 and open the dpr in D11.3 to recreate the dproj.

Edited by PeterBelow

Share this post


Link to post

Try this, the tool tip shows the index which can used to access the string. Done in 11.3

 

var idx : Integer;
const Nus: array of string = ['1', '2', '3'];
begin
  try
    { TODO -oUser -cConsole Main : Insert code here }
    idx := IndexText ('3',Nus);
    WriteLn( idx);
    Writeln(nus[idx]);
    Readln;

 

Share this post


Link to post

Looks like Evaluate/Modify does not like that dynamic array syntax in the expression. Quick test moving it outside and the expression  IndexText ('3',Nums)  evaluates at the breakpoint without problems.

    const Nums : array of string = ['1','2','3'];
    idx := IndexText('3',Nums);

 

Edited by Brian Evans

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×