break;points dialog now gets the items without debugger

git-svn-id: trunk@4204 -
This commit is contained in:
mattias 2003-05-28 08:46:24 +00:00
parent 6b796de096
commit 6241f4822c
5 changed files with 81 additions and 53 deletions

View File

@ -65,6 +65,7 @@ object BreakpointsDlg: TBreakpointsDlg
Caption = 'Add...' Caption = 'Add...'
object popAddSourceBP: TMenuItem object popAddSourceBP: TMenuItem
Caption = '&Source breakpoint' Caption = '&Source breakpoint'
Enabled = False
OnClick = popAddSourceBPClick OnClick = popAddSourceBPClick
end end
end end

View File

@ -16,15 +16,15 @@ LazarusResources.Add('TBreakpointsDlg','FORMDATA',[
+'SelectItem'#6'Height'#3#205#0#5'Width'#3'u'#2#8'HelpType'#7#9'htkeyword'#0#0 +'SelectItem'#6'Height'#3#205#0#5'Width'#3'u'#2#8'HelpType'#7#9'htkeyword'#0#0
+#10'TPopupMenu'#8'mnuPopup'#7'OnPopup'#7#13'mnuPopupPopup'#4'left'#2'd'#3'to' +#10'TPopupMenu'#8'mnuPopup'#7'OnPopup'#7#13'mnuPopupPopup'#4'left'#2'd'#3'to'
+'p'#2'`'#0#9'TMenuItem'#6'popAdd'#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'p' +'p'#2'`'#0#9'TMenuItem'#6'popAdd'#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'p'
+'opAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'OnClick'#7#19'popAddSo' +'opAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'Enabled'#8#7'OnClick'#7
+'urceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13 +#19'popAddSourceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TM'
+'popProperties'#7'Caption'#6#11'&Properties'#7'OnClick'#7#18'popPropertiesCl' +'enuItem'#13'popProperties'#7'Caption'#6#11'&Properties'#7'OnClick'#7#18'pop'
+'ick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#19'ShowAlways' +'PropertiesClick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#19
+'Checkable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9'popDelete' +'ShowAlwaysCheckable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9
+#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteClick'#0#0#9'TMenuItem'#2 +'popDelete'#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteClick'#0#0#9'TM'
+'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'Caption'#6#12'D&' +'enuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'Capti'
+'isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem'#12'popEnab' +'on'#6#12'D&isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem'
+'leAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllClick'#0#0#9 +#12'popEnableAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllC'
+'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnClick'#7#17'po' +'lick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnCl'
+'pDeleteAllClick'#0#0#0#0 +'ick'#7#17'popDeleteAllClick'#0#0#0#0
]); ]);

View File

