[fpc-pascal] fpDebug extension for Visual Studio Code

Joost van der Sluis joost at cnoc.nl
Tue May 19 10:42:25 CEST 2020

On 5/19/20 12:22 AM, Martin Frb wrote:
> On 18/05/2020 23:43, Joost van der Sluis wrote:
>> All the basics should work, if someone could test it a bit that would 
>> be nice.
>> Threading-support is still very lacking, and how variables are 
>> presented is not really nice. I'll be working on that.
> While this can be changed in PascalBuilder, there are some considerations.
> Some of those may want to become configurable. So not sure yet.
> More likely the formatting may want to depend an arguments passed to the 
> functions.
> In the Lazarus IDE currently representation of the values is entirely to 
> the backend. And that is plain wrong. The IDE will have to have some 
> influence on that.
> I haven't yet given it much consideration. Just putting it out there for 
> thought....

Yes, you write about it earlier. Now it's time to discuss things.

Looking at the DAB-protocol I came to some new insights. Microsoft 
managed to create a simple interface which makes it possible for all 
kinds of debuggers to work with the same GUI. Just by adding an 
abstraction layer.

Only thing is that I missed a few functions and do not need others.

So I've added my own abstraction layer. Now it is in the FPDServer 
project, but I think it should be made part of fpDebug itself.

It is basically this class: (see 

   TDbgVariable = class
     FName: string;
     FValue: string;
     FType: string;
     FVisibleInScope: Boolean;
     FFlags: TStringArray;
     FAdditionalInfo: TDbgVariableList;
     FInheritedChildren: TDbgVariableList;
     FChildren: TDbgVariableList;
     property Name: string read FName write FName;
     property Value: string read FValue write FValue;
     property &Type: string read FType write FType;
     property VisibleInScope: Boolean read FVisibleInScope write 
     property Flags: TStringArray read FFlags write FFlags;
     property AdditionalInfo: TDbgVariableList read FAdditionalInfo;
     property InheritedChildren: TDbgVariableList read FInheritedChildren;
     property Children: TDbgVariableList read FChildren;

I think that we can give a frontend (Lazarus, Console, DAB) all the 
information it needs with this structure.

The advantage is that it is layered, so a GUI can collapse information. 
We could expand the TDbgVariableBuilder to create these structures.

For strings for example, we could add the length, string-type, 
binary-representation and character-set of the string in AdditionalInfo. 
In VS Code this info will end-up as a child of the variable, which a 
user could expand if needed.

A lot of the existing functionality can be used.



More information about the fpc-pascal mailing list