mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 07:36:14 +02:00
Debugger: Move TWatchValue to IdeDebugger
This commit is contained in:
parent
d1ac568e96
commit
6f2adbbcb2
@ -620,50 +620,6 @@ type
|
|||||||
|
|
||||||
TWatchesMonitor = class;
|
TWatchesMonitor = class;
|
||||||
|
|
||||||
{ TWatchValue }
|
|
||||||
|
|
||||||
TWatchValue = class(TFreeNotifyingObject, TWatchValueIntf)
|
|
||||||
private
|
|
||||||
FTypeInfo: TDBGType;
|
|
||||||
FValue: String;
|
|
||||||
FValidity: TDebuggerDataState;
|
|
||||||
|
|
||||||
function GetDisplayFormat: TWatchDisplayFormat;
|
|
||||||
function GetEvaluateFlags: TWatcheEvaluateFlags;
|
|
||||||
function GetRepeatCount: Integer;
|
|
||||||
function GetStackFrame: Integer;
|
|
||||||
function GetThreadId: Integer;
|
|
||||||
function GetValidity: TDebuggerDataState;
|
|
||||||
procedure SetValidity(AValue: TDebuggerDataState); virtual;
|
|
||||||
procedure SetValue(AValue: String);
|
|
||||||
procedure SetTypeInfo(AValue: TDBGType);
|
|
||||||
procedure SetTypeInfo(AValue: TDBGTypeBase);
|
|
||||||
protected
|
|
||||||
FDisplayFormat: TWatchDisplayFormat;
|
|
||||||
FEvaluateFlags: TWatcheEvaluateFlags;
|
|
||||||
FRepeatCount: Integer;
|
|
||||||
FStackFrame: Integer;
|
|
||||||
FThreadId: Integer;
|
|
||||||
procedure DoDataValidityChanged({%H-}AnOldValidity: TDebuggerDataState); virtual;
|
|
||||||
|
|
||||||
function GetExpression: String; virtual; abstract;
|
|
||||||
function GetTypeInfo: TDBGType; virtual;
|
|
||||||
function GetValue: String; virtual;
|
|
||||||
public
|
|
||||||
destructor Destroy; override;
|
|
||||||
procedure Assign(AnOther: TWatchValue); virtual;
|
|
||||||
property DisplayFormat: TWatchDisplayFormat read GetDisplayFormat;
|
|
||||||
property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags;
|
|
||||||
property RepeatCount: Integer read GetRepeatCount;
|
|
||||||
property ThreadId: Integer read GetThreadId;
|
|
||||||
property StackFrame: Integer read GetStackFrame;
|
|
||||||
property Expression: String read GetExpression;
|
|
||||||
public
|
|
||||||
property Validity: TDebuggerDataState read GetValidity write SetValidity;
|
|
||||||
property Value: String read GetValue write SetValue;
|
|
||||||
property TypeInfo: TDBGType read GetTypeInfo write SetTypeInfo;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TWatchesSupplier }
|
{ TWatchesSupplier }
|
||||||
|
|
||||||
TWatchesSupplier = class(TDebuggerDataSupplier)
|
TWatchesSupplier = class(TDebuggerDataSupplier)
|
||||||
@ -2690,98 +2646,6 @@ begin
|
|||||||
Result := FUpdateCount > 0;
|
Result := FUpdateCount > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWatchValue }
|
|
||||||
|
|
||||||
procedure TWatchValue.SetValidity(AValue: TDebuggerDataState);
|
|
||||||
var
|
|
||||||
OldValidity: TDebuggerDataState;
|
|
||||||
begin
|
|
||||||
if FValidity = AValue then exit;
|
|
||||||
//DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TWatchValue.SetValidity: FThreadId=', FThreadId, ' FStackFrame=',FStackFrame, ' Expr=', Expression, ' AValidity=',dbgs(AValue)]);
|
|
||||||
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TWatchValue.SetValidity: Expr=', Expression, ' AValidity=',dbgs(AValue)]);
|
|
||||||
OldValidity := FValidity;
|
|
||||||
FValidity := AValue;
|
|
||||||
DoDataValidityChanged(OldValidity);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetValidity: TDebuggerDataState;
|
|
||||||
begin
|
|
||||||
Result := FValidity;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetStackFrame: Integer;
|
|
||||||
begin
|
|
||||||
Result := FStackFrame;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetEvaluateFlags: TWatcheEvaluateFlags;
|
|
||||||
begin
|
|
||||||
Result := FEvaluateFlags;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetDisplayFormat: TWatchDisplayFormat;
|
|
||||||
begin
|
|
||||||
Result := FDisplayFormat;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetRepeatCount: Integer;
|
|
||||||
begin
|
|
||||||
Result := FRepeatCount;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetThreadId: Integer;
|
|
||||||
begin
|
|
||||||
Result := FThreadId;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWatchValue.SetValue(AValue: String);
|
|
||||||
begin
|
|
||||||
if FValue = AValue then exit;
|
|
||||||
//asser not immutable
|
|
||||||
FValue := AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWatchValue.SetTypeInfo(AValue: TDBGType);
|
|
||||||
begin
|
|
||||||
//assert(Self is TCurrentWatchValue, 'TWatchValue.SetTypeInfo');
|
|
||||||
FreeAndNil(FTypeInfo);
|
|
||||||
FTypeInfo := AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWatchValue.SetTypeInfo(AValue: TDBGTypeBase);
|
|
||||||
begin
|
|
||||||
SetTypeInfo(TDBGType(AValue));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWatchValue.DoDataValidityChanged(AnOldValidity: TDebuggerDataState);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetTypeInfo: TDBGType;
|
|
||||||
begin
|
|
||||||
Result := FTypeInfo;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchValue.GetValue: String;
|
|
||||||
begin
|
|
||||||
Result := FValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TWatchValue.Destroy;
|
|
||||||
begin
|
|
||||||
inherited Destroy;
|
|
||||||
FreeAndNil(FTypeInfo);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWatchValue.Assign(AnOther: TWatchValue);
|
|
||||||
begin
|
|
||||||
FreeAndNil(FTypeInfo);
|
|
||||||
//FTypeInfo := TWatchValue(AnOther).FTypeInfo.cre;
|
|
||||||
FValue := AnOther.FValue;
|
|
||||||
FValidity := AnOther.FValidity;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TRegisterSupplier }
|
{ TRegisterSupplier }
|
||||||
|
|
||||||
function TRegisterSupplier.GetCurrentRegistersList: TRegistersList;
|
function TRegisterSupplier.GetCurrentRegistersList: TRegistersList;
|
||||||
|
@ -76,7 +76,7 @@ type
|
|||||||
|
|
||||||
{ TTestWatchValue }
|
{ TTestWatchValue }
|
||||||
|
|
||||||
TTestWatchValue = class(TGuiWatchValue)
|
TTestWatchValue = class(TWatchValue)
|
||||||
protected
|
protected
|
||||||
procedure RequestData;
|
procedure RequestData;
|
||||||
function GetTypeInfo: TDBGType; override;
|
function GetTypeInfo: TDBGType; override;
|
||||||
@ -93,8 +93,8 @@ type
|
|||||||
|
|
||||||
TTestWatchValueList = class(TWatchValueList)
|
TTestWatchValueList = class(TWatchValueList)
|
||||||
protected
|
protected
|
||||||
function CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue; override;
|
function CopyEntry(AnEntry: TWatchValue): TWatchValue; override;
|
||||||
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TGuiWatchValue; override;
|
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TWatchValue; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TTestWatch }
|
{ TTestWatch }
|
||||||
@ -112,7 +112,7 @@ type
|
|||||||
protected
|
protected
|
||||||
FMonitor: TTestWatchesMonitor;
|
FMonitor: TTestWatchesMonitor;
|
||||||
function WatchClass: TWatchClass; override;
|
function WatchClass: TWatchClass; override;
|
||||||
procedure RequestData(AWatchValue: TGuiWatchValue);
|
procedure RequestData(AWatchValue: TWatchValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TTestWatchesMonitor }
|
{ TTestWatchesMonitor }
|
||||||
@ -122,7 +122,7 @@ type
|
|||||||
FWatches: TWatches;
|
FWatches: TWatches;
|
||||||
protected
|
protected
|
||||||
procedure DoStateChangeEx(const AOldState, ANewState: TDBGState); override;
|
procedure DoStateChangeEx(const AOldState, ANewState: TDBGState); override;
|
||||||
procedure RequestData(AWatchValue: TGuiWatchValue);
|
procedure RequestData(AWatchValue: TWatchValue);
|
||||||
function CreateWatches: TWatches;
|
function CreateWatches: TWatches;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -317,7 +317,7 @@ begin
|
|||||||
Result := TTestWatch;
|
Result := TTestWatch;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestWatches.RequestData(AWatchValue: TGuiWatchValue);
|
procedure TTestWatches.RequestData(AWatchValue: TWatchValue);
|
||||||
begin
|
begin
|
||||||
TTestWatchesMonitor(FMonitor).RequestData(AWatchValue);
|
TTestWatchesMonitor(FMonitor).RequestData(AWatchValue);
|
||||||
end;
|
end;
|
||||||
@ -330,7 +330,7 @@ begin
|
|||||||
Watches.ClearValues;
|
Watches.ClearValues;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestWatchesMonitor.RequestData(AWatchValue: TGuiWatchValue);
|
procedure TTestWatchesMonitor.RequestData(AWatchValue: TWatchValue);
|
||||||
begin
|
begin
|
||||||
if Supplier <> nil
|
if Supplier <> nil
|
||||||
then Supplier.RequestData(AWatchValue)
|
then Supplier.RequestData(AWatchValue)
|
||||||
@ -369,7 +369,7 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
if not Watch.Enabled then
|
if not Watch.Enabled then
|
||||||
exit;
|
exit;
|
||||||
i := DbgStateChangeCounter; // workaround for state changes during TGuiWatchValue.GetValue
|
i := DbgStateChangeCounter; // workaround for state changes during TWatchValue.GetValue
|
||||||
if Validity = ddsUnknown then begin
|
if Validity = ddsUnknown then begin
|
||||||
Validity := ddsRequested;
|
Validity := ddsRequested;
|
||||||
RequestData;
|
RequestData;
|
||||||
@ -392,7 +392,7 @@ begin
|
|||||||
Result := '<disabled>';
|
Result := '<disabled>';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
i := DbgStateChangeCounter; // workaround for state changes during TGuiWatchValue.GetValue
|
i := DbgStateChangeCounter; // workaround for state changes during TWatchValue.GetValue
|
||||||
if Validity = ddsUnknown then begin
|
if Validity = ddsUnknown then begin
|
||||||
Result := '<evaluating>';
|
Result := '<evaluating>';
|
||||||
Validity := ddsRequested;
|
Validity := ddsRequested;
|
||||||
@ -431,14 +431,14 @@ end;
|
|||||||
|
|
||||||
{ TTestWatchValueList }
|
{ TTestWatchValueList }
|
||||||
|
|
||||||
function TTestWatchValueList.CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue;
|
function TTestWatchValueList.CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := TTestWatchValue.Create(Watch);
|
Result := TTestWatchValue.Create(Watch);
|
||||||
Result.Assign(AnEntry);
|
Result.Assign(AnEntry);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTestWatchValueList.CreateEntry(const AThreadId: Integer;
|
function TTestWatchValueList.CreateEntry(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TGuiWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := TTestWatchValue.Create(Watch, AThreadId, AStackFrame);
|
Result := TTestWatchValue.Create(Watch, AThreadId, AStackFrame);
|
||||||
Add(Result);
|
Add(Result);
|
||||||
|
@ -587,7 +587,7 @@ type
|
|||||||
|
|
||||||
{ TIdeWatchValue }
|
{ TIdeWatchValue }
|
||||||
|
|
||||||
TIdeWatchValue = class(TGuiWatchValue)
|
TIdeWatchValue = class(TWatchValue)
|
||||||
private
|
private
|
||||||
function GetWatch: TIdeWatch;
|
function GetWatch: TIdeWatch;
|
||||||
protected
|
protected
|
||||||
@ -618,7 +618,7 @@ type
|
|||||||
function GetEntryByIdx(AnIndex: integer): TIdeWatchValue;
|
function GetEntryByIdx(AnIndex: integer): TIdeWatchValue;
|
||||||
function GetWatch: TIdeWatch;
|
function GetWatch: TIdeWatch;
|
||||||
protected
|
protected
|
||||||
function CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue; override;
|
function CopyEntry(AnEntry: TWatchValue): TWatchValue; override;
|
||||||
procedure LoadDataFromXMLConfig(const AConfig: TXMLConfig;
|
procedure LoadDataFromXMLConfig(const AConfig: TXMLConfig;
|
||||||
APath: string);
|
APath: string);
|
||||||
procedure SaveDataToXMLConfig(const AConfig: TXMLConfig;
|
procedure SaveDataToXMLConfig(const AConfig: TXMLConfig;
|
||||||
@ -3310,7 +3310,7 @@ begin
|
|||||||
Result := TIdeWatch(inherited Watch);
|
Result := TIdeWatch(inherited Watch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIdeWatchValueList.CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue;
|
function TIdeWatchValueList.CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := TIdeWatchValue.Create(Watch);
|
Result := TIdeWatchValue.Create(Watch);
|
||||||
Result.Assign(AnEntry);
|
Result.Assign(AnEntry);
|
||||||
@ -3350,7 +3350,7 @@ begin
|
|||||||
inherited Create(AOwnerWatch);
|
inherited Create(AOwnerWatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGuiWatchValue }
|
{ TWatchValue }
|
||||||
|
|
||||||
function TIdeWatchValue.GetValue: String;
|
function TIdeWatchValue.GetValue: String;
|
||||||
var
|
var
|
||||||
@ -3359,7 +3359,7 @@ begin
|
|||||||
Result := '';
|
Result := '';
|
||||||
if not Watch.Enabled then
|
if not Watch.Enabled then
|
||||||
exit('<disabled>');
|
exit('<disabled>');
|
||||||
i := DbgStateChangeCounter; // workaround for state changes during TGuiWatchValue.GetValue
|
i := DbgStateChangeCounter; // workaround for state changes during TWatchValue.GetValue
|
||||||
if Validity = ddsUnknown then begin
|
if Validity = ddsUnknown then begin
|
||||||
Result := '<evaluating>';
|
Result := '<evaluating>';
|
||||||
Validity := ddsRequested;
|
Validity := ddsRequested;
|
||||||
@ -3388,7 +3388,7 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
if not Watch.Enabled then
|
if not Watch.Enabled then
|
||||||
exit;
|
exit;
|
||||||
i := DbgStateChangeCounter; // workaround for state changes during TGuiWatchValue.GetValue
|
i := DbgStateChangeCounter; // workaround for state changes during TWatchValue.GetValue
|
||||||
if Validity = ddsUnknown then begin
|
if Validity = ddsUnknown then begin
|
||||||
Validity := ddsRequested;
|
Validity := ddsRequested;
|
||||||
RequestData;
|
RequestData;
|
||||||
|
@ -5,23 +5,58 @@ unit IdeDebuggerBase;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils, DbgIntfDebuggerBase, DbgIntfMiscClasses, LazClasses,
|
||||||
DbgIntfDebuggerBase, DbgIntfMiscClasses, LazDebuggerIntf;
|
LazLoggerBase, LazDebuggerIntf;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TWatch = class;
|
TWatch = class;
|
||||||
|
|
||||||
{ TGuiWatchValue }
|
{ TWatchValue }
|
||||||
|
|
||||||
TGuiWatchValue = class(TWatchValue)
|
TWatchValue = class(TFreeNotifyingObject, TWatchValueIntf)
|
||||||
private
|
private
|
||||||
FWatch: TWatch;
|
FWatch: TWatch;
|
||||||
|
FTypeInfo: TDBGType;
|
||||||
|
FValue: String;
|
||||||
|
FValidity: TDebuggerDataState;
|
||||||
|
|
||||||
|
function GetDisplayFormat: TWatchDisplayFormat;
|
||||||
|
function GetEvaluateFlags: TWatcheEvaluateFlags;
|
||||||
|
function GetRepeatCount: Integer;
|
||||||
|
function GetStackFrame: Integer;
|
||||||
|
function GetThreadId: Integer;
|
||||||
|
function GetValidity: TDebuggerDataState;
|
||||||
|
procedure SetValidity(AValue: TDebuggerDataState); virtual;
|
||||||
|
procedure SetValue(AValue: String);
|
||||||
|
procedure SetTypeInfo(AValue: TDBGType);
|
||||||
|
procedure SetTypeInfo(AValue: TDBGTypeBase);
|
||||||
protected
|
protected
|
||||||
function GetExpression: String; override;
|
FDisplayFormat: TWatchDisplayFormat;
|
||||||
|
FEvaluateFlags: TWatcheEvaluateFlags;
|
||||||
|
FRepeatCount: Integer;
|
||||||
|
FStackFrame: Integer;
|
||||||
|
FThreadId: Integer;
|
||||||
|
procedure DoDataValidityChanged({%H-}AnOldValidity: TDebuggerDataState); virtual;
|
||||||
|
|
||||||
|
function GetExpression: String; virtual;
|
||||||
|
function GetTypeInfo: TDBGType; virtual;
|
||||||
|
function GetValue: String; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwnerWatch: TWatch);
|
constructor Create(AOwnerWatch: TWatch);
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure Assign(AnOther: TWatchValue); virtual;
|
||||||
|
property DisplayFormat: TWatchDisplayFormat read GetDisplayFormat;
|
||||||
|
property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags;
|
||||||
|
property RepeatCount: Integer read GetRepeatCount;
|
||||||
|
property ThreadId: Integer read GetThreadId;
|
||||||
|
property StackFrame: Integer read GetStackFrame;
|
||||||
|
property Expression: String read GetExpression;
|
||||||
|
public
|
||||||
property Watch: TWatch read FWatch;
|
property Watch: TWatch read FWatch;
|
||||||
|
property Validity: TDebuggerDataState read GetValidity write SetValidity;
|
||||||
|
property Value: String read GetValue write SetValue;
|
||||||
|
property TypeInfo: TDBGType read GetTypeInfo write SetTypeInfo;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWatchValueList }
|
{ TWatchValueList }
|
||||||
@ -30,20 +65,20 @@ type
|
|||||||
private
|
private
|
||||||
FList: TList;
|
FList: TList;
|
||||||
FWatch: TWatch;
|
FWatch: TWatch;
|
||||||
function GetEntry(const AThreadId: Integer; const AStackFrame: Integer): TGuiWatchValue;
|
function GetEntry(const AThreadId: Integer; const AStackFrame: Integer): TWatchValue;
|
||||||
function GetEntryByIdx(AnIndex: integer): TGuiWatchValue;
|
function GetEntryByIdx(AnIndex: integer): TWatchValue;
|
||||||
protected
|
protected
|
||||||
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TGuiWatchValue; virtual;
|
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TWatchValue; virtual;
|
||||||
function CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue; virtual;
|
function CopyEntry(AnEntry: TWatchValue): TWatchValue; virtual;
|
||||||
public
|
public
|
||||||
procedure Assign(AnOther: TWatchValueList);
|
procedure Assign(AnOther: TWatchValueList);
|
||||||
constructor Create(AOwnerWatch: TWatch);
|
constructor Create(AOwnerWatch: TWatch);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Add(AnEntry: TGuiWatchValue);
|
procedure Add(AnEntry: TWatchValue);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Count: Integer;
|
function Count: Integer;
|
||||||
property EntriesByIdx[AnIndex: integer]: TGuiWatchValue read GetEntryByIdx;
|
property EntriesByIdx[AnIndex: integer]: TWatchValue read GetEntryByIdx;
|
||||||
property Entries[const AThreadId: Integer; const AStackFrame: Integer]: TGuiWatchValue
|
property Entries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||||
read GetEntry; default;
|
read GetEntry; default;
|
||||||
property Watch: TWatch read FWatch;
|
property Watch: TWatch read FWatch;
|
||||||
end;
|
end;
|
||||||
@ -58,7 +93,7 @@ type
|
|||||||
procedure SetEvaluateFlags(AValue: TWatcheEvaluateFlags);
|
procedure SetEvaluateFlags(AValue: TWatcheEvaluateFlags);
|
||||||
procedure SetExpression(AValue: String);
|
procedure SetExpression(AValue: String);
|
||||||
procedure SetRepeatCount(AValue: Integer);
|
procedure SetRepeatCount(AValue: Integer);
|
||||||
function GetValue(const AThreadId: Integer; const AStackFrame: Integer): TGuiWatchValue;
|
function GetValue(const AThreadId: Integer; const AStackFrame: Integer): TWatchValue;
|
||||||
protected
|
protected
|
||||||
FEnabled: Boolean;
|
FEnabled: Boolean;
|
||||||
FEvaluateFlags: TWatcheEvaluateFlags;
|
FEvaluateFlags: TWatcheEvaluateFlags;
|
||||||
@ -83,7 +118,7 @@ type
|
|||||||
property DisplayFormat: TWatchDisplayFormat read FDisplayFormat write SetDisplayFormat;
|
property DisplayFormat: TWatchDisplayFormat read FDisplayFormat write SetDisplayFormat;
|
||||||
property EvaluateFlags: TWatcheEvaluateFlags read FEvaluateFlags write SetEvaluateFlags;
|
property EvaluateFlags: TWatcheEvaluateFlags read FEvaluateFlags write SetEvaluateFlags;
|
||||||
property RepeatCount: Integer read FRepeatCount write SetRepeatCount;
|
property RepeatCount: Integer read FRepeatCount write SetRepeatCount;
|
||||||
property Values[const AThreadId: Integer; const AStackFrame: Integer]: TGuiWatchValue
|
property Values[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||||
read GetValue;
|
read GetValue;
|
||||||
end;
|
end;
|
||||||
TWatchClass = class of TWatch;
|
TWatchClass = class of TWatch;
|
||||||
@ -105,19 +140,112 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TGuiWatchValue }
|
var
|
||||||
|
DBG_DATA_MONITORS: PLazLoggerLogGroup;
|
||||||
|
|
||||||
function TGuiWatchValue.GetExpression: String;
|
{ TWatchValue }
|
||||||
|
|
||||||
|
procedure TWatchValue.SetValidity(AValue: TDebuggerDataState);
|
||||||
|
var
|
||||||
|
OldValidity: TDebuggerDataState;
|
||||||
|
begin
|
||||||
|
if FValidity = AValue then exit;
|
||||||
|
//DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TWatchValue.SetValidity: FThreadId=', FThreadId, ' FStackFrame=',FStackFrame, ' Expr=', Expression, ' AValidity=',dbgs(AValue)]);
|
||||||
|
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TWatchValue.SetValidity: Expr=', Expression, ' AValidity=',dbgs(AValue)]);
|
||||||
|
OldValidity := FValidity;
|
||||||
|
FValidity := AValue;
|
||||||
|
DoDataValidityChanged(OldValidity);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetValidity: TDebuggerDataState;
|
||||||
|
begin
|
||||||
|
Result := FValidity;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetStackFrame: Integer;
|
||||||
|
begin
|
||||||
|
Result := FStackFrame;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetEvaluateFlags: TWatcheEvaluateFlags;
|
||||||
|
begin
|
||||||
|
Result := FEvaluateFlags;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetDisplayFormat: TWatchDisplayFormat;
|
||||||
|
begin
|
||||||
|
Result := FDisplayFormat;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetRepeatCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := FRepeatCount;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetThreadId: Integer;
|
||||||
|
begin
|
||||||
|
Result := FThreadId;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWatchValue.SetValue(AValue: String);
|
||||||
|
begin
|
||||||
|
if FValue = AValue then exit;
|
||||||
|
//asser not immutable
|
||||||
|
FValue := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWatchValue.SetTypeInfo(AValue: TDBGType);
|
||||||
|
begin
|
||||||
|
//assert(Self is TCurrentWatchValue, 'TWatchValue.SetTypeInfo');
|
||||||
|
FreeAndNil(FTypeInfo);
|
||||||
|
FTypeInfo := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWatchValue.SetTypeInfo(AValue: TDBGTypeBase);
|
||||||
|
begin
|
||||||
|
SetTypeInfo(TDBGType(AValue));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWatchValue.DoDataValidityChanged(AnOldValidity: TDebuggerDataState);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetExpression: String;
|
||||||
begin
|
begin
|
||||||
Result := FWatch.Expression;
|
Result := FWatch.Expression;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TGuiWatchValue.Create(AOwnerWatch: TWatch);
|
function TWatchValue.GetTypeInfo: TDBGType;
|
||||||
|
begin
|
||||||
|
Result := FTypeInfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWatchValue.GetValue: String;
|
||||||
|
begin
|
||||||
|
Result := FValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TWatchValue.Create(AOwnerWatch: TWatch);
|
||||||
begin
|
begin
|
||||||
FWatch := AOwnerWatch;
|
FWatch := AOwnerWatch;
|
||||||
inherited Create;
|
inherited Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
destructor TWatchValue.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
FreeAndNil(FTypeInfo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWatchValue.Assign(AnOther: TWatchValue);
|
||||||
|
begin
|
||||||
|
FreeAndNil(FTypeInfo);
|
||||||
|
//FTypeInfo := TWatchValue(AnOther).FTypeInfo.cre;
|
||||||
|
FValue := AnOther.FValue;
|
||||||
|
FValidity := AnOther.FValidity;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatch }
|
{ TWatch }
|
||||||
|
|
||||||
procedure TWatch.SetDisplayFormat(AValue: TWatchDisplayFormat);
|
procedure TWatch.SetDisplayFormat(AValue: TWatchDisplayFormat);
|
||||||
@ -163,7 +291,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatch.GetValue(const AThreadId: Integer;
|
function TWatch.GetValue(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TGuiWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := FValueList[AThreadId, AStackFrame];
|
Result := FValueList[AThreadId, AStackFrame];
|
||||||
end;
|
end;
|
||||||
@ -271,13 +399,13 @@ end;
|
|||||||
{ TWatchValueList }
|
{ TWatchValueList }
|
||||||
|
|
||||||
function TWatchValueList.GetEntry(const AThreadId: Integer;
|
function TWatchValueList.GetEntry(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TGuiWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
i := FList.Count - 1;
|
i := FList.Count - 1;
|
||||||
while i >= 0 do begin
|
while i >= 0 do begin
|
||||||
Result := TGuiWatchValue(FList[i]);
|
Result := TWatchValue(FList[i]);
|
||||||
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
|
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
|
||||||
(Result.DisplayFormat = FWatch.DisplayFormat) and
|
(Result.DisplayFormat = FWatch.DisplayFormat) and
|
||||||
(Result.RepeatCount = FWatch.RepeatCount) and
|
(Result.RepeatCount = FWatch.RepeatCount) and
|
||||||
@ -289,20 +417,20 @@ begin
|
|||||||
Result := CreateEntry(AThreadId, AStackFrame);
|
Result := CreateEntry(AThreadId, AStackFrame);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchValueList.GetEntryByIdx(AnIndex: integer): TGuiWatchValue;
|
function TWatchValueList.GetEntryByIdx(AnIndex: integer): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := TGuiWatchValue(FList[AnIndex]);
|
Result := TWatchValue(FList[AnIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchValueList.CreateEntry(const AThreadId: Integer;
|
function TWatchValueList.CreateEntry(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TGuiWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchValueList.CopyEntry(AnEntry: TGuiWatchValue): TGuiWatchValue;
|
function TWatchValueList.CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
||||||
begin
|
begin
|
||||||
Result := TGuiWatchValue.Create(FWatch);
|
Result := TWatchValue.Create(FWatch);
|
||||||
Result.Assign(AnEntry);
|
Result.Assign(AnEntry);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -312,7 +440,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Clear;
|
Clear;
|
||||||
for i := 0 to AnOther.FList.Count - 1 do begin
|
for i := 0 to AnOther.FList.Count - 1 do begin
|
||||||
FList.Add(CopyEntry(TGuiWatchValue(AnOther.FList[i])));
|
FList.Add(CopyEntry(TWatchValue(AnOther.FList[i])));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -331,7 +459,7 @@ begin
|
|||||||
FreeAndNil(FList);
|
FreeAndNil(FList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatchValueList.Add(AnEntry: TGuiWatchValue);
|
procedure TWatchValueList.Add(AnEntry: TWatchValue);
|
||||||
begin
|
begin
|
||||||
Flist.Add(AnEntry);
|
Flist.Add(AnEntry);
|
||||||
end;
|
end;
|
||||||
@ -349,5 +477,8 @@ begin
|
|||||||
Result := FList.Count;
|
Result := FList.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user