LazDebuggerFp (pure): Use pretty-printer to show watch-values

git-svn-id: trunk@44645 -
This commit is contained in:
joost 2014-04-08 06:24:24 +00:00
parent b618ff3fc2
commit b889db60c8

View File

@ -12,6 +12,7 @@ uses
FpDbgClasses,
FpDbgInfo,
FpErrorMessages,
FpPascalBuilder,
DbgIntfBaseTypes,
DbgIntfDebuggerBase,
FpPascalParser,
@ -71,11 +72,14 @@ type
TFPWatches = class(TWatchesSupplier)
private
FPrettyPrinter: TFpPascalPrettyPrinter;
protected
function FpDebugger: TFpDebugDebugger;
//procedure DoStateChange(const AOldState: TDBGState); override;
procedure InternalRequestData(AWatchValue: TWatchValue); override;
public
constructor Create(const ADebugger: TDebuggerIntf);
destructor Destroy; override;
end;
{ TFPRegisters }
@ -128,7 +132,7 @@ var
AContext: TFpDbgInfoContext;
AController: TDbgController;
APasExpr: TFpPascalExpression;
AVal: string;
begin
AController := FpDebugger.FDbgController;
@ -142,15 +146,33 @@ begin
AWatchValue.Validity := ddsError;
end
else
begin
FPrettyPrinter.AddressSize:=AContext.SizeOfAddress;
if FPrettyPrinter.PrintValue(AVal, APasExpr.ResultValue, []) then
begin
AWatchValue.Value := IntToStr(APasExpr.ResultValue.AsInteger);
AWatchValue.Validity := ddsValid;
end
else
AWatchValue.Validity := ddsInvalid;
end;
finally
APasExpr.Free;
end;
end;
constructor TFPWatches.Create(const ADebugger: TDebuggerIntf);
begin
inherited Create(ADebugger);
FPrettyPrinter := TFpPascalPrettyPrinter.Create(sizeof(pointer));
end;
destructor TFPWatches.Destroy;
begin
FPrettyPrinter.Free;
inherited Destroy;
end;
{ TFpDebugThread }
procedure TFpDebugThread.DoDebugLoopFinishedASync(Data: PtrInt);