LazDebuggerFpGdbmi: Add option for IntrinsicPrefix and "modeswitch AutoDeref" .

This commit is contained in:
Martin 2023-06-08 16:03:54 +02:00
parent 315be6c5e1
commit f9dd45a157

View File

@ -112,10 +112,27 @@ type
public public
class function Caption: String; override; class function Caption: String; override;
public public
class function CreateProperties: TDebuggerProperties; override; // Creates debuggerproperties
constructor Create(const AExternalDebugger: String); override; constructor Create(const AExternalDebugger: String); override;
destructor Destroy; override; destructor Destroy; override;
end; end;
{ TFpGDBMIDebuggerProperties }
TFpGDBMIDebuggerProperties = class(TGDBMIDebuggerProperties)
private
FAutoDeref: Boolean;
FIntrinsicPrefix: TFpIntrinsicPrefix;
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
published
property IntrinsicPrefix: TFpIntrinsicPrefix read FIntrinsicPrefix write FIntrinsicPrefix default ipColon;
property AutoDeref: Boolean read FAutoDeref write FAutoDeref default False;
end;
procedure Register; procedure Register;
implementation implementation
@ -1052,6 +1069,8 @@ begin
LockUnLoadDwarf; LockUnLoadDwarf;
PasExpr := TFpPascalExpression.Create(AExpression, Ctx); PasExpr := TFpPascalExpression.Create(AExpression, Ctx);
PasExpr.IntrinsicPrefix := TFpGDBMIDebuggerProperties(GetProperties).IntrinsicPrefix;
PasExpr.AutoDeref := TFpGDBMIDebuggerProperties(GetProperties).AutoDeref;
try try
if not IsWatchValueAlive then exit; if not IsWatchValueAlive then exit;
if AWatchValue <> nil then if AWatchValue <> nil then
@ -1088,6 +1107,8 @@ DebugLn(DBG_VERBOSE, [ErrorHandler.ErrorAsString(PasExpr.Error)]);
then begin then begin
if ResValue.GetInstanceClassName(CastName) then begin if ResValue.GetInstanceClassName(CastName) then begin
PasExpr2 := TFpPascalExpression.Create(CastName+'('+AExpression+')', Ctx); PasExpr2 := TFpPascalExpression.Create(CastName+'('+AExpression+')', Ctx);
PasExpr2.IntrinsicPrefix := TFpGDBMIDebuggerProperties(GetProperties).IntrinsicPrefix;
PasExpr2.AutoDeref := TFpGDBMIDebuggerProperties(GetProperties).AutoDeref;
PasExpr2.ResultValue; PasExpr2.ResultValue;
if PasExpr2.Valid then begin if PasExpr2.Valid then begin
PasExpr.Free; PasExpr.Free;
@ -1195,6 +1216,11 @@ begin
Result := 'GNU debugger (with fpdebug)'; Result := 'GNU debugger (with fpdebug)';
end; end;
class function TFpGDBMIDebugger.CreateProperties: TDebuggerProperties;
begin
Result := TFpGDBMIDebuggerProperties.Create;
end;
constructor TFpGDBMIDebugger.Create(const AExternalDebugger: String); constructor TFpGDBMIDebugger.Create(const AExternalDebugger: String);
begin begin
FWatchEvalList := TList.Create; FWatchEvalList := TList.Create;
@ -1211,6 +1237,24 @@ begin
inherited Destroy; inherited Destroy;
end; end;
{ TFpGDBMIDebuggerProperties }
constructor TFpGDBMIDebuggerProperties.Create;
begin
inherited Create;
FIntrinsicPrefix := ipColon;
FAutoDeref := False;
end;
procedure TFpGDBMIDebuggerProperties.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TFpGDBMIDebuggerProperties then begin
FIntrinsicPrefix:=TFpGDBMIDebuggerProperties(Source).FIntrinsicPrefix;
FAutoDeref:=TFpGDBMIDebuggerProperties(Source).FAutoDeref;
end;
end;
procedure Register; procedure Register;
begin begin
//RegisterDebugger(TFpGDBMIDebugger); //RegisterDebugger(TFpGDBMIDebugger);