From b889db60c8650e708c8311a9a7b9a510c00709d2 Mon Sep 17 00:00:00 2001 From: joost Date: Tue, 8 Apr 2014 06:24:24 +0000 Subject: [PATCH] LazDebuggerFp (pure): Use pretty-printer to show watch-values git-svn-id: trunk@44645 - --- .../lazdebuggerfp/fpdebugdebugger.pas | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index 222b7b6f38..956fa9774d 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -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; @@ -143,14 +147,32 @@ begin end else begin - AWatchValue.Value := IntToStr(APasExpr.ResultValue.AsInteger); - AWatchValue.Validity := ddsValid; + 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);