mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 04:40:35 +01:00
DebuggerIntf: Watches can now be created in Updating state. Allowing to bundle change notifications for the debugger backend.
git-svn-id: trunk@58465 -
This commit is contained in:
parent
7dca373ee2
commit
5d541aec27
@ -296,29 +296,43 @@ type
|
||||
{ TBaseBreakPoint }
|
||||
|
||||
TBaseBreakPoint = class(TRefCountedColectionItem)
|
||||
protected
|
||||
private
|
||||
FAddress: TDBGPtr;
|
||||
FWatchData: String;
|
||||
FEnabled: Boolean;
|
||||
FInitialEnabled: Boolean;
|
||||
FExpression: String;
|
||||
FHitCount: Integer; // Current counter
|
||||
FBreakHitCount: Integer; // The user configurable value
|
||||
FKind: TDBGBreakPointKind;
|
||||
FLine: Integer;
|
||||
protected // TODO: private
|
||||
FWatchData: String;
|
||||
FWatchScope: TDBGWatchPointScope;
|
||||
FWatchKind: TDBGWatchPointKind;
|
||||
FSource: String;
|
||||
FLine: Integer;
|
||||
FValid: TValidState;
|
||||
FInitialEnabled: Boolean;
|
||||
protected
|
||||
type
|
||||
(* ciCreated will be called, as soon as any other property is set the first time (or at EndUpdate)
|
||||
ciLocation includes Address, WatchData,Watch....
|
||||
*)
|
||||
TDbgBpChangeIndicator = (ciCreated, ciDestroy, ciKind, ciLocation, ciEnabled, ciCondition, ciHitCount);
|
||||
TDbgBpChangeIndicators = set of TDbgBpChangeIndicator;
|
||||
// For the debugger backend to override
|
||||
private
|
||||
FPropertiesChanged: TDbgBpChangeIndicators;
|
||||
FInPropertiesChanged: Boolean;
|
||||
procedure PropertyChanged(AChanged: TDbgBpChangeIndicator);
|
||||
protected
|
||||
procedure DoPropertiesChanged(AChanged: TDbgBpChangeIndicators); virtual;
|
||||
procedure DoExpressionChange; virtual;
|
||||
procedure DoEnableChange; virtual;
|
||||
// TODO: ClearPropertiesChanged, if needed inside DoPropertiesChanged
|
||||
protected
|
||||
procedure AssignLocationTo(Dest: TPersistent); virtual;
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
procedure DoBreakHitCountChange; virtual;
|
||||
procedure DoExpressionChange; virtual;
|
||||
procedure DoEnableChange; virtual;
|
||||
procedure DoHit(const ACount: Integer; var {%H-}AContinue: Boolean); virtual;
|
||||
procedure SetHitCount(const AValue: Integer);
|
||||
procedure DoKindChange; virtual;
|
||||
procedure SetValid(const AValue: TValidState);
|
||||
protected
|
||||
// virtual properties
|
||||
@ -334,25 +348,27 @@ type
|
||||
function GetWatchScope: TDBGWatchPointScope; virtual;
|
||||
function GetWatchKind: TDBGWatchPointKind; virtual;
|
||||
function GetValid: TValidState; virtual;
|
||||
procedure DoEndUpdate; override;
|
||||
|
||||
procedure SetAddress(const AValue: TDBGPtr); virtual;
|
||||
procedure SetBreakHitCount(const AValue: Integer); virtual;
|
||||
procedure SetEnabled(const AValue: Boolean); virtual;
|
||||
procedure SetExpression(const AValue: String); virtual;
|
||||
procedure SetInitialEnabled(const AValue: Boolean); virtual;
|
||||
procedure SetKind(const AValue: TDBGBreakPointKind); virtual;
|
||||
procedure SetKind(const AValue: TDBGBreakPointKind);
|
||||
public
|
||||
constructor Create(ACollection: TCollection); override;
|
||||
destructor Destroy; override;
|
||||
procedure SetPendingToValid(const AValue: TValidState);
|
||||
// PublicProtectedFix ide/debugmanager.pas(867,32) Error: identifier idents no member "SetLocation"
|
||||
property BreakHitCount: Integer read GetBreakHitCount write SetBreakHitCount;
|
||||
property Enabled: Boolean read GetEnabled write SetEnabled;
|
||||
property Expression: String read GetExpression write SetExpression;
|
||||
property HitCount: Integer read GetHitCount;
|
||||
property InitialEnabled: Boolean read FInitialEnabled write SetInitialEnabled;
|
||||
property Kind: TDBGBreakPointKind read GetKind write SetKind;
|
||||
property Kind: TDBGBreakPointKind read GetKind;
|
||||
property Valid: TValidState read GetValid;
|
||||
public
|
||||
procedure SetPendingToValid(const AValue: TValidState);
|
||||
procedure SetAddress(const AValue: TDBGPtr); virtual;
|
||||
procedure SetLocation(const ASource: String; const ALine: Integer); virtual;
|
||||
procedure SetWatch(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind); virtual;
|
||||
@ -378,7 +394,7 @@ type
|
||||
function GetDebugger: TDebuggerIntf;
|
||||
procedure SetSlave(const ASlave : TBaseBreakPoint);
|
||||
protected
|
||||
procedure SetEnabled(const AValue: Boolean); override;
|
||||
procedure SetEnabled(const AValue: Boolean); override; // TODO: remove, currently used by WatchPoint, instead of vsInvalid
|
||||
procedure DoChanged; override;
|
||||
procedure DoStateChange(const AOldState: TDBGState); virtual;
|
||||
property Debugger: TDebuggerIntf read GetDebugger;
|
||||
@ -387,6 +403,7 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Hit(var ACanContinue: Boolean);
|
||||
property Slave: TBaseBreakPoint read FSlave write SetSlave;
|
||||
property Kind: TDBGBreakPointKind read GetKind write SetKind; // TODO: remove, used by TIDEBreakPoint.SetKind
|
||||
|
||||
procedure DoLogMessage(const AMessage: String); virtual;
|
||||
procedure DoLogCallStack(const {%H-}Limit: Integer); virtual;
|
||||
@ -394,6 +411,22 @@ type
|
||||
end;
|
||||
TDBGBreakPointClass = class of TDBGBreakPoint;
|
||||
|
||||
{ TIdeBreakPointBase }
|
||||
|
||||
TIdeBreakPointBase = class(TBaseBreakPoint)
|
||||
private
|
||||
FMaster: TDBGBreakPoint;
|
||||
procedure SetMaster(AValue: TDBGBreakPoint);
|
||||
protected
|
||||
procedure BeginUpdate; override;
|
||||
procedure DoEndUpdate; override;
|
||||
procedure ReleaseMaster;
|
||||
property Master: TDBGBreakPoint read FMaster write SetMaster;
|
||||
// TODO: move TBaseBreakPoint properties from IDE te IDEBase
|
||||
public
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
{ TBaseBreakPoints }
|
||||
|
||||
TBaseBreakPoints = class(TCollection)
|
||||
@ -403,10 +436,10 @@ type
|
||||
constructor Create(const ABreakPointClass: TBaseBreakPointClass);
|
||||
destructor Destroy; override;
|
||||
procedure Clear; reintroduce;
|
||||
function Add(const ASource: String; const ALine: Integer): TBaseBreakPoint; overload;
|
||||
function Add(const AAddress: TDBGPtr): TBaseBreakPoint; overload;
|
||||
function Add(const ASource: String; const ALine: Integer; AnUpdating: Boolean = False): TBaseBreakPoint; overload;
|
||||
function Add(const AAddress: TDBGPtr; AnUpdating: Boolean = False): TBaseBreakPoint; overload;
|
||||
function Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TBaseBreakPoint; overload;
|
||||
const AKind: TDBGWatchPointKind; AnUpdating: Boolean = False): TBaseBreakPoint; overload;
|
||||
function Find(const ASource: String; const ALine: Integer): TBaseBreakPoint; overload;
|
||||
function Find(const ASource: String; const ALine: Integer; const AIgnore: TBaseBreakPoint): TBaseBreakPoint; overload;
|
||||
function Find(const AAddress: TDBGPtr): TBaseBreakPoint; overload;
|
||||
@ -431,10 +464,10 @@ type
|
||||
public
|
||||
constructor Create(const ADebugger: TDebuggerIntf;
|
||||
const ABreakPointClass: TDBGBreakPointClass);
|
||||
function Add(const ASource: String; const ALine: Integer): TDBGBreakPoint; overload;
|
||||
function Add(const AAddress: TDBGPtr): TDBGBreakPoint; overload;
|
||||
function Add(const ASource: String; const ALine: Integer; AnUpdating: Boolean = False): TDBGBreakPoint; overload; reintroduce;
|
||||
function Add(const AAddress: TDBGPtr; AnUpdating: Boolean = False): TDBGBreakPoint; overload; reintroduce;
|
||||
function Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TDBGBreakPoint; overload;
|
||||
const AKind: TDBGWatchPointKind; AnUpdating: Boolean = False): TDBGBreakPoint; overload; reintroduce;
|
||||
function Find(const ASource: String; const ALine: Integer): TDBGBreakPoint; overload;
|
||||
function Find(const ASource: String; const ALine: Integer; const AIgnore: TDBGBreakPoint): TDBGBreakPoint; overload;
|
||||
function Find(const AAddress: TDBGPtr): TDBGBreakPoint; overload;
|
||||
@ -3495,7 +3528,8 @@ begin
|
||||
if FKind <> AValue
|
||||
then begin
|
||||
FKind := AValue;
|
||||
DoKindChange;
|
||||
Changed;
|
||||
PropertyChanged(ciKind);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3505,6 +3539,7 @@ begin
|
||||
begin
|
||||
FAddress := AValue;
|
||||
Changed;
|
||||
PropertyChanged(ciLocation);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3551,6 +3586,7 @@ end;
|
||||
|
||||
constructor TBaseBreakPoint.Create(ACollection: TCollection);
|
||||
begin
|
||||
FPropertiesChanged := [ciCreated];
|
||||
FAddress := 0;
|
||||
FSource := '';
|
||||
FLine := -1;
|
||||
@ -3565,15 +3601,45 @@ begin
|
||||
AddReference;
|
||||
end;
|
||||
|
||||
destructor TBaseBreakPoint.Destroy;
|
||||
begin
|
||||
FPropertiesChanged := []; // Do not sent old changes
|
||||
if not IsUpdating then
|
||||
PropertyChanged(ciDestroy);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.SetPendingToValid(const AValue: TValidState);
|
||||
begin
|
||||
assert(Valid = vsPending, 'Can only change state if pending');
|
||||
SetValid(AValue);
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.DoBreakHitCountChange;
|
||||
procedure TBaseBreakPoint.PropertyChanged(AChanged: TDbgBpChangeIndicator);
|
||||
var
|
||||
c: TDbgBpChangeIndicators;
|
||||
begin
|
||||
Changed;
|
||||
FPropertiesChanged := FPropertiesChanged + [AChanged];
|
||||
if IsUpdating or FInPropertiesChanged then
|
||||
exit;
|
||||
FInPropertiesChanged := True;
|
||||
try
|
||||
while FPropertiesChanged <> [] do begin
|
||||
c := FPropertiesChanged;
|
||||
FPropertiesChanged := [];
|
||||
DoPropertiesChanged(c);
|
||||
end;
|
||||
finally
|
||||
FInPropertiesChanged := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.DoPropertiesChanged(AChanged: TDbgBpChangeIndicators);
|
||||
begin
|
||||
if ciEnabled in AChanged then
|
||||
DoEnableChange;
|
||||
if ciCondition in AChanged then
|
||||
DoExpressionChange;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.DoEnableChange;
|
||||
@ -3626,12 +3692,32 @@ begin
|
||||
Result := FValid;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.DoEndUpdate;
|
||||
var
|
||||
c: TDbgBpChangeIndicators;
|
||||
begin
|
||||
inherited DoEndUpdate;
|
||||
if FInPropertiesChanged then
|
||||
exit;
|
||||
FInPropertiesChanged := True;
|
||||
try
|
||||
while FPropertiesChanged <> [] do begin
|
||||
c := FPropertiesChanged;
|
||||
FPropertiesChanged := [];
|
||||
DoPropertiesChanged(c);
|
||||
end;
|
||||
finally
|
||||
FInPropertiesChanged := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.SetBreakHitCount(const AValue: Integer);
|
||||
begin
|
||||
if FBreakHitCount <> AValue
|
||||
then begin
|
||||
FBreakHitCount := AValue;
|
||||
DoBreakHitCountChange;
|
||||
Changed;
|
||||
PropertyChanged(ciHitCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3640,7 +3726,7 @@ begin
|
||||
if FEnabled <> AValue
|
||||
then begin
|
||||
FEnabled := AValue;
|
||||
DoEnableChange;
|
||||
PropertyChanged(ciEnabled);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3649,7 +3735,7 @@ begin
|
||||
if FExpression <> AValue
|
||||
then begin
|
||||
FExpression := AValue;
|
||||
DoExpressionChange;
|
||||
PropertyChanged(ciCondition);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3662,11 +3748,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.DoKindChange;
|
||||
begin
|
||||
Changed;
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.SetInitialEnabled(const AValue: Boolean);
|
||||
begin
|
||||
if FInitialEnabled=AValue then exit;
|
||||
@ -3679,6 +3760,7 @@ begin
|
||||
FSource := ASource;
|
||||
FLine := ALine;
|
||||
Changed;
|
||||
PropertyChanged(ciLocation);
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.SetWatch(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
@ -3689,6 +3771,7 @@ begin
|
||||
FWatchScope := AScope;
|
||||
FWatchKind := AKind;
|
||||
Changed;
|
||||
PropertyChanged(ciLocation);
|
||||
end;
|
||||
|
||||
procedure TBaseBreakPoint.SetValid(const AValue: TValidState );
|
||||
@ -3824,30 +3907,79 @@ begin
|
||||
if FSlave <> nil then FSlave.Enabled := AValue;
|
||||
end;
|
||||
|
||||
{ TIdeBreakPointBase }
|
||||
|
||||
procedure TIdeBreakPointBase.SetMaster(AValue: TDBGBreakPoint);
|
||||
begin
|
||||
if FMaster = AValue then Exit;
|
||||
if (FMaster <> nil) and IsUpdating then FMaster.EndUpdate;
|
||||
FMaster := AValue;
|
||||
if (FMaster <> nil) and IsUpdating then FMaster.BeginUpdate;
|
||||
end;
|
||||
|
||||
procedure TIdeBreakPointBase.BeginUpdate;
|
||||
begin
|
||||
if (not IsUpdating) and (FMaster <> nil) then FMaster.BeginUpdate;
|
||||
inherited BeginUpdate;
|
||||
end;
|
||||
|
||||
procedure TIdeBreakPointBase.DoEndUpdate;
|
||||
begin
|
||||
inherited DoEndUpdate;
|
||||
if FMaster <> nil then FMaster.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TIdeBreakPointBase.ReleaseMaster;
|
||||
begin
|
||||
if FMaster <> nil
|
||||
then begin
|
||||
FMaster.Slave := nil;
|
||||
ReleaseRefAndNil(FMaster);
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TIdeBreakPointBase.Destroy;
|
||||
begin
|
||||
ReleaseMaster;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ =========================================================================== }
|
||||
{ TBaseBreakPoints }
|
||||
{ =========================================================================== }
|
||||
|
||||
function TBaseBreakPoints.Add(const ASource: String; const ALine: Integer): TBaseBreakPoint;
|
||||
function TBaseBreakPoints.Add(const ASource: String; const ALine: Integer;
|
||||
AnUpdating: Boolean): TBaseBreakPoint;
|
||||
begin
|
||||
Result := TBaseBreakPoint(inherited Add);
|
||||
Result.BeginUpdate;
|
||||
Result.SetKind(bpkSource);
|
||||
Result.SetLocation(ASource, ALine);
|
||||
if not AnUpdating then
|
||||
Result.EndUpdate;
|
||||
end;
|
||||
|
||||
function TBaseBreakPoints.Add(const AAddress: TDBGPtr): TBaseBreakPoint;
|
||||
function TBaseBreakPoints.Add(const AAddress: TDBGPtr; AnUpdating: Boolean
|
||||
): TBaseBreakPoint;
|
||||
begin
|
||||
Result := TBaseBreakPoint(inherited Add);
|
||||
Result.BeginUpdate;
|
||||
Result.SetKind(bpkAddress);
|
||||
Result.SetAddress(AAddress);
|
||||
if not AnUpdating then
|
||||
Result.EndUpdate;
|
||||
end;
|
||||
|
||||
function TBaseBreakPoints.Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TBaseBreakPoint;
|
||||
function TBaseBreakPoints.Add(const AData: String;
|
||||
const AScope: TDBGWatchPointScope; const AKind: TDBGWatchPointKind;
|
||||
AnUpdating: Boolean): TBaseBreakPoint;
|
||||
begin
|
||||
Result := TBaseBreakPoint(inherited Add);
|
||||
Result.BeginUpdate;
|
||||
Result.SetKind(bpkData);
|
||||
Result.SetWatch(AData, AScope, AKind);
|
||||
if not AnUpdating then
|
||||
Result.EndUpdate;
|
||||
end;
|
||||
|
||||
constructor TBaseBreakPoints.Create(const ABreakPointClass: TBaseBreakPointClass);
|
||||
@ -3935,20 +4067,23 @@ end;
|
||||
{ TDBGBreakPoints }
|
||||
{ =========================================================================== }
|
||||
|
||||
function TDBGBreakPoints.Add (const ASource: String; const ALine: Integer ): TDBGBreakPoint;
|
||||
function TDBGBreakPoints.Add(const ASource: String; const ALine: Integer;
|
||||
AnUpdating: Boolean): TDBGBreakPoint;
|
||||
begin
|
||||
Result := TDBGBreakPoint(inherited Add(ASource, ALine));
|
||||
Result := TDBGBreakPoint(inherited Add(ASource, ALine, AnUpdating));
|
||||
end;
|
||||
|
||||
function TDBGBreakPoints.Add(const AAddress: TDBGPtr): TDBGBreakPoint;
|
||||
function TDBGBreakPoints.Add(const AAddress: TDBGPtr; AnUpdating: Boolean
|
||||
): TDBGBreakPoint;
|
||||
begin
|
||||
Result := TDBGBreakPoint(inherited Add(AAddress));
|
||||
Result := TDBGBreakPoint(inherited Add(AAddress, AnUpdating));
|
||||
end;
|
||||
|
||||
function TDBGBreakPoints.Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TDBGBreakPoint;
|
||||
function TDBGBreakPoints.Add(const AData: String;
|
||||
const AScope: TDBGWatchPointScope; const AKind: TDBGWatchPointKind;
|
||||
AnUpdating: Boolean): TDBGBreakPoint;
|
||||
begin
|
||||
Result := TDBGBreakPoint(inherited Add(AData, AScope, AKind));
|
||||
Result := TDBGBreakPoint(inherited Add(AData, AScope, AKind, AnUpdating));
|
||||
end;
|
||||
|
||||
constructor TDBGBreakPoints.Create(const ADebugger: TDebuggerIntf;
|
||||
|
||||
@ -121,7 +121,7 @@ type
|
||||
procedure DoEndUpdate; virtual; // even if not changed
|
||||
public
|
||||
procedure Assign(ASource: TPersistent); override;
|
||||
procedure BeginUpdate;
|
||||
procedure BeginUpdate; virtual;
|
||||
constructor Create(ACollection: TCollection); override;
|
||||
procedure EndUpdate;
|
||||
function IsUpdating: Boolean;
|
||||
|
||||
@ -9625,7 +9625,7 @@ begin
|
||||
then SetBreakPoint;
|
||||
if FUpdateFlags * [bufEnabled, bufCondition] <> []
|
||||
then UpdateProperties(FUpdateFlags);
|
||||
inherited DoChanged;
|
||||
inherited DoEndUpdate;
|
||||
end;
|
||||
|
||||
procedure TGDBMIBreakPoint.ReleaseBreakPoint;
|
||||
|
||||
@ -881,12 +881,12 @@ begin
|
||||
ADebugger := TFpDebugDebugger(Debugger);
|
||||
if (ADebugger.State in [dsPause, dsInit]) then
|
||||
begin
|
||||
if FEnabled and not FIsSet then
|
||||
if Enabled and not FIsSet then
|
||||
FSetBreakFlag := True
|
||||
else if not FEnabled and FIsSet then
|
||||
else if not Enabled and FIsSet then
|
||||
FResetBreakFlag := True;
|
||||
end
|
||||
else if (ADebugger.State = dsRun) and ((FEnabled and not FIsSet) or (not FEnabled and FIsSet)) then
|
||||
else if (ADebugger.State = dsRun) and ((Enabled and not FIsSet) or (not Enabled and FIsSet)) then
|
||||
ADebugger.QuickPause;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -346,10 +346,9 @@ type
|
||||
property Items[AIndex: Integer]: TIDEBreakPointGroup read GetItem; default;
|
||||
end;
|
||||
|
||||
TIDEBreakPoint = class(TBaseBreakPoint)
|
||||
TIDEBreakPoint = class(TIDEBreakPointBase)
|
||||
private
|
||||
FLogEvalExpression: String;
|
||||
FMaster: TDBGBreakPoint;
|
||||
FAutoContinueTime: Cardinal;
|
||||
FActions: TIDEBreakPointActions;
|
||||
FDisableGroupList: TIDEBreakPointGroupList;
|
||||
@ -370,6 +369,7 @@ type
|
||||
procedure SetEnabled(const AValue: Boolean); override;
|
||||
procedure SetInitialEnabled(const AValue: Boolean); override;
|
||||
procedure SetExpression(const AValue: String); override;
|
||||
procedure SetKind(const AValue: TDBGBreakPointKind);
|
||||
function DebugExeLine: Integer; virtual; // Same as line, but in Subclass: the line in the compiled exe
|
||||
|
||||
procedure DisableGroups;
|
||||
@ -450,10 +450,10 @@ type
|
||||
public
|
||||
constructor Create(const ABreakPointClass: TIDEBreakPointClass);
|
||||
destructor Destroy; override;
|
||||
function Add(const ASource: String; const ALine: Integer): TIDEBreakPoint; overload;
|
||||
function Add(const AAddress: TDBGPtr): TIDEBreakPoint; overload;
|
||||
function Add(const ASource: String; const ALine: Integer; AnUpdating: Boolean = False): TIDEBreakPoint; overload; reintroduce;
|
||||
function Add(const AAddress: TDBGPtr; AnUpdating: Boolean = False): TIDEBreakPoint; overload; reintroduce;
|
||||
function Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TIDEBreakPoint; overload;
|
||||
const AKind: TDBGWatchPointKind; AnUpdating: Boolean = False): TIDEBreakPoint; overload; reintroduce;
|
||||
function Find(const ASource: String; const ALine: Integer): TIDEBreakPoint; overload;
|
||||
function Find(const ASource: String; const ALine: Integer; const AIgnore: TIDEBreakPoint): TIDEBreakPoint; overload;
|
||||
function Find(const AAddress: TDBGPtr): TIDEBreakPoint; overload;
|
||||
@ -4528,18 +4528,18 @@ begin
|
||||
if (Collection <> nil) and (TIDEBreakPoints(Collection).FMaster <> nil)
|
||||
and (Dest is TDBGBreakPoint)
|
||||
then begin
|
||||
Assert(FMaster=nil, 'TManagedBreakPoint.AssignTO already has Master');
|
||||
if FMaster <> nil then FMaster.Slave := nil;
|
||||
FMaster := TDBGBreakPoint(Dest);
|
||||
FMaster.Slave := Self;
|
||||
Assert(Master=nil, 'TManagedBreakPoint.AssignTO already has Master');
|
||||
if Master <> nil then Master.Slave := nil;
|
||||
Master := TDBGBreakPoint(Dest);
|
||||
Master.Slave := Self;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.DoChanged;
|
||||
begin
|
||||
if (FMaster <> nil)
|
||||
and (FMaster.Slave = nil)
|
||||
then FMaster := nil;
|
||||
if (Master <> nil)
|
||||
and (Master.Slave = nil)
|
||||
then Master := nil;
|
||||
|
||||
inherited DoChanged;
|
||||
end;
|
||||
@ -4552,16 +4552,16 @@ end;
|
||||
|
||||
function TIDEBreakPoint.GetHitCount: Integer;
|
||||
begin
|
||||
if FMaster = nil
|
||||
if Master = nil
|
||||
then Result := 0
|
||||
else Result := FMaster.HitCount;
|
||||
else Result := Master.HitCount;
|
||||
end;
|
||||
|
||||
function TIDEBreakPoint.GetValid: TValidState;
|
||||
begin
|
||||
if FMaster = nil
|
||||
if Master = nil
|
||||
then Result := vsUnknown
|
||||
else Result := FMaster.Valid;
|
||||
else Result := Master.Valid;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetBreakHitCount(const AValue: Integer);
|
||||
@ -4569,7 +4569,7 @@ begin
|
||||
if BreakHitCount = AValue then exit;
|
||||
inherited SetBreakHitCount(AValue);
|
||||
DoUserChanged;
|
||||
if FMaster <> nil then FMaster.BreakHitCount := AValue;
|
||||
if Master <> nil then Master.BreakHitCount := AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetEnabled(const AValue: Boolean);
|
||||
@ -4577,7 +4577,7 @@ begin
|
||||
if Enabled = AValue then exit;
|
||||
inherited SetEnabled(AValue);
|
||||
InitialEnabled:=Enabled;
|
||||
if FMaster <> nil then FMaster.Enabled := AValue;
|
||||
if Master <> nil then Master.Enabled := AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetInitialEnabled(const AValue: Boolean);
|
||||
@ -4585,7 +4585,7 @@ begin
|
||||
if InitialEnabled = AValue then exit;
|
||||
inherited SetInitialEnabled(AValue);
|
||||
DoUserChanged;
|
||||
if FMaster <> nil then FMaster.InitialEnabled := AValue;
|
||||
if Master <> nil then Master.InitialEnabled := AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetExpression(const AValue: String);
|
||||
@ -4593,7 +4593,15 @@ begin
|
||||
if AValue=Expression then exit;
|
||||
inherited SetExpression(AValue);
|
||||
DoUserChanged;
|
||||
if FMaster <> nil then FMaster.Expression := AValue;
|
||||
if Master <> nil then Master.Expression := AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetKind(const AValue: TDBGBreakPointKind);
|
||||
begin
|
||||
if AValue=Kind then exit;
|
||||
inherited SetKind(AValue);
|
||||
DoUserChanged;
|
||||
if Master <> nil then Master.Kind := AValue;
|
||||
end;
|
||||
|
||||
function TIDEBreakPoint.DebugExeLine: Integer;
|
||||
@ -4630,11 +4638,7 @@ destructor TIDEBreakPoint.Destroy;
|
||||
var
|
||||
Grp: TIDEBreakPointGroup;
|
||||
begin
|
||||
if FMaster <> nil
|
||||
then begin
|
||||
FMaster.Slave := nil;
|
||||
ReleaseRefAndNil(FMaster);
|
||||
end;
|
||||
ReleaseMaster;
|
||||
|
||||
if (TIDEBreakPoints(Collection) <> nil)
|
||||
then TIDEBreakPoints(Collection).NotifyRemove(Self);
|
||||
@ -4673,11 +4677,11 @@ begin
|
||||
inherited DoHit(ACount, AContinue);
|
||||
AContinue := AContinue or not (bpaStop in Actions);
|
||||
if bpaLogMessage in Actions
|
||||
then FMaster.DoLogMessage(FLogMessage);
|
||||
then Master.DoLogMessage(FLogMessage);
|
||||
if (bpaEValExpression in Actions) and (Trim(FLogEvalExpression) <> '')
|
||||
then FMaster.DoLogExpression(Trim(FLogEvalExpression));
|
||||
then Master.DoLogExpression(Trim(FLogEvalExpression));
|
||||
if bpaLogCallStack in Actions
|
||||
then FMaster.DoLogCallStack(FLogCallStackLimit);
|
||||
then Master.DoLogCallStack(FLogCallStackLimit);
|
||||
// SnapShot is taken in TDebugManager.DebuggerChangeState
|
||||
if bpaEnableGroup in Actions
|
||||
then EnableGroups;
|
||||
@ -4737,7 +4741,7 @@ var
|
||||
begin
|
||||
FLoading:=true;
|
||||
try
|
||||
Kind:=TDBGBreakPointKind(GetEnumValueDef(TypeInfo(TDBGBreakPointKind),XMLConfig.GetValue(Path+'Kind/Value',''),0));
|
||||
SetKind(TDBGBreakPointKind(GetEnumValueDef(TypeInfo(TDBGBreakPointKind),XMLConfig.GetValue(Path+'Kind/Value',''),0)));
|
||||
GroupName:=XMLConfig.GetValue(Path+'Group/Name','');
|
||||
Group:=OnGetGroup(GroupName);
|
||||
Expression:=XMLConfig.GetValue(Path+'Expression/Value','');
|
||||
@ -4757,7 +4761,7 @@ begin
|
||||
FSource:=Filename;
|
||||
|
||||
InitialEnabled:=XMLConfig.GetValue(Path+'InitialEnabled/Value',true);
|
||||
Enabled:=FInitialEnabled;
|
||||
Enabled:=InitialEnabled;
|
||||
FLine:=XMLConfig.GetValue(Path+'Line/Value',-1);
|
||||
FLogEvalExpression := XMLConfig.GetValue(Path+'LogEvalExpression/Value', '');
|
||||
FLogMessage:=XMLConfig.GetValue(Path+'LogMessage/Value','');
|
||||
@ -4835,26 +4839,30 @@ end;
|
||||
procedure TIDEBreakPoint.SetAddress(const AValue: TDBGPtr);
|
||||
begin
|
||||
inherited SetAddress(AValue);
|
||||
if FMaster<>nil then FMaster.Address := Address;
|
||||
if Master<>nil then Master.Address := Address;
|
||||
|
||||
//TODO: Why not DoUserChanged; ?
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetLocation(const ASource: String; const ALine: Integer);
|
||||
begin
|
||||
inherited SetLocation(ASource, ALine);
|
||||
if FMaster<>nil then FMaster.SetLocation(ASource, DebugExeLine);
|
||||
if Master<>nil then Master.SetLocation(ASource, DebugExeLine);
|
||||
//TODO: Why not DoUserChanged; ?
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.SetWatch(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind);
|
||||
begin
|
||||
inherited SetWatch(AData, AScope, AKind);
|
||||
if FMaster<>nil then FMaster.SetWatch(AData, AScope, AKind);
|
||||
if Master<>nil then Master.SetWatch(AData, AScope, AKind);
|
||||
//TODO: Why not DoUserChanged; ?
|
||||
end;
|
||||
|
||||
procedure TIDEBreakPoint.ResetMaster;
|
||||
begin
|
||||
if FMaster <> nil then FMaster.Slave := nil;
|
||||
FMaster := nil;
|
||||
if Master <> nil then Master.Slave := nil;
|
||||
Master := nil;
|
||||
Changed;
|
||||
end;
|
||||
|
||||
@ -4918,23 +4926,25 @@ end;
|
||||
{ TIDEBreakPoints }
|
||||
{ =========================================================================== }
|
||||
|
||||
function TIDEBreakPoints.Add(const ASource: String;
|
||||
const ALine: Integer): TIDEBreakPoint;
|
||||
function TIDEBreakPoints.Add(const ASource: String; const ALine: Integer;
|
||||
AnUpdating: Boolean): TIDEBreakPoint;
|
||||
begin
|
||||
Result := TIDEBreakPoint(inherited Add(ASource, ALine));
|
||||
Result := TIDEBreakPoint(inherited Add(ASource, ALine, AnUpdating));
|
||||
NotifyAdd(Result);
|
||||
end;
|
||||
|
||||
function TIDEBreakPoints.Add(const AAddress: TDBGPtr): TIDEBreakPoint;
|
||||
function TIDEBreakPoints.Add(const AAddress: TDBGPtr; AnUpdating: Boolean
|
||||
): TIDEBreakPoint;
|
||||
begin
|
||||
Result := TIDEBreakPoint(inherited Add(AAddress));
|
||||
Result := TIDEBreakPoint(inherited Add(AAddress, AnUpdating));
|
||||
NotifyAdd(Result);
|
||||
end;
|
||||
|
||||
function TIDEBreakPoints.Add(const AData: String; const AScope: TDBGWatchPointScope;
|
||||
const AKind: TDBGWatchPointKind): TIDEBreakPoint;
|
||||
function TIDEBreakPoints.Add(const AData: String;
|
||||
const AScope: TDBGWatchPointScope; const AKind: TDBGWatchPointKind;
|
||||
AnUpdating: Boolean): TIDEBreakPoint;
|
||||
begin
|
||||
Result := TIDEBreakPoint(inherited Add(AData, AScope, AKind));
|
||||
Result := TIDEBreakPoint(inherited Add(AData, AScope, AKind, AnUpdating));
|
||||
NotifyAdd(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -194,10 +194,12 @@ type
|
||||
WarnIfNoDebugger: boolean): TModalResult; virtual; abstract;
|
||||
function DoCreateBreakPoint(const AFilename: string; ALine: integer;
|
||||
WarnIfNoDebugger: boolean;
|
||||
out ABrkPoint: TIDEBreakPoint): TModalResult; virtual; abstract;
|
||||
out ABrkPoint: TIDEBreakPoint;
|
||||
AnUpdating: Boolean = False): TModalResult; virtual; abstract;
|
||||
function DoCreateBreakPoint(const AnAddr: TDBGPtr;
|
||||
WarnIfNoDebugger: boolean;
|
||||
out ABrkPoint: TIDEBreakPoint): TModalResult; virtual; abstract;
|
||||
out ABrkPoint: TIDEBreakPoint;
|
||||
AnUpdating: Boolean = False): TModalResult; virtual; abstract;
|
||||
function DoDeleteBreakPoint(const AFilename: string; ALine: integer
|
||||
): TModalResult; virtual; abstract;
|
||||
function DoDeleteBreakPointAtMark(const ASourceMark: TSourceMark
|
||||
|
||||
@ -253,10 +253,12 @@ type
|
||||
WarnIfNoDebugger: boolean): TModalResult; override;
|
||||
function DoCreateBreakPoint(const AFilename: string; ALine: integer;
|
||||
WarnIfNoDebugger: boolean;
|
||||
out ABrkPoint: TIDEBreakPoint): TModalResult; override;
|
||||
out ABrkPoint: TIDEBreakPoint;
|
||||
AnUpdating: Boolean = False): TModalResult; override;
|
||||
function DoCreateBreakPoint(const AnAddr: TDBGPtr;
|
||||
WarnIfNoDebugger: boolean;
|
||||
out ABrkPoint: TIDEBreakPoint): TModalResult; override;
|
||||
out ABrkPoint: TIDEBreakPoint;
|
||||
AnUpdating: Boolean = False): TModalResult; override;
|
||||
|
||||
function DoDeleteBreakPoint(const AFilename: string;
|
||||
ALine: integer): TModalResult; override;
|
||||
@ -2920,31 +2922,28 @@ begin
|
||||
Result := DoCreateBreakPoint(AFilename, ALine, WarnIfNoDebugger, ABrkPoint);
|
||||
end;
|
||||
|
||||
function TDebugManager.DoCreateBreakPoint(const AFilename: string; ALine: integer;
|
||||
WarnIfNoDebugger: boolean; out ABrkPoint: TIDEBreakPoint): TModalResult;
|
||||
function TDebugManager.DoCreateBreakPoint(const AFilename: string;
|
||||
ALine: integer; WarnIfNoDebugger: boolean; out ABrkPoint: TIDEBreakPoint;
|
||||
AnUpdating: Boolean): TModalResult;
|
||||
begin
|
||||
ABrkPoint := nil;
|
||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||
exit(mrCancel);
|
||||
|
||||
ABrkPoint := FBreakPoints.Add(AFilename, ALine);
|
||||
ABrkPoint := FBreakPoints.Add(AFilename, ALine, AnUpdating);
|
||||
Result := mrOK;
|
||||
end;
|
||||
|
||||
function TDebugManager.DoCreateBreakPoint(const AnAddr: TDBGPtr; WarnIfNoDebugger: boolean;
|
||||
out ABrkPoint: TIDEBreakPoint): TModalResult;
|
||||
function TDebugManager.DoCreateBreakPoint(const AnAddr: TDBGPtr;
|
||||
WarnIfNoDebugger: boolean; out ABrkPoint: TIDEBreakPoint; AnUpdating: Boolean
|
||||
): TModalResult;
|
||||
begin
|
||||
LockCommandProcessing;
|
||||
try
|
||||
ABrkPoint := nil;
|
||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||
exit(mrCancel);
|
||||
ABrkPoint := nil;
|
||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||
exit(mrCancel);
|
||||
|
||||
ABrkPoint := FBreakPoints.Add(AnAddr);
|
||||
Result := mrOK;
|
||||
finally
|
||||
UnLockCommandProcessing;
|
||||
end;
|
||||
ABrkPoint := FBreakPoints.Add(AnAddr, AnUpdating);
|
||||
Result := mrOK;
|
||||
end;
|
||||
|
||||
function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
|
||||
|
||||
@ -4678,10 +4678,11 @@ begin
|
||||
if not BreakFound then begin
|
||||
DebugBoss.LockCommandProcessing;
|
||||
try
|
||||
DebugBoss.DoCreateBreakPoint(Filename, Line, True, ABrkPoint);
|
||||
DebugBoss.DoCreateBreakPoint(Filename, Line, True, ABrkPoint, True);
|
||||
if Ctrl and (ABrkPoint <> nil)
|
||||
then ABrkPoint.Enabled := False;
|
||||
finally
|
||||
ABrkPoint.EndUpdate;
|
||||
DebugBoss.UnLockCommandProcessing;
|
||||
end;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user