FpDebug: partial implementation of "repeat count"

git-svn-id: trunk@44937 -
This commit is contained in:
martin 2014-05-06 19:32:25 +00:00
parent 31762452ae
commit c239838960

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, DbgIntfBaseTypes, DbgIntfDebuggerBase, FpDbgInfo, FpdMemoryTools, Classes, SysUtils, DbgIntfBaseTypes, DbgIntfDebuggerBase, FpDbgInfo, FpdMemoryTools,
FpErrorMessages, LazLoggerBase; FpErrorMessages, LazLoggerBase, LCLIntf;
type type
TTypeNameFlag = ( TTypeNameFlag = (
@ -46,14 +46,14 @@ type
AFlags: TFpPrettyPrintValueFlags; AFlags: TFpPrettyPrintValueFlags;
ANestLevel: Integer; AnIndent: String; ANestLevel: Integer; AnIndent: String;
ADisplayFormat: TWatchDisplayFormat; ADisplayFormat: TWatchDisplayFormat;
ARepaetCount: Integer = -1 ARepeatCount: Integer = -1
): Boolean; ): Boolean;
public public
constructor Create(AnAddressSize: Integer); constructor Create(AnAddressSize: Integer);
function PrintValue(out APrintedValue: String; function PrintValue(out APrintedValue: String;
AValue: TFpDbgValue; AValue: TFpDbgValue;
ADisplayFormat: TWatchDisplayFormat = wdfDefault; ADisplayFormat: TWatchDisplayFormat = wdfDefault;
ARepaetCount: Integer = -1 ARepeatCount: Integer = -1
): Boolean; ): Boolean;
property AddressSize: Integer read FAddressSize write FAddressSize; property AddressSize: Integer read FAddressSize write FAddressSize;
property MemManager: TFpDbgMemManager read FMemManager write FMemManager; property MemManager: TFpDbgMemManager read FMemManager write FMemManager;
@ -429,7 +429,7 @@ end;
function TFpPascalPrettyPrinter.InternalPrintValue(out APrintedValue: String; function TFpPascalPrettyPrinter.InternalPrintValue(out APrintedValue: String;
AValue: TFpDbgValue; AnAddressSize: Integer; AFlags: TFpPrettyPrintValueFlags; AValue: TFpDbgValue; AnAddressSize: Integer; AFlags: TFpPrettyPrintValueFlags;
ANestLevel: Integer; AnIndent: String; ADisplayFormat: TWatchDisplayFormat; ANestLevel: Integer; AnIndent: String; ADisplayFormat: TWatchDisplayFormat;
ARepaetCount: Integer): Boolean; ARepeatCount: Integer): Boolean;
function ResTypeName: String; function ResTypeName: String;
@ -669,9 +669,10 @@ function TFpPascalPrettyPrinter.InternalPrintValue(out APrintedValue: String;
Result := True; Result := True;
exit; exit;
end; end;
if (ANestLevel > 1) and (Cnt > 3) then Cnt := 3 If ARepeatCount > 0 then Cnt := ARepeatCount
else if (ANestLevel > 1) and (Cnt > 3) then Cnt := 3
else if (ANestLevel > 0) and (Cnt > 10) then Cnt := 10 else if (ANestLevel > 0) and (Cnt > 10) then Cnt := 10
else if (Cnt > 300) then Cnt := 300; else if (Cnt > 300) then Cnt := 300;
d := 0; d := 0;
// TODO: use valueobject for bounds // TODO: use valueobject for bounds
if (AValue.IndexTypeCount > 0) and AValue.IndexType[0].HasBounds then if (AValue.IndexTypeCount > 0) and AValue.IndexType[0].HasBounds then
@ -779,9 +780,13 @@ begin
end; end;
function TFpPascalPrettyPrinter.PrintValue(out APrintedValue: String; AValue: TFpDbgValue; function TFpPascalPrettyPrinter.PrintValue(out APrintedValue: String; AValue: TFpDbgValue;
ADisplayFormat: TWatchDisplayFormat; ARepaetCount: Integer): Boolean; ADisplayFormat: TWatchDisplayFormat; ARepeatCount: Integer): Boolean;
var
x: QWord;
begin begin
Result := InternalPrintValue(APrintedValue, AValue, AddressSize, [], 0, '', ADisplayFormat, ARepaetCount); x:= GetTickCount64;
Result := InternalPrintValue(APrintedValue, AValue, AddressSize, [], 0, '', ADisplayFormat, ARepeatCount);
debugln([' TFpPascalPrettyPrinter.PrintValue ', (GetTickCount64-x)/1000]);
end; end;
end. end.