MWE: = Splitted TDBGBreakpoint into TBaseBreakPoint, TIDEBreakpoint and

TDBGBreakPoint

git-svn-id: trunk@4226 -
This commit is contained in:
marc 2003-06-03 01:35:39 +00:00
parent 2929675a0b
commit 134c587eef
4 changed files with 784 additions and 672 deletions

View File

@ -74,20 +74,20 @@ type
procedure popDeleteAllClick(Sender: TObject); procedure popDeleteAllClick(Sender: TObject);
private private
FBaseDirectory: string; FBaseDirectory: string;
FBreakPoints: TDBGBreakPoints; FBreakPoints: TIDEBreakPoints;
FBreakpointsNotification: TDBGBreakPointsNotification; FBreakpointsNotification: TIDEBreakPointsNotification;
FStates: TBreakPointsDlgStates; FStates: TBreakPointsDlgStates;
procedure BreakPointAdd(const ASender: TDBGBreakPoints; procedure BreakPointAdd(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure BreakPointUpdate(const ASender: TDBGBreakPoints; procedure BreakPointUpdate(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure BreakPointRemove(const ASender: TDBGBreakPoints; procedure BreakPointRemove(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure SetBaseDirectory(const AValue: string); procedure SetBaseDirectory(const AValue: string);
procedure SetBreakPoints(const AValue: TDBGBreakPoints); procedure SetBreakPoints(const AValue: TIDEBreakPoints);
procedure UpdateItem(const AnItem: TListItem; procedure UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure UpdateAll; procedure UpdateAll;
protected protected
procedure DoEndUpdate; override; procedure DoEndUpdate; override;
@ -98,14 +98,14 @@ type
destructor Destroy; override; destructor Destroy; override;
public public
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory; property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
property BreakPoints: TDBGBreakPoints read FBreakPoints write SetBreakPoints; property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
end; end;
implementation implementation
procedure TBreakPointsDlg.BreakPointAdd(const ASender: TDBGBreakPoints; procedure TBreakPointsDlg.BreakPointAdd(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
var var
Item: TListItem; Item: TListItem;
n: Integer; n: Integer;
@ -122,8 +122,8 @@ begin
UpdateItem(Item, ABreakPoint); UpdateItem(Item, ABreakPoint);
end; end;
procedure TBreakPointsDlg.BreakPointUpdate(const ASender: TDBGBreakPoints; procedure TBreakPointsDlg.BreakPointUpdate(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
var var
Item: TListItem; Item: TListItem;
begin begin
@ -141,8 +141,8 @@ begin
end; end;
end; end;
procedure TBreakPointsDlg.BreakPointRemove(const ASender: TDBGBreakPoints; procedure TBreakPointsDlg.BreakPointRemove(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
begin begin
lvBreakPoints.Items.FindData(ABreakpoint).Free; lvBreakPoints.Items.FindData(ABreakpoint).Free;
end; end;
@ -154,7 +154,7 @@ begin
UpdateAll; UpdateAll;
end; end;
procedure TBreakPointsDlg.SetBreakPoints(const AValue: TDBGBreakPoints); procedure TBreakPointsDlg.SetBreakPoints(const AValue: TIDEBreakPoints);
begin begin
if FBreakPoints=AValue then exit; if FBreakPoints=AValue then exit;
lvBreakPoints.Items.Clear; lvBreakPoints.Items.Clear;
@ -171,7 +171,7 @@ constructor TBreakPointsDlg.Create(AOwner: TComponent);
begin begin
inherited; inherited;
Name:='BreakPointsDlg'; Name:='BreakPointsDlg';
FBreakpointsNotification := TDBGBreakPointsNotification.Create; FBreakpointsNotification := TIDEBreakPointsNotification.Create;
FBreakpointsNotification.AddReference; FBreakpointsNotification.AddReference;
FBreakpointsNotification.OnAdd := @BreakPointAdd; FBreakpointsNotification.OnAdd := @BreakPointAdd;
FBreakpointsNotification.OnUpdate := @BreakPointUpdate; FBreakpointsNotification.OnUpdate := @BreakPointUpdate;
@ -200,11 +200,11 @@ end;
procedure TBreakPointsDlg.DoJumpToCurrentBreakPoint; procedure TBreakPointsDlg.DoJumpToCurrentBreakPoint;
var var
CurItem: TListItem; CurItem: TListItem;
CurBreakPoint: TDBGBreakPoint; CurBreakPoint: TIDEBreakPoint;
begin begin
CurItem:=lvBreakPoints.Selected; CurItem:=lvBreakPoints.Selected;
if CurItem=nil then exit; if CurItem=nil then exit;
CurBreakPoint:=TDBGBreakPoint(CurItem.Data); CurBreakPoint:=TIDEBreakPoint(CurItem.Data);
DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0); DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0);
end; end;
@ -225,11 +225,11 @@ end;
procedure TBreakPointsDlg.mnuPopupPopup(Sender: TObject); procedure TBreakPointsDlg.mnuPopupPopup(Sender: TObject);
var var
Enable: Boolean; Enable: Boolean;
CurBreakPoint: TDBGBreakPoint; CurBreakPoint: TIDEBreakPoint;
begin begin
Enable := lvBreakPoints.Selected <> nil; Enable := lvBreakPoints.Selected <> nil;
if Enable then if Enable then
CurBreakPoint:=TDBGBreakPoint(lvBreakPoints.Selected.Data) CurBreakPoint:=TIDEBreakPoint(lvBreakPoints.Selected.Data)
else else
CurBreakPoint:=nil; CurBreakPoint:=nil;
popProperties.Enabled := Enable; popProperties.Enabled := Enable;
@ -255,17 +255,17 @@ var
n: Integer; n: Integer;
begin begin
for n := lvBreakPoints.Items.Count - 1 downto 0 do for n := lvBreakPoints.Items.Count - 1 downto 0 do
TDBGBreakPoint(lvBreakPoints.Items[n].Data).Free; TIDEBreakPoint(lvBreakPoints.Items[n].Data).Free;
end; end;
procedure TBreakPointsDlg.popDeleteClick(Sender: TObject); procedure TBreakPointsDlg.popDeleteClick(Sender: TObject);
var var
CurItem: TListItem; CurItem: TListItem;
CurBreakPoint: TDBGBreakPoint; CurBreakPoint: TIDEBreakPoint;
begin begin
CurItem:=lvBreakPoints.Selected; CurItem:=lvBreakPoints.Selected;
if CurItem=nil then exit; if CurItem=nil then exit;
CurBreakPoint:=TDBGBreakPoint(CurItem.Data); CurBreakPoint:=TIDEBreakPoint(CurItem.Data);
if MessageDlg('Delete breakpoint?', if MessageDlg('Delete breakpoint?',
'Delete breakpoint at'#13 'Delete breakpoint at'#13
+'"'+CurBreakPoint.Source+'" line '+IntToStr(CurBreakPoint.Line)+'?', +'"'+CurBreakPoint.Source+'" line '+IntToStr(CurBreakPoint.Line)+'?',
@ -283,7 +283,7 @@ begin
begin begin
Item := lvBreakPoints.Items[n]; Item := lvBreakPoints.Items[n];
if Item.Data <> nil if Item.Data <> nil
then TDBGBreakPoint(Item.Data).Enabled := False; then TIDEBreakPoint(Item.Data).Enabled := False;
end; end;
end; end;
@ -296,7 +296,7 @@ begin
begin begin
Item := lvBreakPoints.Items[n]; Item := lvBreakPoints.Items[n];
if Item.Data <> nil if Item.Data <> nil
then TDBGBreakPoint(Item.Data).Enabled := True; then TIDEBreakPoint(Item.Data).Enabled := True;
end; end;
end; end;
@ -306,7 +306,7 @@ var
begin begin
CurItem:=lvBreakPoints.Selected; CurItem:=lvBreakPoints.Selected;
if (CurItem=nil) then exit; if (CurItem=nil) then exit;
TDBGBreakPoint(CurItem.Data).Enabled:=not TDBGBreakPoint(CurItem.Data).Enabled; TIDEBreakPoint(CurItem.Data).Enabled:=not TIDEBreakPoint(CurItem.Data).Enabled;
end; end;
procedure TBreakPointsDlg.popPropertiesClick(Sender: TObject); procedure TBreakPointsDlg.popPropertiesClick(Sender: TObject);
@ -320,9 +320,9 @@ begin
end; end;
procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem; procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
const const
DEBUG_ACTION: array[TDBGBreakPointAction] of string = DEBUG_ACTION: array[TIDEBreakPointAction] of string =
('Break', 'Enable Group', 'Disable Group'); ('Break', 'Enable Group', 'Disable Group');
// enabled valid // enabled valid
@ -331,7 +331,7 @@ const
{Disabled} ('?', 'Disabled','Invalid'), {Disabled} ('?', 'Disabled','Invalid'),
{Endabled} ('?', 'Enabled', 'Invalid')); {Endabled} ('?', 'Enabled', 'Invalid'));
var var
Action: TDBGBreakPointAction; Action: TIDEBreakPointAction;
S: String; S: String;
Filename: String; Filename: String;
begin begin
@ -390,7 +390,7 @@ begin
Exclude(FStates,bpdsItemsNeedUpdate); Exclude(FStates,bpdsItemsNeedUpdate);
for i:=0 to lvBreakPoints.Items.Count-1 do begin for i:=0 to lvBreakPoints.Items.Count-1 do begin
CurItem:=lvBreakPoints.Items[i]; CurItem:=lvBreakPoints.Items[i];
UpdateItem(CurItem,TDBGBreakPoint(CurItem.Data)); UpdateItem(CurItem,TIDEBreakPoint(CurItem.Data));
end; end;
end; end;
@ -402,6 +402,10 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.17 2003/06/03 01:35:39 marc
MWE: = Splitted TDBGBreakpoint into TBaseBreakPoint, TIDEBreakpoint and
TDBGBreakPoint
Revision 1.16 2003/05/29 23:14:17 mattias Revision 1.16 2003/05/29 23:14:17 mattias
implemented jump to code on double click for breakpoints and callstack dlg implemented jump to code on double click for breakpoints and callstack dlg

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ type
TBaseDebugManager = class(TComponent) TBaseDebugManager = class(TComponent)
protected protected
FDestroying: boolean; FDestroying: boolean;
FBreakPoints: TDBGBreakPoints; FBreakPoints: TIDEBreakPoints;
function GetState: TDBGState; virtual; abstract; function GetState: TDBGState; virtual; abstract;
function GetCommands: TDBGCommands; virtual; abstract; function GetCommands: TDBGCommands; virtual; abstract;
public public
@ -81,7 +81,7 @@ type
public public
property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger
property State: TDBGState read GetState; // The current state of the debugger property State: TDBGState read GetState; // The current state of the debugger
property BreakPoints: TDBGBreakPoints read FBreakpoints; property BreakPoints: TIDEBreakPoints read FBreakpoints;
property Destroying: boolean read FDestroying; property Destroying: boolean read FDestroying;
end; end;

View File

@ -83,13 +83,13 @@ type
private private
FDebugger: TDebugger; FDebugger: TDebugger;
FDebuggerUpdateLock: integer; FDebuggerUpdateLock: integer;
FBreakpointsNotification: TDBGBreakPointsNotification;// Notification for FBreakpointsNotification: TIDEBreakPointsNotification;// Notification for
// our BreakPoints // our BreakPoints
// When no debugger is created the IDE stores all debugger settings in its // When no debugger is created the IDE stores all debugger settings in its
// own variables. When the debugger object is created these items point // own variables. When the debugger object is created these items point
// to the corresponding items in the FDebugger object. // to the corresponding items in the FDebugger object.
FBreakPointGroups: TDBGBreakPointGroups; FBreakPointGroups: TIDEBreakPointGroups;
FWatches: TDBGWatches; FWatches: TDBGWatches;
FDialogs: array[TDebugDialogType] of TDebuggerDlg; FDialogs: array[TDebugDialogType] of TDebuggerDlg;
@ -98,13 +98,13 @@ type
FUserSourceFiles: TStringList; FUserSourceFiles: TStringList;
// Breakpoint routines // Breakpoint routines
procedure BreakpointAdded(const ASender: TDBGBreakPoints; procedure BreakpointAdded(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure BreakpointRemoved(const ASender: TDBGBreakPoints; procedure BreakpointRemoved(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
procedure CreateSourceMarkForBreakPoint(const ABreakpoint: TDBGBreakPoint; procedure CreateSourceMarkForBreakPoint(const ABreakpoint: TIDEBreakPoint;
ASrcEdit: TSourceEditor); ASrcEdit: TSourceEditor);
procedure GetSourceEditorForBreakPoint(const ABreakpoint: TDBGBreakPoint; procedure GetSourceEditorForBreakPoint(const ABreakpoint: TIDEBreakPoint;
var ASrcEdit: TSourceEditor); var ASrcEdit: TSourceEditor);
// Dialog routines // Dialog routines
@ -164,7 +164,7 @@ const
); );
type type
TManagedBreakPoint = class(TDBGBreakPoint) TManagedBreakPoint = class(TIDEBreakPoint)
private private
FMaster: TDBGBreakPoint; FMaster: TDBGBreakPoint;
FSourceMark: TSourceMark; FSourceMark: TSourceMark;
@ -173,9 +173,9 @@ type
procedure OnSourceMarkBeforeFree(Sender: TObject); procedure OnSourceMarkBeforeFree(Sender: TObject);
protected protected
procedure AssignTo(Dest: TPersistent); override; procedure AssignTo(Dest: TPersistent); override;
procedure DoChanged; override;
function GetHitCount: Integer; override; function GetHitCount: Integer; override;
function GetValid: TValidState; override; function GetValid: TValidState; override;
procedure SetActions(const AValue: TDBGBreakPointActions); override;
procedure SetEnabled(const AValue: Boolean); override; procedure SetEnabled(const AValue: Boolean); override;
procedure SetExpression(const AValue: String); override; procedure SetExpression(const AValue: String); override;
procedure UpdateSourceMarkImage; procedure UpdateSourceMarkImage;
@ -188,13 +188,10 @@ type
property SourceMark: TSourceMark read FSourceMark write SetSourceMark; property SourceMark: TSourceMark read FSourceMark write SetSourceMark;
end; end;
TManagedBreakPoints = class(TDBGBreakPoints) TManagedBreakPoints = class(TIDEBreakPoints)
private private
FMaster: TDBGBreakPoints; FMaster: TDBGBreakPoints;
FMasterNotification: TDBGBreakPointsNotification;
procedure SetMaster(const AValue: TDBGBreakPoints); procedure SetMaster(const AValue: TDBGBreakPoints);
procedure MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
@ -206,65 +203,20 @@ type
constructor TManagedBreakPoints.Create; constructor TManagedBreakPoints.Create;
begin begin
FMaster := nil; FMaster := nil;
FMasterNotification := TDBGBreakPointsNotification.Create; inherited Create(TManagedBreakPoint);
FMasterNotification.AddReference;
FMasterNotification.OnUpdate := @MasterUpdate;
inherited Create(nil, TManagedBreakPoint);
end; end;
destructor TManagedBreakPoints.Destroy; destructor TManagedBreakPoints.Destroy;
begin begin
FreeThenNil(FMasterNotification);
inherited Destroy; inherited Destroy;
end; end;
procedure TManagedBreakPoints.MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
function FindItem: TManagedBreakPoint;
var
n: Integer;
begin
for n := 0 to Count - 1 do
begin
Result := TManagedBreakPoint(Items[n]);
if Result.FMaster = ABreakPoint
then Exit;
end;
Result := nil;
end;
var
bp: TManagedBreakPoint;
begin
if ABreakPoint = nil
then begin
Update(nil);
end
else begin
bp := FindItem;
writeln('TManagedBreakPoints.MasterUpdate B ',ABreakpoint.ClassName,' ',
ABreakpoint.Source,' ',ABreakpoint.Line,' ',bp <> nil);
if bp <> nil then begin
bp.UpdateSourceMark;
Update(bp);
end else begin
writeln('WARNING: TManagedBreakPoints.MasterUpdate unknown breakpoint: ',
ABreakpoint.Source,' ',ABreakpoint.Line);
end;
end;
end;
procedure TManagedBreakPoints.SetMaster(const AValue: TDBGBreakPoints); procedure TManagedBreakPoints.SetMaster(const AValue: TDBGBreakPoints);
var var
n: Integer; n: Integer;
begin begin
if FMaster = AValue then Exit; if FMaster = AValue then Exit;
if FMaster <> nil
then FMaster.RemoveNotification(FMasterNotification);
FMaster := AValue; FMaster := AValue;
if FMaster = nil if FMaster = nil
then begin then begin
@ -272,7 +224,6 @@ begin
TManagedBreakPoint(Items[n]).ResetMaster; TManagedBreakPoint(Items[n]).ResetMaster;
end end
else begin else begin
FMaster.AddNotification(FMasterNotification);
FMaster.Assign(Self); FMaster.Assign(Self);
end; end;
end; end;
@ -295,13 +246,12 @@ begin
FSourceMark.IsBreakPoint:=true; FSourceMark.IsBreakPoint:=true;
FSourceMark.Line:=Line; FSourceMark.Line:=Line;
FSourceMark.Visible:=true; FSourceMark.Visible:=true;
UpdateSourceMarkImage; UpdateSourceMark;
end; end;
end; end;
procedure TManagedBreakPoint.OnSourceMarkPositionChanged(Sender: TObject); procedure TManagedBreakPoint.OnSourceMarkPositionChanged(Sender: TObject);
begin begin
end; end;
procedure TManagedBreakPoint.OnSourceMarkBeforeFree(Sender: TObject); procedure TManagedBreakPoint.OnSourceMarkBeforeFree(Sender: TObject);
@ -312,11 +262,15 @@ end;
procedure TManagedBreakPoint.AssignTo(Dest: TPersistent); procedure TManagedBreakPoint.AssignTo(Dest: TPersistent);
begin begin
inherited AssignTo(Dest); inherited AssignTo(Dest);
if TManagedBreakPoints(GetOwner).FMaster <> nil if (TManagedBreakPoints(GetOwner).FMaster <> nil)
then FMaster := TDBGBreakpoint(Dest); and (Dest is TDBGBreakPoint)
then begin
FMaster := TDBGBreakPoint(Dest);
FMaster.Slave := Self;
end;
end; end;
constructor TManagedBreakPoint.Create (ACollection: TCollection ); constructor TManagedBreakPoint.Create(ACollection: TCollection);
begin begin
inherited Create(ACollection); inherited Create(ACollection);
FMaster := nil; FMaster := nil;
@ -324,10 +278,24 @@ end;
destructor TManagedBreakPoint.Destroy; destructor TManagedBreakPoint.Destroy;
begin begin
FreeAndNil(FMaster); if FMaster <> nil
then begin
FMaster.Slave := nil;
FreeAndNil(FMaster);
end;
inherited Destroy; inherited Destroy;
end; end;
procedure TManagedBreakPoint.DoChanged;
begin
if (FMaster <> nil)
and (FMaster.Slave = nil)
then FMaster := nil;
inherited DoChanged;
UpdateSourceMark;
end;
function TManagedBreakPoint.GetHitCount: Integer; function TManagedBreakPoint.GetHitCount: Integer;
begin begin
if FMaster = nil if FMaster = nil
@ -345,22 +313,16 @@ end;
procedure TManagedBreakPoint.ResetMaster; procedure TManagedBreakPoint.ResetMaster;
begin begin
FMaster := nil; FMaster := nil;
Changed(False); Changed;
end;
procedure TManagedBreakPoint.SetActions(const AValue: TDBGBreakPointActions);
begin
if Actions=AValue then exit;
inherited SetActions(AValue);
if FMaster <> nil then FMaster.Actions := AValue;
end; end;
procedure TManagedBreakPoint.SetEnabled(const AValue: Boolean); procedure TManagedBreakPoint.SetEnabled(const AValue: Boolean);
begin begin
if Enabled=AValue then exit; if Enabled = AValue then exit;
inherited SetEnabled(AValue); inherited SetEnabled(AValue);
if FMaster <> nil then FMaster.Enabled := AValue; if FMaster <> nil then FMaster.Enabled := AValue;
UpdateSourceMarkImage; // Handled by changed
// UpdateSourceMarkImage;
end; end;
procedure TManagedBreakPoint.SetExpression(const AValue: String); procedure TManagedBreakPoint.SetExpression(const AValue: String);
@ -797,13 +759,13 @@ begin
FDebugger := nil; FDebugger := nil;
FBreakPoints := TManagedBreakPoints.Create; FBreakPoints := TManagedBreakPoints.Create;
FBreakpointsNotification := TDBGBreakPointsNotification.Create; FBreakpointsNotification := TIDEBreakPointsNotification.Create;
FBreakpointsNotification.AddReference; FBreakpointsNotification.AddReference;
FBreakpointsNotification.OnAdd := @BreakpointAdded; FBreakpointsNotification.OnAdd := @BreakpointAdded;
FBreakpointsNotification.OnRemove := @BreakpointRemoved; FBreakpointsNotification.OnRemove := @BreakpointRemoved;
FBreakPoints.AddNotification(FBreakpointsNotification); FBreakPoints.AddNotification(FBreakpointsNotification);
FBreakPointGroups := TDBGBreakPointGroups.Create; FBreakPointGroups := TIDEBreakPointGroups.Create;
FWatches := TDBGWatches.Create(nil, TDBGWatch); FWatches := TDBGWatches.Create(nil, TDBGWatch);
FUserSourceFiles := TStringList.Create; FUserSourceFiles := TStringList.Create;
@ -824,22 +786,17 @@ begin
if FDebugger <> nil if FDebugger <> nil
then begin then begin
//@@ if FDebugger.BreakPoints = FBreakPoints
//@@ then FBreakPoints := nil;
if FDebugger.BreakPointGroups = FBreakPointGroups
then FBreakPointGroups := nil;
if FDebugger.Watches = FWatches if FDebugger.Watches = FWatches
then FWatches := nil; then FWatches := nil;
FreeThenNil(FDebugger); FreeThenNil(FDebugger);
end end
else begin else begin
//@@ FreeThenNil(FBreakPoints);
FreeThenNil(FBreakPointGroups);
FreeThenNil(FWatches); FreeThenNil(FWatches);
end; end;
FreeThenNil(FBreakPoints); FreeThenNil(FBreakPoints);
FreeThenNil(FBreakPointGroups);
FreeThenNil(FBreakpointsNotification); FreeThenNil(FBreakpointsNotification);
FreeThenNil(FUserSourceFiles); FreeThenNil(FUserSourceFiles);
@ -888,16 +845,12 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TDebugManager.LoadProjectSpecificInfo(XMLConfig: TXMLConfig); procedure TDebugManager.LoadProjectSpecificInfo(XMLConfig: TXMLConfig);
begin begin
if FDebugger=nil then begin FBreakPointGroups.LoadFromXMLConfig(XMLConfig,
FBreakPointGroups.LoadFromXMLConfig(XMLConfig, 'Debugging/'+XMLBreakPointGroupsNode+'/');
'Debugging/'+XMLBreakPointGroupsNode+'/'); FBreakPoints.LoadFromXMLConfig(XMLConfig,'Debugging/'+XMLBreakPointsNode+'/',
FBreakPoints.LoadFromXMLConfig(XMLConfig,'Debugging/'+XMLBreakPointsNode+'/',
@Project1.LongenFilename, @Project1.LongenFilename,
@FBreakPointGroups.GetGroupByName); @FBreakPointGroups.GetGroupByName);
FWatches.LoadFromXMLConfig(XMLConfig,'Debugging/'+XMLWatchesNode+'/'); FWatches.LoadFromXMLConfig(XMLConfig,'Debugging/'+XMLWatchesNode+'/');
end else begin
FDebugger.LoadFromXMLConfig(XMLConfig,'Debugging/',@Project1.LongenFilename);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -907,22 +860,18 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TDebugManager.SaveProjectSpecificInfo(XMLConfig: TXMLConfig); procedure TDebugManager.SaveProjectSpecificInfo(XMLConfig: TXMLConfig);
begin begin
if FDebugger=nil then begin FBreakPointGroups.SaveToXMLConfig(XMLConfig,
FBreakPointGroups.SaveToXMLConfig(XMLConfig, 'Debugging/'+XMLBreakPointGroupsNode+'/');
'Debugging/'+XMLBreakPointGroupsNode+'/'); FBreakPoints.SaveToXMLConfig(XMLConfig,'Debugging/'+XMLBreakPointsNode+'/',
FBreakPoints.SaveToXMLConfig(XMLConfig,'Debugging/'+XMLBreakPointsNode+'/', @Project1.ShortenFilename);
@Project1.ShortenFilename); FWatches.SaveToXMLConfig(XMLConfig,'Debugging/'+XMLWatchesNode+'/');
FWatches.SaveToXMLConfig(XMLConfig,'Debugging/'+XMLWatchesNode+'/');
end else begin
FDebugger.SaveToXMLConfig(XMLConfig,'Debugging/',@Project1.ShortenFilename);
end;
end; end;
procedure TDebugManager.DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); procedure TDebugManager.DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo);
var var
ASrcEdit: TSourceEditor; ASrcEdit: TSourceEditor;
i: Integer; i: Integer;
CurBreakPoint: TDBGBreakPoint; CurBreakPoint: TIDEBreakPoint;
SrcFilename: String; SrcFilename: String;
begin begin
if (AnUnitInfo.EditorIndex<0) or Destroying then exit; if (AnUnitInfo.EditorIndex<0) or Destroying then exit;
@ -947,10 +896,10 @@ begin
end; end;
end; end;
procedure TDebugManager.BreakpointAdded(const ASender: TDBGBreakPoints; procedure TDebugManager.BreakpointAdded(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
var var
BP: TDBGBreakPoint; BP: TBaseBreakPoint;
begin begin
writeln('TDebugManager.BreakpointAdded A ',ABreakpoint.Source,' ',ABreakpoint.Line); writeln('TDebugManager.BreakpointAdded A ',ABreakpoint.Source,' ',ABreakpoint.Line);
ABreakpoint.InitialEnabled := True; ABreakpoint.InitialEnabled := True;
@ -964,8 +913,8 @@ writeln('TDebugManager.BreakpointAdded A ',ABreakpoint.Source,' ',ABreakpoint.Li
Project1.Modified := True; Project1.Modified := True;
end; end;
procedure TDebugManager.BreakpointRemoved(const ASender: TDBGBreakPoints; procedure TDebugManager.BreakpointRemoved(const ASender: TIDEBreakPoints;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TIDEBreakPoint);
begin begin
writeln('TDebugManager.BreakpointRemoved A ',ABreakpoint.Source,' ',ABreakpoint.Line,' ',TManagedBreakPoint(ABreakpoint).SourceMark<>nil); writeln('TDebugManager.BreakpointRemoved A ',ABreakpoint.Source,' ',ABreakpoint.Line,' ',TManagedBreakPoint(ABreakpoint).SourceMark<>nil);
if TManagedBreakPoint(ABreakpoint).SourceMark<>nil then if TManagedBreakPoint(ABreakpoint).SourceMark<>nil then
@ -975,7 +924,7 @@ writeln('TDebugManager.BreakpointRemoved A ',ABreakpoint.Source,' ',ABreakpoint.
end; end;
procedure TDebugManager.CreateSourceMarkForBreakPoint( procedure TDebugManager.CreateSourceMarkForBreakPoint(
const ABreakpoint: TDBGBreakPoint; ASrcEdit: TSourceEditor); const ABreakpoint: TIDEBreakPoint; ASrcEdit: TSourceEditor);
var var
ManagedBreakPoint: TManagedBreakPoint; ManagedBreakPoint: TManagedBreakPoint;
NewSrcMark: TSourceMark; NewSrcMark: TSourceMark;
@ -995,7 +944,7 @@ begin
end; end;
procedure TDebugManager.GetSourceEditorForBreakPoint( procedure TDebugManager.GetSourceEditorForBreakPoint(
const ABreakpoint: TDBGBreakPoint; var ASrcEdit: TSourceEditor); const ABreakpoint: TIDEBreakPoint; var ASrcEdit: TSourceEditor);
var var
Filename: String; Filename: String;
begin begin
@ -1023,7 +972,7 @@ end;
function TDebugManager.DoInitDebugger: TModalResult; function TDebugManager.DoInitDebugger: TModalResult;
var var
//@@ OldBreakpoints: TDBGBreakpoints; //@@ OldBreakpoints: TDBGBreakPoints;
//@@ OldBreakPointGroups: TDBGBreakPointGroups; //@@ OldBreakPointGroups: TDBGBreakPointGroups;
OldWatches: TDBGWatches; OldWatches: TDBGWatches;
@ -1043,7 +992,7 @@ var
// copy the break point list without the group references // copy the break point list without the group references
//@@ OldBreakpoints := TDBGBreakpoints.Create(nil, TDBGBreakpoint); //@@ OldBreakpoints := TDBGBreakpoints.Create(nil, TDBGBreakpoint);
//@@ OldBreakpoints.Assign(FBreakPoints); //@@ OldBreakpoints.Assign(FBreakPoints);
// copy the groups and all group references // copy the groups and all group references
//@@ OldBreakPointGroups := TDBGBreakPointGroups.Create; //@@ OldBreakPointGroups := TDBGBreakPointGroups.Create;
//@@ OldBreakPointGroups.Regroup(FBreakPointGroups,FBreakPoints,OldBreakPoints); //@@ OldBreakPointGroups.Regroup(FBreakPointGroups,FBreakPoints,OldBreakPoints);
@ -1300,7 +1249,7 @@ end;
function TDebugManager.DoDeleteBreakPoint(const AFilename: string; function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
ALine: integer): TModalResult; ALine: integer): TModalResult;
var var
OldBreakPoint: TDBGBreakPoint; OldBreakPoint: TIDEBreakPoint;
begin begin
Result:=DoBeginChangeDebugger; Result:=DoBeginChangeDebugger;
if Result<>mrOk then exit; if Result<>mrOk then exit;
@ -1314,17 +1263,17 @@ end;
function TDebugManager.DoDeleteBreakPointAtMark(const ASourceMark: TSourceMark function TDebugManager.DoDeleteBreakPointAtMark(const ASourceMark: TSourceMark
): TModalResult; ): TModalResult;
var var
OldBreakPoint: TDBGBreakPoint; OldBreakPoint: TIDEBreakPoint;
begin begin
// consistency check // consistency check
if (ASourceMark=nil) or (not ASourceMark.IsBreakPoint) if (ASourceMark=nil) or (not ASourceMark.IsBreakPoint)
or (ASourceMark.Data=nil) or (not (ASourceMark.Data is TDBGBreakPoint)) then or (ASourceMark.Data=nil) or (not (ASourceMark.Data is TIDEBreakPoint)) then
RaiseException('TDebugManager.DoDeleteBreakPointAtMark'); RaiseException('TDebugManager.DoDeleteBreakPointAtMark');
writeln('TDebugManager.DoDeleteBreakPointAtMark A ',ASourceMark.GetFilename,' ',ASourceMark.Line); writeln('TDebugManager.DoDeleteBreakPointAtMark A ',ASourceMark.GetFilename,' ',ASourceMark.Line);
Result:=DoBeginChangeDebugger; Result:=DoBeginChangeDebugger;
if Result<>mrOk then exit; if Result<>mrOk then exit;
OldBreakPoint:=TDBGBreakPoint(ASourceMark.Data); OldBreakPoint:=TIDEBreakPoint(ASourceMark.Data);
writeln('TDebugManager.DoDeleteBreakPointAtMark B ',OldBreakPoint.ClassName,' ',OldBreakPoint.Source,' ',OldBreakPoint.Line); writeln('TDebugManager.DoDeleteBreakPointAtMark B ',OldBreakPoint.ClassName,' ',OldBreakPoint.Source,' ',OldBreakPoint.Line);
OldBreakPoint.Free; OldBreakPoint.Free;
Project1.Modified:=true; Project1.Modified:=true;
@ -1396,6 +1345,10 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.41 2003/06/03 01:35:39 marc
MWE: = Splitted TDBGBreakpoint into TBaseBreakPoint, TIDEBreakpoint and
TDBGBreakPoint
Revision 1.40 2003/05/30 08:10:51 mattias Revision 1.40 2003/05/30 08:10:51 mattias
added try except to Application.Run, message on changing debugger items during compile added try except to Application.Run, message on changing debugger items during compile