Skip to content

Debug and IInterface -- Insufficient Dwarf info for Interfaces

  • Lazarus/FPC Version: <Lazarus 2.2.2 (rev lazarus_2_2_2) FPC 3.2.2 x86_64-win64-win32/win64>
  • Operating System: <Windows 11>
  • CPU / Bitness: <64 and/or 32 Bit>

What happens

The debug tool does not display property values when its source is an interface.

Hovering the mouse over the property displays the message: Type MyInterface has no component named MyProperty

What did you expect

It should display the information correctly as a property value, just as it does when using a class instead of an interface.

Steps to reproduce

program Project1;
program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  Classes, unit1
  { you can add units after this };

var
  Client: IClient;

begin
  Client := TClient.Create;
  Client.Name := 'Jacob';
  WriteLn(Client.Name); // the debug not show correct value here
  ReadLn;
end.

unit Unit1;

{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils;

type
  IClient = interface
    ['{5D02409F-B93B-4E32-BADB-6A99251305B8}']
    function GetName: String;
    procedure SetName(Value: String);
    property Name: String read GetName write SetName;
  end;

  TClient = class(TInterfacedObject, IClient)
  private
    FName: String;
  public
    function GetName: String;
    procedure SetName(Value: String);
  end;

implementation

function TClient.GetName: String;
begin
  Result := FName;
end;

procedure TClient.SetName(Value: String);
begin
  FName := Value;
end;

end.


EDIT

EDIT/AMEND by @martin_frb

The issue for FPC is, that the DWARF debug info for interfaces does not contain any details on the methods the interface has.

As for properties: @jvdsluis is working on a DWARF extension. I don't know if that currently includes interfaces, and how that is / would be affected by the missing info.

Edited by Martin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information