mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 00:58:13 +02:00
Debugger: more moving value-converters to LazDebuggerIntf.
This commit is contained in:
parent
d98c10ac7d
commit
9147be77ec
@ -46,6 +46,7 @@ type
|
||||
procedure Init; override;
|
||||
public
|
||||
class function GetName: String; override;
|
||||
function GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass; override;
|
||||
procedure Assign(ASource: TFpDbgValueConverter); override;
|
||||
function ConvertValue(ASourceValue: TFpValue;
|
||||
AnFpDebugger: TFpDebugDebuggerBase;
|
||||
@ -58,6 +59,12 @@ type
|
||||
property JsonTypenameKey: String read FJsonTypenameKey write FJsonTypenameKey;
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConverterJsonForDebugRegistryEntry }
|
||||
|
||||
TFpDbgValueConverterJsonForDebugRegistryEntry = class(TFpDbgValueConverterRegistryEntry)
|
||||
public
|
||||
class function GetConvertorClass: TClass; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -184,6 +191,11 @@ begin
|
||||
Result := drsCallJsonForDebug;
|
||||
end;
|
||||
|
||||
function TFpDbgValueConverterJsonForDebug.GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass;
|
||||
begin
|
||||
Result := TFpDbgValueConverterJsonForDebugRegistryEntry;
|
||||
end;
|
||||
|
||||
procedure TFpDbgValueConverterJsonForDebug.Assign(ASource: TFpDbgValueConverter);
|
||||
begin
|
||||
inherited Assign(ASource);
|
||||
@ -315,15 +327,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
type
|
||||
|
||||
{ TFpDbgValueConverterJsonForDebugRegistryEntry }
|
||||
|
||||
TFpDbgValueConverterJsonForDebugRegistryEntry = class(TFpDbgValueConverterRegistryEntry)
|
||||
public
|
||||
class function GetConvertorClass: TClass; override;
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConverterJsonForDebugRegistryEntry }
|
||||
|
||||
class function TFpDbgValueConverterJsonForDebugRegistryEntry.GetConvertorClass: TClass;
|
||||
|
@ -28,9 +28,10 @@ type
|
||||
procedure Init; virtual;
|
||||
public
|
||||
class function GetName: String; virtual; abstract;
|
||||
function GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass; virtual;
|
||||
constructor Create; virtual;
|
||||
procedure Assign(ASource: TFpDbgValueConverter); virtual;
|
||||
function CreateCopy: TFpDbgValueConverter; virtual;
|
||||
function CreateCopy: TLazDbgValueConverterIntf; virtual;
|
||||
function ConvertValue(ASourceValue: TFpValue;
|
||||
AnFpDebugger: TFpDebugDebuggerBase;
|
||||
AnExpressionScope: TFpDbgSymbolScope
|
||||
@ -65,21 +66,31 @@ type
|
||||
function GetProcAddrFromMgr(AnFpDebugger: TFpDebugDebuggerBase; AnExpressionScope: TFpDbgSymbolScope): TDbgPtr;
|
||||
public
|
||||
class function GetName: String; override;
|
||||
function GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass; override;
|
||||
function ConvertValue(ASourceValue: TFpValue;
|
||||
AnFpDebugger: TFpDebugDebuggerBase;
|
||||
AnExpressionScope: TFpDbgSymbolScope
|
||||
): TFpValue; override;
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConverterVariantToLStrRegistryEntry }
|
||||
|
||||
TFpDbgValueConverterVariantToLStrRegistryEntry = class(TFpDbgValueConverterRegistryEntry)
|
||||
public
|
||||
class function GetConvertorClass: TClass; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TFpDbgValueConverter }
|
||||
|
||||
function TFpDbgValueConverter.CreateCopy: TFpDbgValueConverter;
|
||||
function TFpDbgValueConverter.CreateCopy: TLazDbgValueConverterIntf;
|
||||
var
|
||||
c: TFpDbgValueConverter;
|
||||
begin
|
||||
Result := TFpDbgValueConverterClass(ClassType).Create;
|
||||
Result.Assign(Self);
|
||||
c := TFpDbgValueConverterClass(ClassType).Create;
|
||||
c.Assign(Self);
|
||||
Result := c;
|
||||
end;
|
||||
|
||||
procedure TFpDbgValueConverter.SetError(AnError: TFpError);
|
||||
@ -102,6 +113,11 @@ begin
|
||||
//
|
||||
end;
|
||||
|
||||
function TFpDbgValueConverter.GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass;
|
||||
begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
constructor TFpDbgValueConverter.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
@ -315,6 +331,11 @@ begin
|
||||
Result := drsCallSysVarToLStr;
|
||||
end;
|
||||
|
||||
function TFpDbgValueConverterVariantToLStr.GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass;
|
||||
begin
|
||||
Result := TFpDbgValueConverterVariantToLStrRegistryEntry;
|
||||
end;
|
||||
|
||||
function TFpDbgValueConverterVariantToLStr.ConvertValue(ASourceValue: TFpValue;
|
||||
AnFpDebugger: TFpDebugDebuggerBase; AnExpressionScope: TFpDbgSymbolScope
|
||||
): TFpValue;
|
||||
@ -435,15 +456,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
type
|
||||
|
||||
{ TFpDbgValueConverterVariantToLStrRegistryEntry }
|
||||
|
||||
TFpDbgValueConverterVariantToLStrRegistryEntry = class(TFpDbgValueConverterRegistryEntry)
|
||||
public
|
||||
class function GetConvertorClass: TClass; override;
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConverterVariantToLStrRegistryEntry }
|
||||
|
||||
class function TFpDbgValueConverterVariantToLStrRegistryEntry.GetConvertorClass: TClass;
|
||||
|
@ -10,6 +10,8 @@ uses
|
||||
|
||||
type
|
||||
TLazDbgValueConverterIntf = interface;
|
||||
TLazDbgValueConvertRegistryEntry = class;
|
||||
TLazDbgValueConvertRegistryEntryClass = class of TLazDbgValueConvertRegistryEntry;
|
||||
|
||||
TLazDbgValueConverterSettingsFrameIntf = interface
|
||||
procedure ReadFrom(AConvertor: TLazDbgValueConverterIntf);
|
||||
@ -22,7 +24,10 @@ type
|
||||
TLazDbgValueConverterIntf = interface
|
||||
procedure AddReference;
|
||||
procedure ReleaseReference;
|
||||
function CreateCopy: TLazDbgValueConverterIntf;
|
||||
|
||||
function GetObject: TObject;
|
||||
function GetRegistryEntry: TLazDbgValueConvertRegistryEntryClass;
|
||||
function GetSettingsFrame: TLazDbgValueConverterSettingsFrameIntf;
|
||||
end;
|
||||
|
||||
@ -59,7 +64,6 @@ type
|
||||
class function GetConvertorClass: TClass; virtual; abstract;
|
||||
class function GetDebuggerClass: TClass; virtual; abstract; // class of TDebuggerIntf
|
||||
end;
|
||||
TLazDbgValueConvertRegistryEntryClass = class of TLazDbgValueConvertRegistryEntry;
|
||||
|
||||
{ TLazDbgValueConvertRegistry }
|
||||
|
||||
|
@ -8,8 +8,7 @@ uses
|
||||
Classes, SysUtils, LazClasses, LazLoggerBase, IdeDebuggerWatchResult,
|
||||
IdeDebuggerFpDbgValueConv, IdeDebuggerWatchResultJSon, DbgIntfDebuggerBase,
|
||||
DbgIntfMiscClasses, LazDebuggerIntf, LazDebuggerTemplate,
|
||||
LazDebuggerIntfBaseTypes, LazDebuggerValueConverter, FpDebugValueConvertors,
|
||||
FpDebugConvDebugForJson;
|
||||
LazDebuggerIntfBaseTypes, LazDebuggerValueConverter, FpDebugConvDebugForJson;
|
||||
|
||||
type
|
||||
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, fgl, Laz2_XMLCfg, LazClasses, lazCollections,
|
||||
FpDebugValueConvertors, LazDebuggerValueConverter;
|
||||
LazDebuggerValueConverter;
|
||||
|
||||
type
|
||||
|
||||
@ -14,19 +14,19 @@ type
|
||||
|
||||
TIdeDbgValueConvertSelector = class(TFreeNotifyingObject, TLazDbgValueConvertSelectorIntf)
|
||||
private
|
||||
FConverter: TFpDbgValueConverter;
|
||||
FConverter: TLazDbgValueConverterIntf;
|
||||
FMatchTypeNames: TStrings;
|
||||
FEnabled: Boolean;
|
||||
FName: String;
|
||||
|
||||
procedure SetConverter(AValue: TFpDbgValueConverter);
|
||||
procedure SetConverter(AValue: TLazDbgValueConverterIntf);
|
||||
protected
|
||||
function GetBackendSpecificObject: TObject; deprecated;
|
||||
function GetConverter: TLazDbgValueConverterIntf;
|
||||
|
||||
function AllowedTypeNames: TStrings;
|
||||
public
|
||||
constructor Create(AConverter: TFpDbgValueConverter);
|
||||
constructor Create(AConverter: TLazDbgValueConverterIntf);
|
||||
destructor Destroy; override;
|
||||
|
||||
function CreateCopy: TIdeDbgValueConvertSelector;
|
||||
@ -34,7 +34,7 @@ type
|
||||
procedure LoadDataFromXMLConfig(const AConfig: TRttiXMLConfig; const APath: string);
|
||||
procedure SaveDataToXMLConfig(const AConfig: TRttiXMLConfig; const APath: string);
|
||||
published
|
||||
property Converter: TFpDbgValueConverter read FConverter write SetConverter;
|
||||
property Converter: TLazDbgValueConverterIntf read FConverter write SetConverter;
|
||||
property Enabled: Boolean read FEnabled write FEnabled;
|
||||
property Name: String read FName write FName;
|
||||
property MatchTypeNames: TStrings read FMatchTypeNames;
|
||||
@ -80,10 +80,11 @@ implementation
|
||||
|
||||
{ TIdeDbgValueConvertSelector }
|
||||
|
||||
procedure TIdeDbgValueConvertSelector.SetConverter(AValue: TFpDbgValueConverter);
|
||||
procedure TIdeDbgValueConvertSelector.SetConverter(AValue: TLazDbgValueConverterIntf);
|
||||
begin
|
||||
if FConverter = AValue then Exit;
|
||||
FConverter.ReleaseReference;
|
||||
if FConverter <> nil then
|
||||
FConverter.ReleaseReference;
|
||||
FConverter := AValue;
|
||||
if FConverter <> nil then
|
||||
FConverter.AddReference;
|
||||
@ -104,7 +105,7 @@ begin
|
||||
Result := FMatchTypeNames;
|
||||
end;
|
||||
|
||||
constructor TIdeDbgValueConvertSelector.Create(AConverter: TFpDbgValueConverter);
|
||||
constructor TIdeDbgValueConvertSelector.Create(AConverter: TLazDbgValueConverterIntf);
|
||||
begin
|
||||
inherited Create;
|
||||
Converter := AConverter;
|
||||
@ -128,7 +129,6 @@ end;
|
||||
|
||||
procedure TIdeDbgValueConvertSelector.Assign(ASource: TIdeDbgValueConvertSelector);
|
||||
begin
|
||||
|
||||
Converter := ASource.FConverter.CreateCopy;
|
||||
FMatchTypeNames.Assign(ASource.FMatchTypeNames);
|
||||
FName := ASource.FName;
|
||||
@ -139,7 +139,6 @@ procedure TIdeDbgValueConvertSelector.LoadDataFromXMLConfig(
|
||||
const AConfig: TRttiXMLConfig; const APath: string);
|
||||
var
|
||||
s: String;
|
||||
obj: TFpDbgValueConverter;
|
||||
RegEntry: TLazDbgValueConvertRegistryEntryClass;
|
||||
begin
|
||||
AConfig.ReadObject(APath + 'Filter/', Self);
|
||||
@ -150,9 +149,8 @@ begin
|
||||
if RegEntry = nil then
|
||||
exit;
|
||||
|
||||
obj := RegEntry.CreateValueConvertorIntf.GetObject as TFpDbgValueConverter;
|
||||
AConfig.ReadObject(APath + 'Conv/', obj);
|
||||
Converter := obj;
|
||||
Converter := RegEntry.CreateValueConvertorIntf;
|
||||
AConfig.ReadObject(APath + 'Conv/', Converter.GetObject);
|
||||
end;
|
||||
|
||||
procedure TIdeDbgValueConvertSelector.SaveDataToXMLConfig(
|
||||
@ -161,8 +159,8 @@ begin
|
||||
AConfig.WriteObject(APath + 'Filter/', Self);
|
||||
AConfig.SetDeleteValue(APath + 'Filter/MatchTypeNames', MatchTypeNames.CommaText, '');
|
||||
|
||||
AConfig.SetValue(APath + 'ConvClass', Converter.ClassName);
|
||||
AConfig.WriteObject(APath + 'Conv/', Converter);
|
||||
AConfig.SetValue(APath + 'ConvClass', Converter.GetObject.ClassName);
|
||||
AConfig.WriteObject(APath + 'Conv/', Converter.GetObject);
|
||||
end;
|
||||
|
||||
{ TIdeDbgValueConvertSelectorList }
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, ExtCtrls, StdCtrls, CheckLst, LCLIntf,
|
||||
Dialogs, StrUtils, FpDebugValueConvertors, LazDebuggerValueConverter,
|
||||
Dialogs, StrUtils, LazDebuggerValueConverter,
|
||||
IdeDebuggerStringConstants, IdeDebuggerFpDbgValueConv;
|
||||
|
||||
type
|
||||
@ -80,7 +80,7 @@ begin
|
||||
|
||||
FCurConvConf := nil;
|
||||
AvailClass := ValueConverterRegistry;
|
||||
obj := TIdeDbgValueConvertSelector.Create(AvailClass[0].CreateValueConvertorIntf.GetObject as TFpDbgValueConverter);
|
||||
obj := TIdeDbgValueConvertSelector.Create(AvailClass[0].CreateValueConvertorIntf);
|
||||
obj.Enabled := True;
|
||||
obj.Name := AName;
|
||||
// obj.MatchKinds := obj.Converter.GetSupportedKinds;
|
||||
@ -131,12 +131,12 @@ begin
|
||||
else
|
||||
SetCurConv(FValConvList[FCurIdx]);
|
||||
|
||||
lblDesc.Caption := FCurConvConf.Converter.GetName;
|
||||
lblDesc.Caption := FCurConvConf.Converter.GetRegistryEntry.GetName;
|
||||
EdName.Text := FCurConvConf.Name;
|
||||
memoTypeNames.Text := FCurConvConf.MatchTypeNames.Text;
|
||||
|
||||
AvailClass := ValueConverterRegistry;
|
||||
dropAction.ItemIndex := AvailClass.IndexOfConvertorClass(FCurConvConf.Converter.ClassType);
|
||||
dropAction.ItemIndex := AvailClass.IndexOfConvertorClass(FCurConvConf.Converter.GetObject.ClassType);
|
||||
|
||||
lstConvertersItemClick(nil, FCurIdx);
|
||||
end;
|
||||
@ -251,7 +251,7 @@ begin
|
||||
(EdName.Text <> FCurConvConf.Name)
|
||||
then begin
|
||||
FValConvList.Changed := True;
|
||||
FCurConvConf.Converter := TFpDbgValueConverter(FCurConv.GetObject);
|
||||
FCurConvConf.Converter := FCurConv;
|
||||
// FCurConvConf.MatchKinds := FCurConvConf.Converter.GetSupportedKinds;
|
||||
FCurConvConf.MatchTypeNames.Text := memoTypeNames.Text;
|
||||
FCurConvConf.Name := EdName.Text
|
||||
|
Loading…
Reference in New Issue
Block a user