@ -83,8 +83,8 @@ type
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TDBGBreakPoint);
procedure SetBaseDirectory(const AValue: string); procedure SetBaseDirectory(const AValue: string);
procedure UpdateItem(const AItem: TListItem; procedure UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TDBGBreakPoint);
procedure UpdateAll; procedure UpdateAll;
protected protected
procedure SetDebugger(const ADebugger: TDebugger); override; procedure SetDebugger(const ADebugger: TDebugger); override;
@ -92,6 +92,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure BreakPointsUpdate(const ASender: TDBGBreakPoints);
public public
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory; property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
end; end;
@ -170,6 +171,14 @@ begin
inherited; inherited;
end; end;
procedure TBreakPointsDlg.BreakPointsUpdate(const ASender: TDBGBreakPoints);
var
i: Integer;
begin
for i:=0 to ASender.Count-1 do
BreakPointUpdate(ASender,ASender.Items[i]);
end;
procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject); procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject);
begin begin
end; end;
@ -293,7 +302,7 @@ begin
if bpdsItemsNeedUpdate in FStates then UpdateAll; if bpdsItemsNeedUpdate in FStates then UpdateAll;
end; end;
procedure TBreakPointsDlg.UpdateItem(const AItem: TListItem; procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TDBGBreakPoint);
const const
DEBUG_ACTION: array[TDBGBreakPointAction] of string = DEBUG_ACTION: array[TDBGBreakPointAction] of string =
@ -317,21 +326,21 @@ begin
// Group // Group
// state // state
AItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid]; AnItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid];
// filename // filename
Filename:=ABreakpoint.Source; Filename:=ABreakpoint.Source;
if BaseDirectory<>'' then if BaseDirectory<>'' then
Filename:=CreateRelativePath(Filename,BaseDirectory); Filename:=CreateRelativePath(Filename,BaseDirectory);
AItem.SubItems[0] := Filename; AnItem.SubItems[0] := Filename;
// line // line
if ABreakpoint.Line > 0 if ABreakpoint.Line > 0
then AItem.SubItems[1] := IntToStr(ABreakpoint.Line) then AnItem.SubItems[1] := IntToStr(ABreakpoint.Line)
else AItem.SubItems[1] := ''; else AnItem.SubItems[1] := '';
// expression // expression
AItem.SubItems[2] := ABreakpoint.Expression; AnItem.SubItems[2] := ABreakpoint.Expression;
// actions // actions
S := ''; S := '';
@ -341,15 +350,15 @@ begin
if S <> '' then s := S + ', '; if S <> '' then s := S + ', ';
S := S + DEBUG_ACTION[Action] S := S + DEBUG_ACTION[Action]
end; end;
AItem.SubItems[3] := S; AnItem.SubItems[3] := S;
// hitcount // hitcount
AItem.SubItems[4] := IntToStr(ABreakpoint.HitCount); AnItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
// group // group
if ABreakpoint.Group = nil if ABreakpoint.Group = nil
then AItem.SubItems[5] := '' then AnItem.SubItems[5] := ''
else AItem.SubItems[5] := ABreakpoint.Group.Name; else AnItem.SubItems[5] := ABreakpoint.Group.Name;
end; end;
procedure TBreakPointsDlg.UpdateAll; procedure TBreakPointsDlg.UpdateAll;
@ -376,6 +385,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.14 2003/05/28 08:46:24 mattias
break;points dialog now gets the items without debugger
Revision 1.13 2003/05/27 20:58:12 mattias Revision 1.13 2003/05/27 20:58:12 mattias
implemented enable and deleting breakpoint in breakpoint dlg implemented enable and deleting breakpoint in breakpoint dlg

View File

@ -72,15 +72,12 @@ end;
procedure TDebuggerDlg.BeginUpdate; procedure TDebuggerDlg.BeginUpdate;
begin begin
inc(FUpdateCount); inc(FUpdateCount);
writeln('TDebuggerDlg.BeginUpdate ',ClassName,' ',FUpdateCount);
end; end;
procedure TDebuggerDlg.EndUpdate; procedure TDebuggerDlg.EndUpdate;
begin begin
if FUpdateCount<1 then RaiseException('TDebuggerDlg.EndUpdate'); if FUpdateCount<1 then RaiseException('TDebuggerDlg.EndUpdate');
dec(FUpdateCount); dec(FUpdateCount);
writeln('TDebuggerDlg.EndUpdate ',ClassName,' ',FUpdateCount);
if FUpdateCount=0 then DoEndUpdate; if FUpdateCount=0 then DoEndUpdate;
end; end;
@ -112,6 +109,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.5 2003/05/28 08:46:24 mattias
break;points dialog now gets the items without debugger
Revision 1.4 2003/05/27 20:58:12 mattias Revision 1.4 2003/05/27 20:58:12 mattias
implemented enable and deleting breakpoint in breakpoint dlg implemented enable and deleting breakpoint in breakpoint dlg

View File

