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...'
object popAddSourceBP: TMenuItem
Caption = '&Source breakpoint'
Enabled = False
OnClick = popAddSourceBPClick
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
+#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'
+'opAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'OnClick'#7#19'popAddSo'
+'urceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13
+'popProperties'#7'Caption'#6#11'&Properties'#7'OnClick'#7#18'popPropertiesCl'
+'ick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#19'ShowAlways'
+'Checkable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9'popDelete'
+#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteClick'#0#0#9'TMenuItem'#2
+'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'Caption'#6#12'D&'
+'isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem'#12'popEnab'
+'leAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllClick'#0#0#9
+'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnClick'#7#17'po'
+'pDeleteAllClick'#0#0#0#0
+'opAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'Enabled'#8#7'OnClick'#7
+#19'popAddSourceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TM'
+'enuItem'#13'popProperties'#7'Caption'#6#11'&Properties'#7'OnClick'#7#18'pop'
+'PropertiesClick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#19
+'ShowAlwaysCheckable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9
+'popDelete'#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteClick'#0#0#9'TM'
+'enuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'Capti'
+'on'#6#12'D&isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem'
+#12'popEnableAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllC'
+'lick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnCl'
+'ick'#7#17'popDeleteAllClick'#0#0#0#0
]);

View File

@ -83,8 +83,8 @@ type
const ABreakpoint: TDBGBreakPoint);
procedure SetBaseDirectory(const AValue: string);
procedure UpdateItem(const AItem: TListItem;
const ABreakpoint: TDBGBreakPoint);
procedure UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint);
procedure UpdateAll;
protected
procedure SetDebugger(const ADebugger: TDebugger); override;
@ -92,6 +92,7 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BreakPointsUpdate(const ASender: TDBGBreakPoints);
public
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
end;
@ -170,6 +171,14 @@ begin
inherited;
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);
begin
end;
@ -293,7 +302,7 @@ begin
if bpdsItemsNeedUpdate in FStates then UpdateAll;
end;
procedure TBreakPointsDlg.UpdateItem(const AItem: TListItem;
procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem;
const ABreakpoint: TDBGBreakPoint);
const
DEBUG_ACTION: array[TDBGBreakPointAction] of string =
@ -317,21 +326,21 @@ begin
// Group
// state
AItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid];
AnItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid];
// filename
Filename:=ABreakpoint.Source;
if BaseDirectory<>'' then
Filename:=CreateRelativePath(Filename,BaseDirectory);
AItem.SubItems[0] := Filename;
AnItem.SubItems[0] := Filename;
// line
if ABreakpoint.Line > 0
then AItem.SubItems[1] := IntToStr(ABreakpoint.Line)
else AItem.SubItems[1] := '';
then AnItem.SubItems[1] := IntToStr(ABreakpoint.Line)
else AnItem.SubItems[1] := '';
// expression
AItem.SubItems[2] := ABreakpoint.Expression;
AnItem.SubItems[2] := ABreakpoint.Expression;
// actions
S := '';
@ -341,15 +350,15 @@ begin
if S <> '' then s := S + ', ';
S := S + DEBUG_ACTION[Action]
end;
AItem.SubItems[3] := S;
AnItem.SubItems[3] := S;
// hitcount
AItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
AnItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
// group
if ABreakpoint.Group = nil
then AItem.SubItems[5] := ''
else AItem.SubItems[5] := ABreakpoint.Group.Name;
then AnItem.SubItems[5] := ''
else AnItem.SubItems[5] := ABreakpoint.Group.Name;
end;
procedure TBreakPointsDlg.UpdateAll;
@ -376,6 +385,9 @@ end.
{ =============================================================================
$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
implemented enable and deleting breakpoint in breakpoint dlg

View File

@ -72,15 +72,12 @@ end;
procedure TDebuggerDlg.BeginUpdate;
begin
inc(FUpdateCount);
writeln('TDebuggerDlg.BeginUpdate ',ClassName,' ',FUpdateCount);
end;
procedure TDebuggerDlg.EndUpdate;
begin
if FUpdateCount<1 then RaiseException('TDebuggerDlg.EndUpdate');
dec(FUpdateCount);
writeln('TDebuggerDlg.EndUpdate ',ClassName,' ',FUpdateCount);
if FUpdateCount=0 then DoEndUpdate;
end;
@ -112,6 +109,9 @@ end;
{ =============================================================================
$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
implemented enable and deleting breakpoint in breakpoint dlg

View File

@ -75,7 +75,8 @@ type
private
FDebugger: TDebugger;
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
// own variables. When the debugger object is created these items point
@ -89,13 +90,16 @@ type
FUserSourceFiles: TStringList;
// Breakpoint routines
procedure BreakpointAdded(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint);
procedure BreakpointRemoved(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint);
procedure BreakpointAdded(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
procedure BreakpointRemoved(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
// Dialog routines
procedure DebugDialogDestroy(Sender: TObject);
procedure ViewDebugDialog(const ADialogType: TDebugDialogType);
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
procedure InitBreakPointDlg;
protected
function GetState: TDBGState; override;
function GetCommands: TDBGCommands; override;
@ -163,7 +167,8 @@ type
FMaster: TDBGBreakPoints;
FMasterNotification: TDBGBreakPointsNotification;
procedure SetMaster(const AValue: TDBGBreakPoints);
procedure MasterUpdate(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint);
procedure MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
public
constructor Create;
destructor Destroy; override;
@ -187,7 +192,9 @@ begin
inherited Destroy;
end;
procedure TManagedBreakPoints.MasterUpdate(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint);
procedure TManagedBreakPoints.MasterUpdate(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
function FindItem: TManagedBreakPoint;
var
n: Integer;
@ -557,16 +564,14 @@ begin
then begin
FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self);
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.Tag := Integer(ADialogType);
CurDialog.OnDestroy := @DebugDialogDestroy;
DoInitDebugger;
CurDialog.Debugger := FDebugger;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
if (CurDialog is TBreakPointsDlg) then
InitBreakPointDlg;
//DoInitDebugger;
//CurDialog.Debugger := FDebugger;
end else begin
CurDialog:=FDialogs[ADialogType];
if (CurDialog is TBreakPointsDlg) then begin
@ -587,6 +592,16 @@ begin
FDialogs[ADialogType] := nil;
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);
var
DialogType: TDebugDialogType;
@ -765,14 +780,16 @@ begin
end;
end;
procedure TDebugManager.BreakpointAdded(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint );
procedure TDebugManager.BreakpointAdded(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
begin
ABreakpoint.InitialEnabled := True;
ABreakpoint.Enabled := True;
Project1.Modified := True;
end;
procedure TDebugManager.BreakpointRemoved (const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint );
procedure TDebugManager.BreakpointRemoved(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
begin
Project1.Modified := True;
end;
@ -878,7 +895,7 @@ begin
try
case EnvironmentOptions.DebuggerType of
dtGnuDebugger: begin
// check if debugger already created with the right type
// check if debugger is already created with the right type
if (FDebugger <> nil)
and ( not(FDebugger is TGDBMIDebugger)
or (FDebugger.ExternalDebugger <> EnvironmentOptions.DebuggerFilename)
@ -1003,7 +1020,7 @@ begin
Result:=mrCancel;
MessageDlg('Program is running',
'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
Result:=mrOk;
if Result<>mrOk then begin
@ -1050,10 +1067,8 @@ begin
and FDebugger.Evaluate(AExpression, AResult);
end;
function TDebugManager.DoCreateBreakPoint(const AFilename: string; ALine: integer
): TModalResult;
var
NewBreak: TDBGBreakPoint;
function TDebugManager.DoCreateBreakPoint(const AFilename: string;
ALine: integer): TModalResult;
begin
if FBreakPoints.Find(AFilename, ALine)<>nil then begin
Result:=mrOk;
@ -1061,16 +1076,12 @@ begin
end;
Result:=DoBeginChangeDebugger;
if Result<>mrOk then exit;
NewBreak := FBreakPoints.Add(AFilename, ALine);
// Set by notification
// NewBreak.InitialEnabled := True;
// NewBreak.Enabled := True;
// Project1.Modified:=true;
FBreakPoints.Add(AFilename, ALine);
Result:=DoEndChangeDebugger;
end;
function TDebugManager.DoDeleteBreakPoint(const AFilename: string; ALine: integer
): TModalResult;
function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
ALine: integer): TModalResult;
var
OldBreakPoint: TDBGBreakPoint;
begin
@ -1124,7 +1135,8 @@ begin
then UnitFilename:=ActiveUnitInfo.Filename
else UnitFilename:=MainIDE.GetTestUnitFilename(ActiveUnitInfo);
FDebugger.RunTo(ExtractFilename(UnitFilename), ActiveSrcEdit.EditorComponent.CaretY);
FDebugger.RunTo(ExtractFilename(UnitFilename),
ActiveSrcEdit.EditorComponent.CaretY);
Result := mrOK;
end;
@ -1147,6 +1159,9 @@ end.
{ =============================================================================
$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
MWE: * Reworked breakpoint handling