From 1a0a37aaf917bcb36fd7ef09a3c8af16d636ffdd Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 27 Apr 2011 14:55:07 +0000 Subject: [PATCH] DBG: Refactor, merge TManaged.. classes into TIDE.. classes git-svn-id: trunk@30490 - --- debugger/callstackdlg.pp | 6 +- debugger/debugger.pp | 863 +++++++++++++++++++++++++++++++-- debugger/gdbmidebugger.pp | 17 +- ide/debugmanager.pas | 980 ++------------------------------------ 4 files changed, 877 insertions(+), 989 deletions(-) diff --git a/debugger/callstackdlg.pp b/debugger/callstackdlg.pp index 7f8770f51f..9532c5a1a2 100644 --- a/debugger/callstackdlg.pp +++ b/debugger/callstackdlg.pp @@ -207,14 +207,14 @@ function TCallStackDlg.GetImageIndex(Entry: TCallStackEntry): Integer; begin if HasBreakPoint(Entry) then begin - if Entry.Current then + if Entry.IsCurrent then Result := imgCurrentLineAtBreakPoint else Result := imgBreakPoint; end else begin - if Entry.Current then + if Entry.IsCurrent then Result := imgCurrentLine else if Entry.Source = '' then @@ -475,7 +475,7 @@ begin Entry := GetCurrentEntry; if Entry = nil then Exit; - CallStack.Current := Entry; + CallStack.CurrentIndex := Entry.Index; finally EnableAllActions; end; diff --git a/debugger/debugger.pp b/debugger/debugger.pp index 8fcdac6f98..b75fbebdac 100644 --- a/debugger/debugger.pp +++ b/debugger/debugger.pp @@ -291,8 +291,11 @@ type end; TBaseBreakPointClass = class of TBaseBreakPoint; + TDBGBreakPoint = class; + TIDEBreakPoint = class(TBaseBreakPoint) private + FMaster: TDBGBreakPoint; FAutoContinueTime: Cardinal; FActions: TIDEBreakPointActions; FDisableGroupList: TList; @@ -300,7 +303,18 @@ type FGroup: TIDEBreakPointGroup; FLoading: Boolean; protected + procedure AssignLocationTo(Dest: TPersistent); override; procedure AssignTo(Dest: TPersistent); override; + procedure DoChanged; override; + + function GetHitCount: Integer; override; + function GetValid: TValidState; override; + procedure SetBreakHitCount(const AValue: Integer); override; + procedure SetEnabled(const AValue: Boolean); override; + procedure SetInitialEnabled(const AValue: Boolean); override; + procedure SetExpression(const AValue: String); override; + function DebugExeLine: Integer; virtual; // Same as line, but in Subclass: the line in the compiled exe + procedure DisableGroups; procedure DoActionChange; virtual; procedure DoHit(const ACount: Integer; var AContinue: Boolean); override; @@ -329,6 +343,8 @@ type const OnGetGroup: TOnGetGroupByName); virtual; procedure SaveToXMLConfig(const AConfig: TXMLConfig; const APath: string; const OnSaveFilename: TOnSaveFilenameToConfig); virtual; + procedure SetLocation(const ASource: String; const ALine: Integer); override; + procedure ResetMaster; public property Actions: TIDEBreakPointActions read GetActions write SetActions; property AutoContinueTime: Cardinal read GetAutoContinueTime write SetAutoContinueTime; @@ -383,9 +399,13 @@ type // no items property needed, it is "overridden" anyhow end; + TDBGBreakPoints = class; + TIDEBreakPoints = class(TBaseBreakPoints) private FNotificationList: TList; + FMaster: TDBGBreakPoints; + procedure SetMaster(const AValue: TDBGBreakPoints); function GetItem(const AnIndex: Integer): TIDEBreakPoint; procedure SetItem(const AnIndex: Integer; const AValue: TIDEBreakPoint); protected @@ -405,6 +425,7 @@ type const OnGetGroup: TOnGetGroupByName); virtual; procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string; const OnSaveFilename: TOnSaveFilenameToConfig); virtual; + property Master: TDBGBreakPoints read FMaster write SetMaster; public property Items[const AnIndex: Integer]: TIDEBreakPoint read GetItem write SetItem; default; @@ -685,12 +706,25 @@ type end; TBaseWatchClass = class of TBaseWatch; + { TIDEWatch } + TDBGWatch = class; + TIDEWatch = class(TBaseWatch) private + FMaster: TDBGWatch; protected + procedure AssignTo(Dest: TPersistent); override; + procedure DoChanged; override; + function GetValid: TValidState; override; + function GetValue: String; override; + function GetTypeInfo: TDBGType; override; + procedure SetEnabled(const AValue: Boolean); override; + procedure SetExpression(const AValue: String); override; + procedure SetDisplayFormat(const AValue: TWatchDisplayFormat); override; public constructor Create(ACollection: TCollection); override; destructor Destroy; override; + procedure ResetMaster; procedure LoadFromXMLConfig(const AConfig: TXMLConfig; const APath: string); virtual; procedure SaveToXMLConfig(const AConfig: TXMLConfig; @@ -744,9 +778,16 @@ type // no items property needed, it is "overridden" anyhow end; + { TIDEWatches } + TDBGWatches = class; + TIDEWatches = class(TBaseWatches) private FNotificationList: TList; + FMaster: TDBGWatches; + procedure WatchesChanged(Sender: TObject); + procedure SetMaster(const AMaster: TDBGWatches); + protected function GetItem(const AnIndex: Integer): TIDEWatch; procedure SetItem(const AnIndex: Integer; const AValue: TIDEWatch); protected @@ -754,7 +795,7 @@ type procedure NotifyRemove(const AWatch: TIDEWatch); virtual; // called by watch when destructed procedure Update(Item: TCollectionItem); override; public - constructor Create(const AWatchClass: TIDEWatchClass); + constructor Create; destructor Destroy; override; // Watch function Add(const AExpression: String): TIDEWatch; @@ -764,6 +805,7 @@ type procedure RemoveNotification(const ANotification: TIDEWatchesNotification); procedure LoadFromXMLConfig(const AConfig: TXMLConfig; const APath: string); virtual; procedure SaveToXMLConfig(const AConfig: TXMLConfig; const APath: string); virtual; + property Master: TDBGWatches read FMaster write SetMaster; public property Items[const AnIndex: Integer]: TIDEWatch read GetItem write SetItem; default; @@ -819,6 +861,9 @@ type { TIDELocals } + { TIDELocalsNotification } + TDBGLocals = class; + TIDELocalsNotification = class(TDebuggerNotification) private FOnChange: TNotifyEvent; @@ -829,13 +874,20 @@ type TIDELocals = class(TBaseLocals) private FNotificationList: TList; + FMaster: TDBGLocals; + procedure LocalsChanged(Sender: TObject); + procedure SetMaster(const AMaster: TDBGLocals); protected procedure NotifyChange; + function GetName(const AnIndex: Integer): String; override; + function GetValue(const AnIndex: Integer): String; override; public constructor Create; destructor Destroy; override; procedure AddNotification(const ANotification: TIDELocalsNotification); procedure RemoveNotification(const ANotification: TIDELocalsNotification); + function Count: Integer; override; + property Master: TDBGLocals read FMaster write SetMaster; end; { TDBGLocals } @@ -893,9 +945,15 @@ type property OnChange: TIDELineInfoEvent read FOnChange write FOnChange; end; + TDBGLineInfo = class; TIDELineInfo = class(TBaseLineInfo) private FNotificationList: TList; + FMaster: TDBGLineInfo; + procedure LineInfoChanged(const ASender: TObject; const ASource: String); + procedure SetMaster(const AMaster: TDBGLineInfo); + protected + function GetSource(const AIndex: Integer): String; override; protected procedure NotifyChange(ASource: String); public @@ -903,6 +961,12 @@ type destructor Destroy; override; procedure AddNotification(const ANotification: TIDELineInfoNotification); procedure RemoveNotification(const ANotification: TIDELineInfoNotification); + function Count: Integer; override; + function GetAddress(const AIndex: Integer; const ALine: Integer): TDbgPtr; override; + function GetInfo(AAdress: TDbgPtr; out ASource, ALine, AOffset: Integer): Boolean; override; + function IndexOf(const ASource: String): integer; override; + procedure Request(const ASource: String); override; + property Master: TDBGLineInfo read FMaster write SetMaster; end; { TDBGLineInfo } @@ -964,9 +1028,20 @@ type property OnChange: TNotifyEvent read FOnChange write FOnChange; end; + TDBGRegisters = class; + TIDERegisters = class(TBaseRegisters) private FNotificationList: TList; + FMaster: TDBGRegisters; + procedure RegistersChanged(Sender: TObject); + procedure SetMaster(const AMaster: TDBGRegisters); + protected + function GetModified(const AnIndex: Integer): Boolean; override; + function GetName(const AnIndex: Integer): String; override; + function GetValue(const AnIndex: Integer): String; override; + function GetFormat(const AnIndex: Integer): TRegisterDisplayFormat; override; + procedure SetFormat(const AnIndex: Integer; const AValue: TRegisterDisplayFormat); override; protected procedure NotifyChange; public @@ -974,6 +1049,8 @@ type destructor Destroy; override; procedure AddNotification(const ANotification: TIDERegistersNotification); procedure RemoveNotification(const ANotification: TIDERegistersNotification); + function Count: Integer; override; + property Master: TDBGRegisters read FMaster write SetMaster; end; { TDBGRegisters } @@ -1031,11 +1108,9 @@ type function GetArgumentCount: Integer; function GetArgumentName(const AnIndex: Integer): String; function GetArgumentValue(const AnIndex: Integer): String; - function GetCurrent: Boolean; function GetFullFileName: String; function GetFunctionName: String; function GetSource: String; - procedure SetCurrent(const AValue: Boolean); public constructor Create(const AIndex:Integer; const AnAdress: TDbgPtr; const AnArguments: TStrings; const AFunctionName: String; @@ -1044,11 +1119,12 @@ type constructor CreateCopy(const ASource: TCallStackEntry); destructor Destroy; override; function GetFunctionWithArg: String; + function IsCurrent: Boolean; + procedure MakeCurrent; property Address: TDbgPtr read FAdress; property ArgumentCount: Integer read GetArgumentCount; property ArgumentNames[const AnIndex: Integer]: String read GetArgumentName; property ArgumentValues[const AnIndex: Integer]: String read GetArgumentValue; - property Current: Boolean read GetCurrent write SetCurrent; property FunctionName: String read GetFunctionName; property Index: Integer read FIndex; property Line: Integer read FLine; @@ -1067,15 +1143,15 @@ type protected function CheckCount: Boolean; virtual; procedure Clear; virtual; - function GetCurrent: TCallStackEntry; virtual; + function GetCurrent: Integer; virtual; function InternalGetEntry(AIndex: Integer): TCallStackEntry; virtual; - procedure SetCurrent(AValue: TCallStackEntry); virtual; + procedure SetCurrent(AValue: Integer); virtual; procedure SetCount(ACount: Integer); virtual; public function Count: Integer; destructor Destroy; override; procedure PrepareRange(AIndex, ACount: Integer); virtual; - property Current: TCallStackEntry read GetCurrent write SetCurrent; + property CurrentIndex: Integer read GetCurrent write SetCurrent; property Entries[AIndex: Integer]: TCallStackEntry read GetEntry; end; @@ -1091,18 +1167,30 @@ type end; { TIDECallStack } + TDBGCallStack = class; TIDECallStack = class(TBaseCallStack) private + FMaster: TDBGCallStack; FNotificationList: TList; + procedure CallStackChanged(Sender: TObject); + procedure CallStackClear(Sender: TObject); + procedure CallStackCurrent(Sender: TObject); + procedure SetMaster(const AMaster: TDBGCallStack); protected procedure NotifyChange; procedure NotifyCurrent; + function CheckCount: Boolean; override; + function GetCurrent: Integer; override; + function InternalGetEntry(AIndex: Integer): TCallStackEntry; override; + procedure SetCurrent(AValue: Integer); override; public constructor Create; destructor Destroy; override; procedure AddNotification(const ANotification: TIDECallStackNotification); procedure RemoveNotification(const ANotification: TIDECallStackNotification); + procedure PrepareRange(AIndex, ACount: Integer); override; + property Master: TDBGCallStack read FMaster write SetMaster; end; { TDBGCallStack } @@ -1153,7 +1241,7 @@ type Statement: String; // Asm FuncName: String; // Function, if avail Offset: Integer; // Byte-Offest in Fonction - SrcFileName: String; // SrcFile if avai; + SrcFileName: String; // SrcFile if avail SrcFileLine: Integer; // Line in SrcFile SrcStatementIndex: SmallInt; // Index of Statement, within list of Stmnt of the same SrcLine SrcStatementCount: SmallInt; // Count of Statements for this SrcLine @@ -1205,16 +1293,26 @@ type property OnChange: TNotifyEvent read FOnChange write FOnChange; end; + TDBGDisassembler = class; + TIDEDisassembler = class(TBaseDisassembler) private FNotificationList: TList; + FMaster: TDBGDisassembler; + procedure DisassemblerChanged(Sender: TObject); + procedure SetMaster(AMaster: TDBGDisassembler); protected procedure DoChanged; override; + function InternalGetEntry(AIndex: Integer): TDisassemblerEntry; override; + function InternalGetEntryPtr(AIndex: Integer): PDisassemblerEntry; override; public constructor Create; destructor Destroy; override; procedure AddNotification(const ANotification: TIDEDisassemblerNotification); procedure RemoveNotification(const ANotification: TIDEDisassemblerNotification); + procedure Clear; override; + function PrepareRange(AnAddr: TDbgPtr; ALinesBefore, ALinesAfter: Integer): Boolean; override; + property Master: TDBGDisassembler read FMaster write SetMaster; end; { TDBGDisassemblerEntryRange } @@ -1461,14 +1559,19 @@ type end; TDBGSignalClass = class of TDBGSignal; + { TIDESignal } + TIDESignal = class(TBaseSignal) private + FMaster: TDBGSignal; protected + procedure AssignTo(Dest: TPersistent); override; public procedure LoadFromXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); procedure SaveToXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); + procedure ResetMaster; end; { TBaseSignals } @@ -1504,12 +1607,18 @@ type TIDESignals = class(TBaseSignals) private + FMaster: TDBGSignals; + procedure SetMaster(const AValue: TDBGSignals); function GetItem(const AIndex: Integer): TIDESignal; procedure SetItem(const AIndex: Integer; const AValue: TIDESignal); protected + procedure AddDefault; public + constructor Create; + procedure Reset; override; function Add(const AName: String; AID: Integer): TIDESignal; function Find(const AName: String): TIDESignal; + property Master: TDBGSignals read FMaster write SetMaster; public procedure LoadFromXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); @@ -1545,10 +1654,14 @@ type end; TDBGExceptionClass = class of TDBGException; + { TIDEException } TIDEException = class(TBaseException) private FEnabled: Boolean; + FMaster: TDBGException; + protected + procedure DoChanged; override; procedure SetEnabled(const AValue: Boolean); protected public @@ -1557,6 +1670,7 @@ type const APath: string); override; procedure SaveToXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); override; + procedure ResetMaster; property Enabled: Boolean read FEnabled write SetEnabled; end; @@ -1599,17 +1713,24 @@ type TIDEExceptions = class(TBaseExceptions) private + FMaster: TDBGExceptions; + procedure SetMaster(const AValue: TDBGExceptions); function GetItem(const AIndex: Integer): TIDEException; procedure SetItem(const AIndex: Integer; const AValue: TIDEException); protected + procedure AddDefault; public function Add(const AName: String): TIDEException; function Find(const AName: String): TIDEException; public + constructor Create; procedure LoadFromXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); procedure SaveToXMLConfig(const AXMLConfig: TXMLConfig; const APath: string); + procedure AddIfNeeded(AName: string); + procedure Reset; override; + property Master: TDBGExceptions read FMaster write SetMaster; property Items[const AIndex: Integer]: TIDEException read GetItem write SetItem; default; end; @@ -2993,6 +3114,16 @@ begin Changed; end; +procedure TIDEBreakPoint.AssignLocationTo(Dest: TPersistent); +var + DestBreakPoint: TBaseBreakPoint absolute Dest; +begin + if DestBreakPoint is TDBGBreakPoint then + DestBreakPoint.SetLocation(Source, DebugExeLine) + else + inherited; +end; + procedure TIDEBreakPoint.AssignTo(Dest: TPersistent); begin inherited; @@ -3001,6 +3132,72 @@ begin TIDEBreakPoint(Dest).Actions := FActions; TIDEBreakPoint(Dest).AutoContinueTime := FAutoContinueTime; end; + + 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; + end; +end; + +procedure TIDEBreakPoint.DoChanged; +begin + if (FMaster <> nil) + and (FMaster.Slave = nil) + then FMaster := nil; + + inherited DoChanged; +end; + +function TIDEBreakPoint.GetHitCount: Integer; +begin + if FMaster = nil + then Result := 0 + else Result := FMaster.HitCount; +end; + +function TIDEBreakPoint.GetValid: TValidState; +begin + if FMaster = nil + then Result := vsUnknown + else Result := FMaster.Valid; +end; + +procedure TIDEBreakPoint.SetBreakHitCount(const AValue: Integer); +begin + if BreakHitCount = AValue then exit; + inherited SetBreakHitCount(AValue); + if FMaster <> nil then FMaster.BreakHitCount := AValue; +end; + +procedure TIDEBreakPoint.SetEnabled(const AValue: Boolean); +begin + if Enabled = AValue then exit; + inherited SetEnabled(AValue); + InitialEnabled:=Enabled; + if FMaster <> nil then FMaster.Enabled := AValue; +end; + +procedure TIDEBreakPoint.SetInitialEnabled(const AValue: Boolean); +begin + if InitialEnabled = AValue then exit; + inherited SetInitialEnabled(AValue); + if FMaster <> nil then FMaster.InitialEnabled := AValue; +end; + +procedure TIDEBreakPoint.SetExpression(const AValue: String); +begin + if AValue=Expression then exit; + inherited SetExpression(AValue); + if FMaster <> nil then FMaster.Expression := AValue; +end; + +function TIDEBreakPoint.DebugExeLine: Integer; +begin + Result := Line; end; procedure TIDEBreakPoint.ClearAllGroupLists; @@ -3032,6 +3229,12 @@ end; destructor TIDEBreakPoint.Destroy; begin + if FMaster <> nil + then begin + FMaster.Slave := nil; + FreeAndNil(FMaster); + end; + if (TIDEBreakPoints(Collection) <> nil) then TIDEBreakPoints(Collection).NotifyRemove(Self); @@ -3207,6 +3410,19 @@ begin SaveGroupList(FEnableGroupList, APath + 'EnableGroups/'); end; +procedure TIDEBreakPoint.SetLocation(const ASource: String; const ALine: Integer); +begin + inherited SetLocation(ASource, ALine); + if FMaster<>nil then FMaster.SetLocation(ASource, DebugExeLine); +end; + +procedure TIDEBreakPoint.ResetMaster; +begin + if FMaster <> nil then FMaster.Slave := nil; + FMaster := nil; + Changed; +end; + procedure TIDEBreakPoint.SetActions(const AValue: TIDEBreakPointActions); begin if FActions <> AValue @@ -3348,6 +3564,7 @@ end; constructor TIDEBreakPoints.Create(const ABreakPointClass: TIDEBreakPointClass); begin + FMaster := nil; FNotificationList := TList.Create; inherited Create(ABreakPointClass); end; @@ -3376,6 +3593,23 @@ begin Result := TIDEBreakPoint(inherited Find(ASource, ALine, AIgnore)); end; +procedure TIDEBreakPoints.SetMaster(const AValue: TDBGBreakPoints); +var + n: Integer; +begin + if FMaster = AValue then Exit; + + FMaster := AValue; + if FMaster = nil + then begin + for n := 0 to Count - 1 do + Items[n].ResetMaster; + end + else begin + FMaster.Assign(Self); + end; +end; + function TIDEBreakPoints.GetItem(const AnIndex: Integer): TIDEBreakPoint; begin Result := TIDEBreakPoint(inherited GetItem(AnIndex)); @@ -3385,13 +3619,24 @@ procedure TIDEBreakPoints.NotifyAdd(const ABreakPoint: TIDEBreakPoint); var n: Integer; Notification: TIDEBreakPointsNotification; + BP: TBaseBreakPoint; begin + ABreakpoint.InitialEnabled := True; + ABreakpoint.Enabled := True; + for n := 0 to FNotificationList.Count - 1 do begin Notification := TIDEBreakPointsNotification(FNotificationList[n]); if Assigned(Notification.FOnAdd) then Notification.FOnAdd(Self, ABreakPoint); end; + + if FMaster <> nil + then begin + // create without source. it will be set in assign (but during Begin/EndUpdate) + BP := FMaster.Add('', 0); + BP.Assign(ABreakPoint); + end; end; procedure TIDEBreakPoints.NotifyRemove(const ABreakpoint: TIDEBreakPoint); @@ -4040,6 +4285,76 @@ end; { TIDEWatch } { =========================================================================== } +procedure TIDEWatch.AssignTo(Dest: TPersistent); +begin + inherited AssignTo(Dest); + if (TIDEWatches(Collection).FMaster <> nil) + and (Dest is TDBGWatch) + then begin + Assert(FMaster=nil, 'TManagedWatch.AssignTo already has a master'); + if FMaster<>nil then FMaster.Slave := nil; + FMaster := TDBGWatch(Dest); + FMaster.Slave := Self; + end; +end; + +procedure TIDEWatch.DoChanged; +begin + if (FMaster <> nil) + and (FMaster.Slave = nil) + then FMaster := nil; + + inherited DoChanged; +end; + +function TIDEWatch.GetValid: TValidState; +begin + if FMaster = nil + then Result := inherited GetValid + else Result := FMaster.Valid; +end; + +function TIDEWatch.GetValue: String; +begin + if FMaster = nil + then Result := inherited GetValue + else Result := FMaster.Value; +end; + +function TIDEWatch.GetTypeInfo: TDBGType; +begin + if FMaster = nil + then Result := inherited GetTypeInfo + else Result := FMaster.TypeInfo; +end; + +procedure TIDEWatch.SetEnabled(const AValue: Boolean); +begin + if Enabled = AValue then Exit; + inherited SetEnabled(AValue); + if FMaster <> nil then FMaster.Enabled := AValue; +end; + +procedure TIDEWatch.SetExpression(const AValue: String); +begin + if AValue = Expression then Exit; + inherited SetExpression(AValue); + if FMaster <> nil then FMaster.Expression := AValue; +end; + +procedure TIDEWatch.SetDisplayFormat(const AValue: TWatchDisplayFormat); +begin + if AValue = DisplayFormat then Exit; + inherited SetDisplayFormat(AValue); + if FMaster <> nil then FMaster.DisplayFormat := AValue; +end; + +procedure TIDEWatch.ResetMaster; +begin + if FMaster <> nil then FMaster.Slave := nil; + FMaster := nil; +end; + constructor TIDEWatch.Create(ACollection: TCollection); begin inherited Create(ACollection); @@ -4047,6 +4362,7 @@ end; destructor TIDEWatch.Destroy; begin + ResetMaster; if (TIDEWatches(Collection) <> nil) then TIDEWatches(Collection).NotifyRemove(Self); inherited Destroy; @@ -4169,16 +4485,19 @@ begin ANotification.AddReference; end; -constructor TIDEWatches.Create(const AWatchClass: TIDEWatchClass); +constructor TIDEWatches.Create; begin + FMaster := nil; FNotificationList := TList.Create; - inherited Create(AWatchClass); + inherited Create(TIDEWatch); end; destructor TIDEWatches.Destroy; var n: Integer; begin + if Master <> nil then FMaster.OnChange := nil; + for n := FNotificationList.Count - 1 downto 0 do TDebuggerNotification(FNotificationList[n]).ReleaseReference; @@ -4193,6 +4512,32 @@ begin Result := TIDEWatch(inherited Find(AExpression)); end; +procedure TIDEWatches.WatchesChanged(Sender: TObject); +begin + Changed; +end; + +procedure TIDEWatches.SetMaster(const AMaster: TDBGWatches); +var + n: Integer; +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then FMaster.OnChange := nil; + + FMaster := AMaster; + if FMaster = nil + then begin + for n := 0 to Count - 1 do + Items[n].ResetMaster; + end + else begin + FMaster.Assign(Self); + FMaster.OnChange := @WatchesChanged; + end; +end; + function TIDEWatches.GetItem(const AnIndex: Integer): TIDEWatch; begin Result := TIDEWatch(inherited GetItem(AnIndex)); @@ -4219,6 +4564,7 @@ procedure TIDEWatches.NotifyAdd(const AWatch: TIDEWatch); var n: Integer; Notification: TIDEWatchesNotification; + W: TDBGWatch; begin for n := 0 to FNotificationList.Count - 1 do begin @@ -4226,6 +4572,12 @@ begin if Assigned(Notification.FOnAdd) then Notification.FOnAdd(Self, AWatch); end; + + if FMaster <> nil + then begin + W := FMaster.Add(AWatch.Expression); + W.Assign(AWatch); + end; end; procedure TIDEWatches.NotifyRemove(const AWatch: TIDEWatch); @@ -4404,6 +4756,36 @@ begin FreeAndNil(FNotificationList); end; +procedure TIDELocals.LocalsChanged(Sender: TObject); +begin + NotifyChange; +end; + +procedure TIDELocals.SetMaster(const AMaster: TDBGLocals); +var + DoNotify: Boolean; +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then begin + FMaster.OnChange := nil; + DoNotify := FMaster.Count <> 0; + end + else DoNotify := False; + + FMaster := AMaster; + + if FMaster <> nil + then begin + FMaster.OnChange := @LocalsChanged; + DoNotify := DoNotify or (FMaster.Count <> 0); + end; + + if DoNotify + then NotifyChange; +end; + procedure TIDELocals.NotifyChange; var n: Integer; @@ -4417,12 +4799,33 @@ begin end; end; +function TIDELocals.GetName(const AnIndex: Integer): String; +begin + if Master = nil + then Result := inherited GetName(AnIndex) + else Result := Master.Names[AnIndex]; +end; + +function TIDELocals.GetValue(const AnIndex: Integer): String; +begin + if Master = nil + then Result := inherited GetValue(AnIndex) + else Result := Master.Values[AnIndex]; +end; + procedure TIDELocals.RemoveNotification(const ANotification: TIDELocalsNotification); begin FNotificationList.Remove(ANotification); ANotification.ReleaseReference; end; +function TIDELocals.Count: Integer; +begin + if Master = nil + then Result := 0 + else Result := Master.Count; +end; + { =========================================================================== } { TDBGLocals } { =========================================================================== } @@ -4558,6 +4961,72 @@ begin FreeAndNil(FNotificationList); end; +procedure TIDERegisters.RegistersChanged(Sender: TObject); +begin + NotifyChange; +end; + +procedure TIDERegisters.SetMaster(const AMaster: TDBGRegisters); +var + DoNotify: Boolean; +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then begin + FMaster.OnChange := nil; + DoNotify := FMaster.Count <> 0; + end + else DoNotify := False; + + FMaster := AMaster; + + if FMaster <> nil + then begin + FMaster.OnChange := @RegistersChanged; + DoNotify := DoNotify or (FMaster.Count <> 0); + end; + + if DoNotify + then NotifyChange; +end; + +function TIDERegisters.GetModified(const AnIndex: Integer): Boolean; +begin + if Master = nil + then Result := inherited GetModified(AnIndex) + else Result := Master.Modified[AnIndex]; +end; + +function TIDERegisters.GetName(const AnIndex: Integer): String; +begin + if Master = nil + then Result := inherited GetName(AnIndex) + else Result := Master.Names[AnIndex]; +end; + +function TIDERegisters.GetValue(const AnIndex: Integer): String; +begin + if Master = nil + then Result := inherited GetValue(AnIndex) + else Result := Master.Values[AnIndex]; +end; + +function TIDERegisters.GetFormat(const AnIndex: Integer): TRegisterDisplayFormat; +begin + if Master = nil + then Result := inherited GetFormat(AnIndex) + else Result := Master.Formats[AnIndex]; +end; + +procedure TIDERegisters.SetFormat(const AnIndex: Integer; + const AValue: TRegisterDisplayFormat); +begin + if Master = nil + then inherited SetFormat(AnIndex, AValue) + else Master.Formats[AnIndex] := AValue; +end; + procedure TIDERegisters.NotifyChange; var n: Integer; @@ -4577,6 +5046,13 @@ begin ANotification.ReleaseReference; end; +function TIDERegisters.Count: Integer; +begin + if Master = nil + then Result := 0 + else Result := Master.Count; +end; + { =========================================================================== } { TDBGRegisters } { =========================================================================== } @@ -4693,6 +5169,19 @@ begin Result := FunctionName + S; end; +function TCallStackEntry.IsCurrent: Boolean; +begin + Result := (FOwner <> nil) and (FOwner.CurrentIndex = Self.Index); + //TODO: check current thread +end; + +procedure TCallStackEntry.MakeCurrent; +begin + if FOwner = nil then Exit; + if IsCurrent then exit; + FOwner.CurrentIndex := self.Index; +end; + function TCallStackEntry.GetArgumentCount: Integer; begin Result := FArguments.Count; @@ -4709,11 +5198,6 @@ begin Result := GetPart('=', '', Result); end; -function TCallStackEntry.GetCurrent: Boolean; -begin - Result := (FOwner <> nil) and (FOwner.GetCurrent = Self) -end; - function TCallStackEntry.GetFullFileName: String; begin if FState = cseValid @@ -4737,16 +5221,6 @@ begin else Result := ''; end; -procedure TCallStackEntry.SetCurrent(const AValue: Boolean); -begin - if FOwner = nil then Exit; - if GetCurrent = AValue then Exit; - - if AValue - then FOwner.SetCurrent(self) - else FOwner.SetCurrent(nil); -end; - { =========================================================================== } { TBaseCallStack } { =========================================================================== } @@ -4774,9 +5248,9 @@ begin inherited Destroy; end; -function TBaseCallStack.GetCurrent: TCallStackEntry; +function TBaseCallStack.GetCurrent: Integer; begin - Result := nil; + Result := -1; end; function TBaseCallStack.GetEntry(AIndex: Integer): TCallStackEntry; @@ -4813,7 +5287,7 @@ begin FCount := ACount; end; -procedure TBaseCallStack.SetCurrent(AValue: TCallStackEntry); +procedure TBaseCallStack.SetCurrent(AValue: Integer); begin end; @@ -4846,6 +5320,90 @@ begin FreeAndNil(FNotificationList); end; +procedure TIDECallStack.SetMaster(const AMaster: TDBGCallStack); +var + DoNotify: Boolean; +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then begin + FMaster.OnChange := nil; + FMaster.OnClear := nil; + FMaster.OnCurrent := nil; + DoNotify := FMaster.Count <> 0; + end + else DoNotify := False; + + FMaster := AMaster; + + if FMaster = nil + then begin + SetCount(0); + end + else begin + FMaster.OnChange := @CallStackChanged; + FMaster.OnClear := @CallStackClear; + FMaster.OnCurrent := @CallStackCurrent; + DoNotify := DoNotify or (FMaster.Count <> 0); + end; + + if DoNotify + then NotifyChange; +end; + +function TIDECallStack.CheckCount: Boolean; +begin + Result := Master <> nil; + if Result + then SetCount(Master.Count); +end; + +function TIDECallStack.GetCurrent: Integer; +begin + if Master = nil + then Result := -1 + else Result := Master.CurrentIndex; +end; + +function TIDECallStack.InternalGetEntry(AIndex: Integer): TCallStackEntry; +begin + Assert(FMaster <> nil); + Result := FMaster.Entries[AIndex]; +end; + +procedure TIDECallStack.SetCurrent(AValue: Integer); +begin + if Master = nil then Exit; + Master.CurrentIndex := AValue; +end; + +procedure TIDECallStack.PrepareRange(AIndex, ACount: Integer); +begin + if FMaster <> nil + then FMaster.PrepareRange(AIndex, ACount) + else inherited PrepareRange(AIndex, ACount); +end; + +procedure TIDECallStack.CallStackChanged(Sender: TObject); +begin + // Clear it first to force the count update + Clear; + NotifyChange; +end; + +procedure TIDECallStack.CallStackClear(Sender: TObject); +begin + // Don't clear, set it to 0 so there are no entries shown + SetCount(0); + NotifyChange; +end; + +procedure TIDECallStack.CallStackCurrent(Sender: TObject); +begin + NotifyCurrent; +end; + procedure TIDECallStack.NotifyChange; var n: Integer; @@ -5085,6 +5643,16 @@ end; { TIDESignal } { =========================================================================== } +procedure TIDESignal.AssignTo(Dest: TPersistent); +begin + inherited AssignTo(Dest); + if (TIDESignals(Collection).FMaster <> nil) + and (Dest is TDBGSignal) + then begin + FMaster := TDBGSignal(Dest); + end; +end; + procedure TIDESignal.LoadFromXMLConfig (const AXMLConfig: TXMLConfig; const APath: string ); begin // TODO @@ -5095,6 +5663,11 @@ begin // TODO end; +procedure TIDESignal.ResetMaster; +begin + FMaster := nil; +end; + { =========================================================================== } { TBaseSignals } { =========================================================================== } @@ -5181,6 +5754,22 @@ begin Result := TIDESignal(inherited Find(AName)); end; +procedure TIDESignals.SetMaster(const AValue: TDBGSignals); +var + n: Integer; +begin + if FMaster = AValue then Exit; + FMaster := AValue; + if FMaster = nil + then begin + for n := 0 to Count - 1 do + Items[n].ResetMaster; + end + else begin + FMaster.Assign(Self); + end; +end; + function TIDESignals.GetItem(const AIndex: Integer): TIDESignal; begin Result := TIDESignal(inherited GetItem(AIndex)); @@ -5201,6 +5790,24 @@ begin inherited SetItem(AIndex, AValue); end; +procedure TIDESignals.AddDefault; +begin + // todo: add default signals +end; + +constructor TIDESignals.Create; +begin + FMaster := nil; + inherited Create(TIDESignal); + AddDefault; +end; + +procedure TIDESignals.Reset; +begin + inherited Reset; + AddDefault; +end; + { =========================================================================== } { TBaseException } { =========================================================================== } @@ -5266,6 +5873,30 @@ begin AXMLConfig.SetDeleteValue(APath+'Enabled/Value',FEnabled,true); end; +procedure TIDEException.ResetMaster; +begin + FMaster := nil; +end; + +procedure TIDEException.DoChanged; +var + E: TDBGExceptions; +begin + E := TIDEExceptions(Collection).FMaster; + if ((FMaster = nil) = Enabled) and (E <> nil) + then begin + if Enabled then + begin + FMaster := E.Find(Name); + if FMaster = nil then + FMaster := E.Add(Name); + end + else FreeAndNil(FMaster); + end; + + inherited DoChanged; +end; + procedure TIDEException.SetEnabled(const AValue: Boolean); begin if FEnabled = AValue then Exit; @@ -5382,6 +6013,38 @@ begin Result := TIDEException(inherited Find(AName)); end; +constructor TIDEExceptions.Create; +begin + FMaster := nil; + inherited Create(TIDEException); + AddDefault; +end; + +procedure TIDEExceptions.SetMaster(const AValue: TDBGExceptions); +var + n: Integer; + Item: TIDEException; +begin + if FMaster = AValue then Exit; + Assert((FMaster=nil) or (AValue=nil), 'TManagedExceptions already has a Master'); + FMaster := AValue; + if FMaster = nil + then begin + for n := 0 to Count - 1 do + Items[n].ResetMaster; + end + else begin + // Do not assign, add only enabled exceptions + for n := 0 to Count - 1 do + begin + Item := Items[n]; + if Item.Enabled and (FMaster.Find(Item.Name) = nil) + then FMaster.Add(Item.Name); + end; + FMaster.IgnoreAll := IgnoreAll; + end; +end; + function TIDEExceptions.GetItem(const AIndex: Integer): TIDEException; begin Result := TIDEException(inherited GetItem(AIndex)); @@ -5423,12 +6086,31 @@ begin end; end; +procedure TIDEExceptions.AddIfNeeded(AName: string); +begin + if Find(AName) = nil then + Add(AName); +end; + +procedure TIDEExceptions.Reset; +begin + inherited Reset; + AddDefault; +end; + procedure TIDEExceptions.SetItem(const AIndex: Integer; const AValue: TIDEException); begin inherited SetItem(Aindex, AValue); end; +procedure TIDEExceptions.AddDefault; +begin + AddIfNeeded('EAbort'); + AddIfNeeded('ECodetoolError'); + AddIfNeeded('EFOpenError'); +end; + procedure DoFinalization; var n: Integer; @@ -5489,6 +6171,35 @@ end; { TIDELineInfo } +procedure TIDELineInfo.LineInfoChanged(const ASender: TObject; const ASource: String); +begin + NotifyChange(ASource); +end; + +procedure TIDELineInfo.SetMaster(const AMaster: TDBGLineInfo); +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then begin + FMaster.OnChange := nil; + end; + + FMaster := AMaster; + + if FMaster <> nil + then begin + FMaster.OnChange := @LineInfoChanged; + end; +end; + +function TIDELineInfo.GetSource(const AIndex: Integer): String; +begin + if Master = nil + then Result := inherited GetSource(AIndex) + else Result := Master.Sources[AIndex]; +end; + procedure TIDELineInfo.NotifyChange(ASource: String); var n: Integer; @@ -5535,6 +6246,42 @@ begin end; end; +function TIDELineInfo.Count: Integer; +begin + if Master = nil + then Result := inherited Count + else Result := Master.Count; +end; + +function TIDELineInfo.GetAddress(const AIndex: Integer; const ALine: Integer): TDbgPtr; +begin + if Master = nil + then Result := inherited GetAddress(AIndex, ALine) + else Result := Master.GetAddress(AIndex, ALine); +end; + +function TIDELineInfo.GetInfo(AAdress: TDbgPtr; out ASource, ALine, + AOffset: Integer): Boolean; +begin + if Master = nil + then Result := inherited GetInfo(AAdress, ASource, ALine, AOffset) + else Result := Master.GetInfo(AAdress, ASource, ALine, AOffset); +end; + +function TIDELineInfo.IndexOf(const ASource: String): integer; +begin + if Master = nil + then Result := inherited IndexOf(ASource) + else Result := Master.IndexOf(ASource); +end; + +procedure TIDELineInfo.Request(const ASource: String); +begin + if Master = nil + then inherited Request(ASource) + else Master.Request(ASource); +end; + { TDBGLineInfo } procedure TDBGLineInfo.Changed(ASource: String); @@ -5700,11 +6447,39 @@ end; { TIDEDisassembler } +procedure TIDEDisassembler.DisassemblerChanged(Sender: TObject); +begin + Changed; +end; + +procedure TIDEDisassembler.SetMaster(AMaster: TDBGDisassembler); +begin + if FMaster = AMaster then Exit; + + if FMaster <> nil + then FMaster.OnChange := nil; + + FMaster := AMaster; + + if FMaster <> nil + then FMaster.OnChange := @DisassemblerChanged; + + Changed; +end; + procedure TIDEDisassembler.DoChanged; var n: Integer; Notification: TIDEDisassemblerNotification; begin + if FMaster <> nil + then begin + SetCountBefore(FMaster.CountBefore); + SetCountAfter(FMaster.CountAfter); + SetBaseAddr(FMaster.BaseAddr); + end + else Clear; + for n := 0 to FNotificationList.Count - 1 do begin Notification := TIDEDisassemblerNotification(FNotificationList[n]); @@ -5713,6 +6488,20 @@ begin end; end; +function TIDEDisassembler.InternalGetEntry(AIndex: Integer): TDisassemblerEntry; +begin + if FMaster <> nil + then Result := FMaster.Entries[AIndex] + else Result := inherited InternalGetEntry(AIndex); +end; + +function TIDEDisassembler.InternalGetEntryPtr(AIndex: Integer): PDisassemblerEntry; +begin + if FMaster <> nil + then Result := FMaster.EntriesPtr[AIndex] + else Result := inherited InternalGetEntryPtr(AIndex); +end; + constructor TIDEDisassembler.Create; begin FNotificationList := TList.Create; @@ -5742,6 +6531,24 @@ begin ANotification.ReleaseReference; end; +procedure TIDEDisassembler.Clear; +begin + if FMaster <> nil + then FMaster.Clear + else inherited Clear; +end; + +function TIDEDisassembler.PrepareRange(AnAddr: TDbgPtr; ALinesBefore, + ALinesAfter: Integer): Boolean; +begin + if (AnAddr = BaseAddr) and (ALinesBefore < CountBefore) and (ALinesAfter < CountAfter) + then exit(True); + + if FMaster <> nil + then Result := FMaster.PrepareRange(AnAddr, ALinesBefore, ALinesAfter) + else Result := inherited PrepareRange(AnAddr, ALinesBefore, ALinesAfter); +end; + { TDBGDisassemblerEntryRange } function TDBGDisassemblerEntryRange.GetEntry(Index: Integer): TDisassemblerEntry; diff --git a/debugger/gdbmidebugger.pp b/debugger/gdbmidebugger.pp index 6465c9b25b..d1fb48d365 100644 --- a/debugger/gdbmidebugger.pp +++ b/debugger/gdbmidebugger.pp @@ -958,8 +958,8 @@ type function CreateStackEntry(AIndex: Integer): TCallStackEntry; override; procedure PrepareEntries(AIndex, ACount: Integer); override; - function GetCurrent: TCallStackEntry; override; - procedure SetCurrent(AValue: TCallStackEntry); override; + function GetCurrent: Integer; override; + procedure SetCurrent(AValue: Integer); override; procedure DoThreadChanged; public end; @@ -7346,14 +7346,9 @@ begin FreeAndNil(FrameList); end; -function TGDBMICallStack.GetCurrent: TCallStackEntry; -var - idx: Integer; +function TGDBMICallStack.GetCurrent: Integer; begin - idx := TGDBMIDebugger(Debugger).FCurrentStackFrame; - if (idx < 0) or (idx >= Count) - then Result := nil - else Result := Entries[idx]; + Result := TGDBMIDebugger(Debugger).FCurrentStackFrame; end; procedure TGDBMICallStack.DoFramesCommandExecuted(Sender: TObject); @@ -7432,9 +7427,9 @@ begin FInEvalFrames := False; end; -procedure TGDBMICallStack.SetCurrent(AValue: TCallStackEntry); +procedure TGDBMICallStack.SetCurrent(AValue: Integer); begin - TGDBMIDebugger(Debugger).CallStackSetCurrent(AValue.Index); + TGDBMIDebugger(Debugger).CallStackSetCurrent(AValue); end; procedure TGDBMICallStack.DoThreadChanged; diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 07d269e81f..2dfca7d2d1 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -228,7 +228,6 @@ type TManagedBreakPoint = class(TIDEBreakPoint) private - FMaster: TDBGBreakPoint; FSourceMark: TSourceMark; FCurrentDebugExeLine: Integer; procedure OnSourceMarkBeforeFree(Sender: TObject); @@ -240,23 +239,14 @@ type procedure OnDeleteMenuItemClick(Sender: TObject); procedure OnViewPropertiesMenuItemClick(Sender: TObject); protected - procedure AssignLocationTo(Dest: TPersistent); override; - procedure AssignTo(Dest: TPersistent); override; procedure DoChanged; override; - function GetHitCount: Integer; override; - function GetValid: TValidState; override; - procedure SetBreakHitCount(const AValue: Integer); override; - procedure SetEnabled(const AValue: Boolean); override; - procedure SetInitialEnabled(const AValue: Boolean); override; - procedure SetExpression(const AValue: String); override; + procedure SetSourceMark(const AValue: TSourceMark); procedure UpdateSourceMark; procedure UpdateSourceMarkImage; procedure UpdateSourceMarkLineColor; - function DebugExeLine: Integer; // If known, the line in the compiled exe + function DebugExeLine: Integer; override; // If known, the line in the compiled exe public - destructor Destroy; override; - procedure ResetMaster; procedure CopySourcePositionToBreakPoint; procedure SetLocation(const ASource: String; const ALine: Integer); override; property SourceMark: TSourceMark read FSourceMark write SetSourceMark; @@ -264,870 +254,54 @@ type TManagedBreakPoints = class(TIDEBreakPoints) private - FMaster: TDBGBreakPoints; FManager: TDebugManager; - procedure SetMaster(const AValue: TDBGBreakPoints); protected procedure NotifyAdd(const ABreakPoint: TIDEBreakPoint); override; procedure NotifyRemove(const ABreakPoint: TIDEBreakPoint); override; public constructor Create(const AManager: TDebugManager); - property Master: TDBGBreakPoints read FMaster write SetMaster; end; - { TManagedWatch } + { TProjectExceptions } - TManagedWatch = class(TIDEWatch) - private - FMaster: TDBGWatch; + TProjectExceptions = class(TIDEExceptions) protected - procedure AssignTo(Dest: TPersistent); override; - procedure DoChanged; override; - function GetValid: TValidState; override; - function GetValue: String; override; - function GetTypeInfo: TDBGType; override; - procedure SetEnabled(const AValue: Boolean); override; - procedure SetExpression(const AValue: String); override; - procedure SetDisplayFormat(const AValue: TWatchDisplayFormat); override; - public - destructor Destroy; override; - procedure ResetMaster; - end; - - { TManagedWatches } - - TManagedWatches = class(TIDEWatches) - private - FMaster: TDBGWatches; - FManager: TDebugManager; - procedure WatchesChanged(Sender: TObject); - procedure SetMaster(const AMaster: TDBGWatches); - protected - procedure NotifyAdd(const AWatch: TIDEWatch); override; - procedure NotifyRemove(const AWatch: TIDEWatch); override; - public - constructor Create(const AManager: TDebugManager); - destructor Destroy; override; - property Master: TDBGWatches read FMaster write SetMaster; - end; - - { TManagedLocals } - - TManagedLocals = class(TIDELocals) - private - FMaster: TDBGLocals; - procedure LocalsChanged(Sender: TObject); - procedure SetMaster(const AMaster: TDBGLocals); - protected - function GetName(const AnIndex: Integer): String; override; - function GetValue(const AnIndex: Integer): String; override; - public - function Count: Integer; override; - property Master: TDBGLocals read FMaster write SetMaster; - end; - - { TManagedLineInfo } - - TManagedLineInfo = class(TIDELineInfo) - private - FMaster: TDBGLineInfo; - procedure LineInfoChanged(const ASender: TObject; const ASource: String); - procedure SetMaster(const AMaster: TDBGLineInfo); - protected - function GetSource(const AIndex: Integer): String; override; - public - function Count: Integer; override; - function GetAddress(const AIndex: Integer; const ALine: Integer): TDbgPtr; override; - function GetInfo(AAdress: TDbgPtr; out ASource, ALine, AOffset: Integer): Boolean; override; - function IndexOf(const ASource: String): integer; override; - procedure Request(const ASource: String); override; - property Master: TDBGLineInfo read FMaster write SetMaster; - end; - - { TManagedRegisters } - - TManagedRegisters = class(TIDERegisters) - private - FMaster: TDBGRegisters; - procedure RegistersChanged(Sender: TObject); - procedure SetMaster(const AMaster: TDBGRegisters); - protected - function GetModified(const AnIndex: Integer): Boolean; override; - function GetName(const AnIndex: Integer): String; override; - function GetValue(const AnIndex: Integer): String; override; - function GetFormat(const AnIndex: Integer): TRegisterDisplayFormat; override; - procedure SetFormat(const AnIndex: Integer; const AValue: TRegisterDisplayFormat); override; - public - function Count: Integer; override; - property Master: TDBGRegisters read FMaster write SetMaster; - end; - - { TManagedCallStack } - - TManagedCallStack = class(TIDECallStack) - private - FMaster: TDBGCallStack; - procedure CallStackChanged(Sender: TObject); - procedure CallStackClear(Sender: TObject); - procedure CallStackCurrent(Sender: TObject); - procedure SetMaster(AMaster: TDBGCallStack); - protected - function CheckCount: Boolean; override; - function GetCurrent: TCallStackEntry; override; - function InternalGetEntry(AIndex: Integer): TCallStackEntry; override; - procedure SetCurrent(AValue: TCallStackEntry); override; - public - procedure PrepareRange(AIndex, ACount: Integer); override; - property Master: TDBGCallStack read FMaster write SetMaster; - end; - - { TManagedDisassembler } - - TManagedDisassembler = class(TIDEDisassembler) - private - FMaster: TDBGDisassembler; - procedure DisassemblerChanged(Sender: TObject); - procedure SetMaster(AMaster: TDBGDisassembler); - protected - procedure DoChanged; override; - function InternalGetEntry(AIndex: Integer): TDisassemblerEntry; override; - function InternalGetEntryPtr(AIndex: Integer): PDisassemblerEntry; override; - public - procedure Clear; override; - function PrepareRange(AnAddr: TDbgPtr; ALinesBefore, ALinesAfter: Integer): Boolean; override; - property Master: TDBGDisassembler read FMaster write SetMaster; - end; - - TManagedSignal = class(TIDESignal) - private - FMaster: TDBGSignal; - protected - procedure AssignTo(Dest: TPersistent); override; - public - procedure ResetMaster; - end; - - { TManagedSignals } - - TManagedSignals = class(TIDESignals) - private - FMaster: TDBGSignals; - FManager: TDebugManager; - procedure SetMaster(const AValue: TDBGSignals); - protected - procedure AddDefault; - public - constructor Create(const AManager: TDebugManager); - procedure Reset; override; - property Master: TDBGSignals read FMaster write SetMaster; - end; - - TManagedException = class(TIDEException) - private - FMaster: TDBGException; - protected - procedure DoChanged; override; - public - procedure ResetMaster; - end; - - { TManagedExceptions } - - TManagedExceptions = class(TIDEExceptions) - private - FMaster: TDBGExceptions; - FManager: TDebugManager; - procedure SetMaster(const AValue: TDBGExceptions); - protected - procedure AddDefault; procedure SetIgnoreAll(const AValue: Boolean); override; procedure Notify(Item: TCollectionItem; Action: TCollectionNotification); override; - public - constructor Create(const AManager: TDebugManager); - procedure AddIfNeeded(AName: string); - procedure Reset; override; - property Master: TDBGExceptions read FMaster write SetMaster; end; TDBGEventCategories = set of TDBGEventCategory; -{ TManagedDisassembler } +{ TProjectExceptions } -procedure TManagedDisassembler.DisassemblerChanged(Sender: TObject); -begin - Changed; -end; - -procedure TManagedDisassembler.SetMaster(AMaster: TDBGDisassembler); -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then FMaster.OnChange := nil; - - FMaster := AMaster; - - if FMaster <> nil - then FMaster.OnChange := @DisassemblerChanged; - - Changed; -end; - -procedure TManagedDisassembler.DoChanged; -begin - if FMaster <> nil - then begin - SetCountBefore(FMaster.CountBefore); - SetCountAfter(FMaster.CountAfter); - SetBaseAddr(FMaster.BaseAddr); - end - else Clear; - inherited DoChanged; -end; - -function TManagedDisassembler.InternalGetEntry(AIndex: Integer): TDisassemblerEntry; -begin - if FMaster <> nil - then Result := FMaster.Entries[AIndex] - else Result := inherited InternalGetEntry(AIndex); -end; - -function TManagedDisassembler.InternalGetEntryPtr(AIndex: Integer): PDisassemblerEntry; -begin - if FMaster <> nil - then Result := FMaster.EntriesPtr[AIndex] - else Result := inherited InternalGetEntryPtr(AIndex); -end; - -procedure TManagedDisassembler.Clear; -begin - if FMaster <> nil - then FMaster.Clear - else inherited Clear; -end; - -function TManagedDisassembler.PrepareRange(AnAddr: TDbgPtr; ALinesBefore, - ALinesAfter: Integer): Boolean; -begin - if (AnAddr = BaseAddr) and (ALinesBefore < CountBefore) and (ALinesAfter < CountAfter) - then exit(True); - - if FMaster <> nil - then Result := FMaster.PrepareRange(AnAddr, ALinesBefore, ALinesAfter) - else Result := inherited PrepareRange(AnAddr, ALinesBefore, ALinesAfter); -end; - -{ TManagedLineInfo } - -procedure TManagedLineInfo.LineInfoChanged(const ASender: TObject; const ASource: String); -begin - NotifyChange(ASource); -end; - -procedure TManagedLineInfo.SetMaster(const AMaster: TDBGLineInfo); -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then begin - FMaster.OnChange := nil; - end; - - FMaster := AMaster; - - if FMaster <> nil - then begin - FMaster.OnChange := @LineInfoChanged; - end; -end; - -function TManagedLineInfo.GetSource(const AIndex: Integer): String; -begin - if Master = nil - then Result := inherited GetSource(AIndex) - else Result := Master.Sources[AIndex]; -end; - -function TManagedLineInfo.GetAddress(const AIndex: Integer; const ALine: Integer): TDbgPtr; -begin - if Master = nil - then Result := inherited GetAddress(AIndex, ALine) - else Result := Master.GetAddress(AIndex, ALine); -end; - -function TManagedLineInfo.GetInfo(AAdress: TDbgPtr; out ASource, ALine, AOffset: Integer): Boolean; -begin - if Master = nil - then Result := inherited GetInfo(AAdress, ASource, ALine, AOffset) - else Result := Master.GetInfo(AAdress, ASource, ALine, AOffset); -end; - -function TManagedLineInfo.IndexOf(const ASource: String): integer; -begin - if Master = nil - then Result := inherited IndexOf(ASource) - else Result := Master.IndexOf(ASource); -end; - -function TManagedLineInfo.Count: Integer; -begin - if Master = nil - then Result := inherited Count - else Result := Master.Count; -end; - -procedure TManagedLineInfo.Request(const ASource: String); -begin - if Master = nil - then inherited Request(ASource) - else Master.Request(ASource); -end; - -{ TManagedCallStack } - -procedure TManagedCallStack.CallStackChanged(Sender: TObject); -begin - // Clear it first to force the count update - Clear; - NotifyChange; -end; - -procedure TManagedCallStack.CallStackClear(Sender: TObject); -begin - // Don't clear, set it to 0 so there are no entries shown - SetCount(0); - NotifyChange; -end; - -procedure TManagedCallStack.CallStackCurrent(Sender: TObject); -begin - NotifyCurrent; -end; - -function TManagedCallStack.CheckCount: Boolean; -begin - Result := Master <> nil; - if Result - then SetCount(Master.Count); -end; - -function TManagedCallStack.GetCurrent: TCallStackEntry; -begin - if Master = nil - then Result := nil - else Result := Master.Current; -end; - -function TManagedCallStack.InternalGetEntry(AIndex: Integer): TCallStackEntry; -begin - Assert(FMaster <> nil); - - Result := FMaster.Entries[AIndex]; -end; - -procedure TManagedCallStack.SetCurrent(AValue: TCallStackEntry); -begin - if Master = nil then Exit; - - Master.Current := AValue; -end; - -procedure TManagedCallStack.PrepareRange(AIndex, ACount: Integer); -begin - if FMaster <> nil - then FMaster.PrepareRange(AIndex, ACount) - else inherited PrepareRange(AIndex, ACount); -end; - -procedure TManagedCallStack.SetMaster(AMaster: TDBGCallStack); -var - DoNotify: Boolean; -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then begin - FMaster.OnChange := nil; - FMaster.OnClear := nil; - FMaster.OnCurrent := nil; - DoNotify := FMaster.Count <> 0; - end - else DoNotify := False; - - FMaster := AMaster; - - if FMaster = nil - then begin - SetCount(0); - end - else begin - FMaster.OnChange := @CallStackChanged; - FMaster.OnClear := @CallStackClear; - FMaster.OnCurrent := @CallStackCurrent; - DoNotify := DoNotify or (FMaster.Count <> 0); - end; - - if DoNotify - then NotifyChange; -end; - -{ TManagedLocals } - -procedure TManagedLocals.LocalsChanged(Sender: TObject); -begin - NotifyChange; -end; - -procedure TManagedLocals.SetMaster(const AMaster: TDBGLocals); -var - DoNotify: Boolean; -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then begin - FMaster.OnChange := nil; - DoNotify := FMaster.Count <> 0; - end - else DoNotify := False; - - FMaster := AMaster; - - if FMaster <> nil - then begin - FMaster.OnChange := @LocalsChanged; - DoNotify := DoNotify or (FMaster.Count <> 0); - end; - - if DoNotify - then NotifyChange; -end; - -function TManagedLocals.GetName(const AnIndex: Integer): String; -begin - if Master = nil - then Result := inherited GetName(AnIndex) - else Result := Master.Names[AnIndex]; -end; - -function TManagedLocals.GetValue(const AnIndex: Integer): String; -begin - if Master = nil - then Result := inherited GetValue(AnIndex) - else Result := Master.Values[AnIndex]; -end; - -function TManagedLocals.Count: Integer; -begin - if Master = nil - then Result := 0 - else Result := Master.Count; -end; - -{ TManagedRegisters } - -procedure TManagedRegisters.RegistersChanged(Sender: TObject); -begin - NotifyChange; -end; - -procedure TManagedRegisters.SetMaster(const AMaster: TDBGRegisters); -var - DoNotify: Boolean; -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then begin - FMaster.OnChange := nil; - DoNotify := FMaster.Count <> 0; - end - else DoNotify := False; - - FMaster := AMaster; - - if FMaster <> nil - then begin - FMaster.OnChange := @RegistersChanged; - DoNotify := DoNotify or (FMaster.Count <> 0); - end; - - if DoNotify - then NotifyChange; -end; - -function TManagedRegisters.GetModified(const AnIndex: Integer): Boolean; -begin - if Master = nil - then Result := inherited GetModified(AnIndex) - else Result := Master.Modified[AnIndex]; -end; - -function TManagedRegisters.GetName(const AnIndex: Integer): String; -begin - if Master = nil - then Result := inherited GetName(AnIndex) - else Result := Master.Names[AnIndex]; -end; - -function TManagedRegisters.GetValue(const AnIndex: Integer): String; -begin - if Master = nil - then Result := inherited GetValue(AnIndex) - else Result := Master.Values[AnIndex]; -end; - -function TManagedRegisters.GetFormat(const AnIndex: Integer): TRegisterDisplayFormat; -begin - if Master = nil - then Result := inherited GetFormat(AnIndex) - else Result := Master.Formats[AnIndex]; -end; - -procedure TManagedRegisters.SetFormat(const AnIndex: Integer; - const AValue: TRegisterDisplayFormat); -begin - if Master = nil - then inherited SetFormat(AnIndex, AValue) - else Master.Formats[AnIndex] := AValue; -end; - -function TManagedRegisters.Count: Integer; -begin - if Master = nil - then Result := 0 - else Result := Master.Count; -end; - -{ TManagedWatch } - -procedure TManagedWatch.AssignTo(Dest: TPersistent); -begin - inherited AssignTo(Dest); - if (TManagedWatches(GetOwner).FMaster <> nil) - and (Dest is TDBGWatch) - then begin - Assert(FMaster=nil, 'TManagedWatch.AssignTo already has a master'); - if FMaster<>nil then FMaster.Slave := nil; - FMaster := TDBGWatch(Dest); - FMaster.Slave := Self; - end; -end; - -procedure TManagedWatch.DoChanged; -begin - if (FMaster <> nil) - and (FMaster.Slave = nil) - then FMaster := nil; - - inherited DoChanged; -end; - -function TManagedWatch.GetValid: TValidState; -begin - if FMaster = nil - then Result := inherited GetValid - else Result := FMaster.Valid; -end; - -function TManagedWatch.GetValue: String; -begin - if FMaster = nil - then Result := inherited GetValue - else Result := FMaster.Value; -end; - -function TManagedWatch.GetTypeInfo: TDBGType; -begin - if FMaster = nil - then Result := inherited GetTypeInfo - else Result := FMaster.TypeInfo; -end; - -procedure TManagedWatch.SetEnabled(const AValue: Boolean); -begin - if Enabled = AValue then Exit; - inherited SetEnabled(AValue); - if FMaster <> nil then FMaster.Enabled := AValue; -end; - -procedure TManagedWatch.SetExpression(const AValue: String); -begin - if AValue = Expression then Exit; - inherited SetExpression(AValue); - if FMaster <> nil then FMaster.Expression := AValue; -end; - -procedure TManagedWatch.SetDisplayFormat(const AValue: TWatchDisplayFormat); -begin - if AValue = DisplayFormat then Exit; - inherited SetDisplayFormat(AValue); - if FMaster <> nil then FMaster.DisplayFormat := AValue; -end; - -destructor TManagedWatch.Destroy; -begin - ResetMaster; - inherited Destroy; -end; - -procedure TManagedWatch.ResetMaster; -begin - if FMaster <> nil then FMaster.Slave := nil; - FMaster := nil; -end; - -{ TManagedWatches } - -procedure TManagedWatches.SetMaster(const AMaster: TDBGWatches); -var - n: Integer; -begin - if FMaster = AMaster then Exit; - - if FMaster <> nil - then FMaster.OnChange := nil; - - FMaster := AMaster; - if FMaster = nil - then begin - for n := 0 to Count - 1 do - TManagedWatch(Items[n]).ResetMaster; - end - else begin - FMaster.Assign(Self); - FMaster.OnChange := @WatchesChanged; - end; -end; - -procedure TManagedWatches.WatchesChanged(Sender: TObject); -begin - Changed; -end; - -procedure TManagedWatches.NotifyAdd(const AWatch: TIDEWatch); -var - W: TDBGWatch; -begin - inherited; - - if FManager.FDebugger <> nil - then begin - W := FManager.FDebugger.Watches.Add(AWatch.Expression); - W.Assign(AWatch); - end; -end; - -procedure TManagedWatches.NotifyRemove(const AWatch: TIDEWatch); -begin - inherited NotifyRemove(AWatch); -end; - -constructor TManagedWatches.Create(const AManager: TDebugManager); -begin - FMaster := nil; - FManager := AManager; - inherited Create(TManagedWatch); -end; - -destructor TManagedWatches.Destroy; -begin - if Master <> nil then FMaster.OnChange := nil; - inherited Destroy; -end; - -{ TManagedException } - -procedure TManagedException.DoChanged; -var - E: TDBGExceptions; -begin - E := TManagedExceptions(GetOwner).FMaster; - if ((FMaster = nil) = Enabled) and (E <> nil) - then begin - if Enabled then - begin - FMaster := E.Find(Name); - if FMaster = nil then - FMaster := E.Add(Name); - end - else FreeAndNil(FMaster); - end; - - inherited DoChanged; -end; - -procedure TManagedException.ResetMaster; -begin - FMaster := nil; -end; - -{ TManagedExceptions } - -constructor TManagedExceptions.Create(const AManager: TDebugManager); -begin - FMaster := nil; - FManager := AManager; - inherited Create(TManagedException); - AddDefault; -end; - -procedure TManagedExceptions.Reset; -begin - inherited Reset; - AddDefault; -end; - -procedure TManagedExceptions.SetMaster(const AValue: TDBGExceptions); -var - n: Integer; - Item: TIDEException; -begin - if FMaster = AValue then Exit; - Assert((FMaster=nil) or (AValue=nil), 'TManagedExceptions already has a Master'); - FMaster := AValue; - if FMaster = nil - then begin - for n := 0 to Count - 1 do - TManagedException(Items[n]).ResetMaster; - end - else begin - // Do not assign, add only enabled exceptions - for n := 0 to Count - 1 do - begin - Item := Items[n]; - if Item.Enabled and (FMaster.Find(Item.Name) = nil) - then FMaster.Add(Item.Name); - end; - FMaster.IgnoreAll := IgnoreAll; - end; -end; - -procedure TManagedExceptions.AddDefault; -begin - AddIfNeeded('EAbort'); - AddIfNeeded('ECodetoolError'); - AddIfNeeded('EFOpenError'); -end; - -procedure TManagedExceptions.SetIgnoreAll(const AValue: Boolean); +procedure TProjectExceptions.SetIgnoreAll(const AValue: Boolean); begin inherited SetIgnoreAll(AValue); Project1.Modified := True; end; -procedure TManagedExceptions.Notify(Item: TCollectionItem; - Action: TCollectionNotification); +procedure TProjectExceptions.Notify(Item: TCollectionItem; Action: TCollectionNotification); begin inherited Notify(Item, Action); if Project1 <> nil then Project1.Modified := True; end; -procedure TManagedExceptions.AddIfNeeded(AName: string); -begin - if Find(AName) = nil then - Add(AName); -end; - -{ TManagedSignal } - -procedure TManagedSignal.AssignTo (Dest: TPersistent ); -begin - inherited AssignTo(Dest); - if (TManagedSignals(GetOwner).FMaster <> nil) - and (Dest is TDBGSignal) - then begin - FMaster := TDBGSignal(Dest); - end; -end; - -procedure TManagedSignal.ResetMaster; -begin - FMaster := nil; -end; - -{ TManagedSignals } - -constructor TManagedSignals.Create(const AManager: TDebugManager); -begin - FMaster := nil; - FManager := AManager; - inherited Create(TManagedSignal); - AddDefault; -end; - -procedure TManagedSignals.Reset; -begin - inherited Reset; - AddDefault; -end; - -procedure TManagedSignals.SetMaster(const AValue: TDBGSignals); -var - n: Integer; -begin - if FMaster = AValue then Exit; - FMaster := AValue; - if FMaster = nil - then begin - for n := 0 to Count - 1 do - TManagedSignal(Items[n]).ResetMaster; - end - else begin - FMaster.Assign(Self); - end; -end; - -procedure TManagedSignals.AddDefault; -begin - // todo: add default signals -end; - { TManagedBreakPoints } constructor TManagedBreakPoints.Create(const AManager: TDebugManager); begin - FMaster := nil; FManager := AManager; inherited Create(TManagedBreakPoint); end; -procedure TManagedBreakPoints.SetMaster(const AValue: TDBGBreakPoints); -var - n: Integer; -begin - if FMaster = AValue then Exit; - - FMaster := AValue; - if FMaster = nil - then begin - for n := 0 to Count - 1 do - TManagedBreakPoint(Items[n]).ResetMaster; - end - else begin - FMaster.Assign(Self); - end; -end; - procedure TManagedBreakPoints.NotifyAdd(const ABreakPoint: TIDEBreakPoint); -var - BP: TBaseBreakPoint; begin {$ifdef VerboseDebugger} debugln('TManagedBreakPoints.NotifyAdd A ',ABreakpoint.Source,' ',IntToStr(ABreakpoint.Line)); {$endif} - ABreakpoint.InitialEnabled := True; - ABreakpoint.Enabled := True; - inherited; - if FManager.FDebugger <> nil - then begin - // create without source. it will be set in assign (but during Begin/EndUpdate) - BP := FManager.FDebugger.BreakPoints.Add('', 0); - BP.Assign(ABreakPoint); - end; FManager.CreateSourceMarkForBreakPoint(ABreakpoint,nil); Project1.Modified := True; end; @@ -1194,16 +368,6 @@ begin DebugBoss.ShowBreakPointProperties(Self); end; -procedure TManagedBreakPoint.AssignLocationTo(Dest: TPersistent); -var - DestBreakPoint: TBaseBreakPoint absolute Dest; -begin - if DestBreakPoint is TDBGBreakPoint then - DestBreakPoint.SetLocation(Source, DebugExeLine) - else - inherited; -end; - procedure TManagedBreakPoint.OnSourceMarkBeforeFree(Sender: TObject); begin SourceMark:=nil; @@ -1230,95 +394,18 @@ begin AddMenuItem(lisViewBreakPointProperties, True, @OnViewPropertiesMenuItemClick); end; -procedure TManagedBreakPoint.AssignTo(Dest: TPersistent); -begin - inherited AssignTo(Dest); - if (TManagedBreakPoints(GetOwner).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; - end; -end; - -destructor TManagedBreakPoint.Destroy; -begin - if FMaster <> nil - then begin - FMaster.Slave := nil; - FreeAndNil(FMaster); - end; - inherited Destroy; -end; - procedure TManagedBreakPoint.DoChanged; begin - if (FMaster <> nil) - and (FMaster.Slave = nil) - then FMaster := nil; - inherited DoChanged; UpdateSourceMark; end; -function TManagedBreakPoint.GetHitCount: Integer; -begin - if FMaster = nil - then Result := 0 - else Result := FMaster.HitCount; -end; - -function TManagedBreakPoint.GetValid: TValidState; -begin - if FMaster = nil - then Result := vsUnknown - else Result := FMaster.Valid; -end; - -procedure TManagedBreakPoint.SetBreakHitCount(const AValue: Integer); -begin - if BreakHitCount = AValue then exit; - inherited SetBreakHitCount(AValue); - if FMaster <> nil then FMaster.BreakHitCount := AValue; -end; - -procedure TManagedBreakPoint.ResetMaster; -begin - if FMaster <> nil then FMaster.Slave := nil; - FMaster := nil; - Changed; -end; - procedure TManagedBreakPoint.CopySourcePositionToBreakPoint; begin if FSourceMark=nil then exit; SetLocation(Source,FSourceMark.Line); end; -procedure TManagedBreakPoint.SetEnabled(const AValue: Boolean); -begin - if Enabled = AValue then exit; - inherited SetEnabled(AValue); - InitialEnabled:=Enabled; - if FMaster <> nil then FMaster.Enabled := AValue; -end; - -procedure TManagedBreakPoint.SetInitialEnabled(const AValue: Boolean); -begin - if InitialEnabled = AValue then exit; - inherited SetInitialEnabled(AValue); - if FMaster <> nil then FMaster.InitialEnabled := AValue; -end; - -procedure TManagedBreakPoint.SetExpression(const AValue: String); -begin - if AValue=Expression then exit; - inherited SetExpression(AValue); - if FMaster <> nil then FMaster.Expression := AValue; -end; - procedure TManagedBreakPoint.SetLocation(const ASource: String; const ALine: Integer); var @@ -1329,7 +416,6 @@ begin then exit; inherited SetLocation(ASource, ALine); FCurrentDebugExeLine := NewDebugExeLine; - if FMaster<>nil then FMaster.SetLocation(ASource, DebugExeLine); if Project1 <> nil then Project1.Modified := True; end; @@ -1643,7 +729,7 @@ begin begin AContinue := ExecuteExceptionDialog(msg, Ignore) = mrCancel; if Ignore then - TManagedExceptions(Exceptions).AddIfNeeded(AExceptionClass); + Exceptions.AddIfNeeded(AExceptionClass); end; end; @@ -1848,7 +934,7 @@ begin SrcLine := StackEntry.Line; SrcFile := StackEntry.Source; SrcFullName := StackEntry.FullFileName; - StackEntry.Current := True; + StackEntry.MakeCurrent; Break; end; Inc(i); @@ -2149,15 +1235,15 @@ begin FDebugger := nil; FBreakPoints := TManagedBreakPoints.Create(Self); FBreakPointGroups := TIDEBreakPointGroups.Create; - FWatches := TManagedWatches.Create(Self); + FWatches := TIDEWatches.Create; FThreads := TIDEThreads.Create; - FExceptions := TManagedExceptions.Create(Self); - FSignals := TManagedSignals.Create(Self); - FLocals := TManagedLocals.Create; - FLineInfo := TManagedLineInfo.Create; - FCallStack := TManagedCallStack.Create; - FDisassembler := TManagedDisassembler.Create; - FRegisters := TManagedRegisters.Create; + FExceptions := TProjectExceptions.Create; + FSignals := TIDESignals.Create; + FLocals := TIDELocals.Create; + FLineInfo := TIDELineInfo.Create; + FCallStack := TIDECallStack.Create; + FDisassembler := TIDEDisassembler.Create; + FRegisters := TIDERegisters.Create; FUserSourceFiles := TStringList.Create; FIgnoreSourceFiles := TStringList.Create; @@ -3159,27 +2245,27 @@ begin if FDebugger = nil then begin TManagedBreakpoints(FBreakpoints).Master := nil; - TManagedWatches(FWatches).Master := nil; + FWatches.Master := nil; FThreads.Master := nil; - TManagedLocals(FLocals).Master := nil; - TManagedLineInfo(FLineInfo).Master := nil; - TManagedCallStack(FCallStack).Master := nil; - TManagedDisassembler(FDisassembler).Master := nil; - TManagedExceptions(FExceptions).Master := nil; - TManagedSignals(FSignals).Master := nil; - TManagedRegisters(FRegisters).Master := nil; + FLocals.Master := nil; + FLineInfo.Master := nil; + FCallStack.Master := nil; + FDisassembler.Master := nil; + FExceptions.Master := nil; + FSignals.Master := nil; + FRegisters.Master := nil; end else begin TManagedBreakpoints(FBreakpoints).Master := FDebugger.BreakPoints; - TManagedWatches(FWatches).Master := FDebugger.Watches; + FWatches.Master := FDebugger.Watches; FThreads.Master := FDebugger.Threads; - TManagedLocals(FLocals).Master := FDebugger.Locals; - TManagedLineInfo(FLineInfo).Master := FDebugger.LineInfo; - TManagedCallStack(FCallStack).Master := FDebugger.CallStack; - TManagedDisassembler(FDisassembler).Master := FDebugger.Disassembler; - TManagedExceptions(FExceptions).Master := FDebugger.Exceptions; - TManagedSignals(FSignals).Master := FDebugger.Signals; - TManagedRegisters(FRegisters).Master := FDebugger.Registers; + FLocals.Master := FDebugger.Locals; + FLineInfo.Master := FDebugger.LineInfo; + FCallStack.Master := FDebugger.CallStack; + FDisassembler.Master := FDebugger.Disassembler; + FExceptions.Master := FDebugger.Exceptions; + FSignals.Master := FDebugger.Signals; + FRegisters.Master := FDebugger.Registers; end; end;