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