@ -75,7 +75,8 @@ type
private private
FDebugger: TDebugger; FDebugger: TDebugger;
FDebuggerUpdateLock: integer; FDebuggerUpdateLock: integer;
FBreakpointsNotification: TDBGBreakPointsNotification; // Notification for our BreakPoints FBreakpointsNotification: TDBGBreakPointsNotification;// Notification for
// 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
@ -89,13 +90,16 @@ type
FUserSourceFiles: TStringList; FUserSourceFiles: TStringList;
// Breakpoint routines // Breakpoint routines
procedure BreakpointAdded(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint); procedure BreakpointAdded(const ASender: TDBGBreakPoints;
procedure BreakpointRemoved(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint); const ABreakpoint: TDBGBreakPoint);
procedure BreakpointRemoved(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
// Dialog routines // Dialog routines
procedure DebugDialogDestroy(Sender: TObject); procedure DebugDialogDestroy(Sender: TObject);
procedure ViewDebugDialog(const ADialogType: TDebugDialogType); procedure ViewDebugDialog(const ADialogType: TDebugDialogType);
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType); procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
procedure InitBreakPointDlg;
protected protected
function GetState: TDBGState; override; function GetState: TDBGState; override;
function GetCommands: TDBGCommands; override; function GetCommands: TDBGCommands; override;
@ -163,7 +167,8 @@ type
FMaster: TDBGBreakPoints; FMaster: TDBGBreakPoints;
FMasterNotification: TDBGBreakPointsNotification; FMasterNotification: TDBGBreakPointsNotification;
procedure SetMaster(const AValue: TDBGBreakPoints); procedure SetMaster(const AValue: TDBGBreakPoints);
procedure MasterUpdate(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint); procedure MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
@ -187,7 +192,9 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TManagedBreakPoints.MasterUpdate(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint); procedure TManagedBreakPoints.MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
function FindItem: TManagedBreakPoint; function FindItem: TManagedBreakPoint;
var var
n: Integer; n: Integer;
@ -557,16 +564,14 @@ begin
then begin then begin
FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self); FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self);
CurDialog:=FDialogs[ADialogType]; CurDialog:=FDialogs[ADialogType];
if (CurDialog is TBreakPointsDlg) then begin
if (Project1<>nil) then
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
end;
CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]]; CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]];
CurDialog.Tag := Integer(ADialogType); CurDialog.Tag := Integer(ADialogType);
CurDialog.OnDestroy := @DebugDialogDestroy; CurDialog.OnDestroy := @DebugDialogDestroy;
DoInitDebugger;
CurDialog.Debugger := FDebugger;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name); EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
if (CurDialog is TBreakPointsDlg) then
InitBreakPointDlg;
//DoInitDebugger;
//CurDialog.Debugger := FDebugger;
end else begin end else begin
CurDialog:=FDialogs[ADialogType]; CurDialog:=FDialogs[ADialogType];
if (CurDialog is TBreakPointsDlg) then begin if (CurDialog is TBreakPointsDlg) then begin
@ -587,6 +592,16 @@ begin
FDialogs[ADialogType] := nil; FDialogs[ADialogType] := nil;
end; end;
procedure TDebugManager.InitBreakPointDlg;
var
TheDialog: TBreakPointsDlg;
begin
TheDialog:=TBreakPointsDlg(FDialogs[ddtBreakpoints]);
if (Project1<>nil) then
TheDialog.BaseDirectory:=Project1.ProjectDirectory;
TheDialog.BreakPointsUpdate(FBreakPoints);
end;
constructor TDebugManager.Create(TheOwner: TComponent); constructor TDebugManager.Create(TheOwner: TComponent);
var var
DialogType: TDebugDialogType; DialogType: TDebugDialogType;
@ -765,14 +780,16 @@ begin
end; end;
end; end;
procedure TDebugManager.BreakpointAdded(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint ); procedure TDebugManager.BreakpointAdded(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
begin begin
ABreakpoint.InitialEnabled := True; ABreakpoint.InitialEnabled := True;
ABreakpoint.Enabled := True; ABreakpoint.Enabled := True;
Project1.Modified := True; Project1.Modified := True;
end; end;
procedure TDebugManager.BreakpointRemoved (const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint ); procedure TDebugManager.BreakpointRemoved(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
begin begin
Project1.Modified := True; Project1.Modified := True;
end; end;
@ -878,7 +895,7 @@ begin
try try
case EnvironmentOptions.DebuggerType of case EnvironmentOptions.DebuggerType of
dtGnuDebugger: begin dtGnuDebugger: begin
// check if debugger already created with the right type // check if debugger is already created with the right type
if (FDebugger <> nil) if (FDebugger <> nil)
and ( not(FDebugger is TGDBMIDebugger) and ( not(FDebugger is TGDBMIDebugger)
or (FDebugger.ExternalDebugger <> EnvironmentOptions.DebuggerFilename) or (FDebugger.ExternalDebugger <> EnvironmentOptions.DebuggerFilename)
@ -1003,7 +1020,7 @@ begin
Result:=mrCancel; Result:=mrCancel;
MessageDlg('Program is running', MessageDlg('Program is running',
'You can not change any debugger item while the program is running.'#13 'You can not change any debugger item while the program is running.'#13
+'Stop it first.',mtError,[mbCancel],0); +'Pause or Stop it first.',mtError,[mbCancel],0);
end else end else
Result:=mrOk; Result:=mrOk;
if Result<>mrOk then begin if Result<>mrOk then begin
@ -1050,10 +1067,8 @@ begin
and FDebugger.Evaluate(AExpression, AResult); and FDebugger.Evaluate(AExpression, AResult);
end; end;
function TDebugManager.DoCreateBreakPoint(const AFilename: string; ALine: integer function TDebugManager.DoCreateBreakPoint(const AFilename: string;
): TModalResult; ALine: integer): TModalResult;
var
NewBreak: TDBGBreakPoint;
begin begin
if FBreakPoints.Find(AFilename, ALine)<>nil then begin if FBreakPoints.Find(AFilename, ALine)<>nil then begin
Result:=mrOk; Result:=mrOk;
@ -1061,16 +1076,12 @@ begin
end; end;
Result:=DoBeginChangeDebugger; Result:=DoBeginChangeDebugger;
if Result<>mrOk then exit; if Result<>mrOk then exit;
NewBreak := FBreakPoints.Add(AFilename, ALine); FBreakPoints.Add(AFilename, ALine);
// Set by notification
// NewBreak.InitialEnabled := True;
// NewBreak.Enabled := True;
// Project1.Modified:=true;
Result:=DoEndChangeDebugger; Result:=DoEndChangeDebugger;
end; end;
function TDebugManager.DoDeleteBreakPoint(const AFilename: string; ALine: integer function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
): TModalResult; ALine: integer): TModalResult;
var var
OldBreakPoint: TDBGBreakPoint; OldBreakPoint: TDBGBreakPoint;
begin begin
@ -1124,7 +1135,8 @@ begin
then UnitFilename:=ActiveUnitInfo.Filename then UnitFilename:=ActiveUnitInfo.Filename
else UnitFilename:=MainIDE.GetTestUnitFilename(ActiveUnitInfo); else UnitFilename:=MainIDE.GetTestUnitFilename(ActiveUnitInfo);
FDebugger.RunTo(ExtractFilename(UnitFilename), ActiveSrcEdit.EditorComponent.CaretY); FDebugger.RunTo(ExtractFilename(UnitFilename),
ActiveSrcEdit.EditorComponent.CaretY);
Result := mrOK; Result := mrOK;
end; end;
@ -1147,6 +1159,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.32 2003/05/28 08:46:23 mattias
break;points dialog now gets the items without debugger
Revision 1.31 2003/05/28 00:58:50 marc Revision 1.31 2003/05/28 00:58:50 marc
MWE: * Reworked breakpoint handling MWE: * Reworked breakpoint handling