8
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, LCLProc,
9
ExtCtrls, StdCtrls, Buttons, DebuggerDlg, Debugger, ButtonPanel, EditBtn,
10
BaseDebugManager, IDEContextHelpEdit, LazarusIDEStrConsts, InputHistory;
8
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
9
ButtonPanel, EditBtn, Spin, IDEHelpIntf, BreakPropertyDlgGroups, DebuggerDlg,
10
Debugger, BaseDebugManager, LazarusIDEStrConsts, InputHistory, IDEProcs;
38
44
lblHitCount: TLabel;
40
46
lblAutoContinue: TLabel;
47
edtLogCallStack: TSpinEdit;
48
rbWrite: TRadioButton;
50
rbReadWrite: TRadioButton;
51
rbGlobal: TRadioButton;
52
rbLocal: TRadioButton;
41
55
procedure btnHelpClick(Sender: TObject);
42
56
procedure btnOKClick(Sender: TObject);
43
57
procedure BreakPointRemove(const ASender: TIDEBreakPoints;
44
58
const ABreakpoint: TIDEBreakPoint);
45
59
procedure BreakPointUpdate(const ASender: TIDEBreakPoints;
46
60
const ABreakpoint: TIDEBreakPoint);
61
procedure chkDisableGroupsChange(Sender: TObject);
62
procedure chkEnableGroupsChange(Sender: TObject);
63
procedure chkEvalExpressionChange(Sender: TObject);
64
procedure chkLogCallStackChange(Sender: TObject);
65
procedure chkLogMessageChange(Sender: TObject);
66
procedure cmbGroupKeyPress(Sender: TObject; var Key: char);
67
procedure edtDisableGroupsButtonClick(Sender: TObject);
68
procedure edtEnableGroupsButtonClick(Sender: TObject);
48
70
FBreakpointsNotification : TIDEBreakPointsNotification;
49
71
FBreakpoint: TIDEBreakPoint;
72
FUpdatingInfo: Boolean;
51
74
procedure DoEndUpdate; override;
52
75
procedure UpdateInfo;
93
procedure TBreakPropertyDlg.chkDisableGroupsChange(Sender: TObject);
95
edtDisableGroups.Enabled := chkDisableGroups.Checked;
98
procedure TBreakPropertyDlg.chkEnableGroupsChange(Sender: TObject);
100
edtEnableGroups.Enabled := chkEnableGroups.Checked;
103
procedure TBreakPropertyDlg.chkEvalExpressionChange(Sender: TObject);
105
edtEvalExpression.Enabled := chkEvalExpression.Checked;
108
procedure TBreakPropertyDlg.chkLogCallStackChange(Sender: TObject);
110
edtLogCallStack.Enabled := chkLogCallStack.Checked;
113
procedure TBreakPropertyDlg.chkLogMessageChange(Sender: TObject);
115
edtLogMessage.Enabled := chkLogMessage.Checked;
118
procedure TBreakPropertyDlg.cmbGroupKeyPress(Sender: TObject; var Key: char);
120
if Key = ';' then Key := #0;
123
procedure TBreakPropertyDlg.edtDisableGroupsButtonClick(Sender: TObject);
127
if FBreakpoint = nil then Exit;
128
s := edtDisableGroups.Text;
129
if ExecuteBreakPointGroupDlg(FBreakpoint, s, DebugBoss.BreakPointGroups, bgaDisable) = mrok
130
then edtDisableGroups.Text := s;
133
procedure TBreakPropertyDlg.edtEnableGroupsButtonClick(Sender: TObject);
137
if FBreakpoint = nil then Exit;
138
s := edtEnableGroups.Text;
139
if ExecuteBreakPointGroupDlg(FBreakpoint, s, DebugBoss.BreakPointGroups, bgaEnable) = mrok
140
then edtEnableGroups.Text := s;
70
143
procedure TBreakPropertyDlg.btnHelpClick(Sender: TObject);
72
ShowContextHelpForIDE(Self);
145
LazarusHelp.ShowHelpForIDEControl(Self);
75
148
procedure TBreakPropertyDlg.BreakPointRemove(
82
155
procedure TBreakPropertyDlg.btnOKClick(Sender: TObject);
156
function CheckGroupList(Alist: TStringList): Boolean;
161
NewGroup: TIDEBreakPointGroup;
165
for i := 0 to Alist.Count-1 do begin
166
if Alist[i] = '' then continue;
167
if DebugBoss.BreakPointGroups.GetGroupByName(Alist[i]) = nil then
168
s := s + ', ' + Alist[i];
172
r := MessageDlg(Format(dbgBreakPropertyGroupNotFound, [LineEnding, s]),
173
mtConfirmation, [mbYes, mbIgnore, mbCancel], 0);
174
if r = mrCancel then exit(False);
175
if r = mrYes then begin
176
for i := 0 to Alist.Count-1 do begin
177
if Alist[i] = '' then continue;
178
if DebugBoss.BreakPointGroups.GetGroupByName(Alist[i]) = nil then begin
179
NewGroup := TIDEBreakPointGroup(DebugBoss.BreakPointGroups.Add);
180
NewGroup.Name := Alist[i];
84
186
Actions: TIDEBreakPointActions;
188
NewGroup: TIDEBreakPointGroup;
189
ws: TDBGWatchPointScope;
190
wk: TDBGWatchPointKind;
192
EnableGroupList, DisableGroupList: TStringList;
86
194
if FBreakpoint = nil then Exit;
88
FBreakpointsNotification.OnUpdate := nil;
91
FBreakpoint.SetLocation(edtFilename.Text, StrToIntDef(edtLine.Text, 1));
93
FBreakpoint.Expression := edtCondition.Text;
95
FBreakpoint.BreakHitCount := StrToIntDef(edtCounter.Text, FBreakpoint.HitCount);
97
FBreakpoint.AutoContinueTime := StrToIntDef(edtAutocontinueMS.Text, FBreakpoint.AutoContinueTime);
99
FBreakpoint.Group := DebugBoss.BreakPointGroups.GetGroupByName(cmbGroup.Text);
102
if chkActionBreak.Checked then Include(Actions, bpaStop);
103
if chkDisableGroups.Checked then Include(Actions, bpaDisableGroup);
104
if chkEnableGroups.Checked then Include(Actions, bpaEnableGroup);
105
// if chkEvalExpression.Checked then Include(Actions, bpaEValExpression);
106
// if chkLogMessage.Checked then Include(Actions, bpaLogMessage);
107
FBreakpoint.Actions := Actions;
109
InputHistories.HistoryLists.GetList('BreakPointExpression', True).Add(edtCondition.Text);
196
EnableGroupList := TStringList.Create;
197
DisableGroupList := TStringList.Create;
200
EnableGroupList.Delimiter := ';';
201
DisableGroupList.Delimiter := ';';
203
EnableGroupList.DelimitedText := edtEnableGroups.Text+';'+edtDisableGroups.Text;
204
if not CheckGroupList(EnableGroupList) then begin
205
ModalResult := mrNone;
209
EnableGroupList.DelimitedText := edtEnableGroups.Text;
210
DisableGroupList.DelimitedText := edtDisableGroups.Text;
212
FBreakpointsNotification.OnUpdate := nil;
213
case FBreakpoint.Kind of
217
FBreakpoint.SetLocation(edtFilename.Text, edtLine.Value);
221
FBreakpoint.SetAddress(StrToQWordDef(edtFilename.Text, 0));
231
if rbReadWrite.Checked
232
then wk := wpkReadWrite;
233
FBreakpoint.SetWatch(edtFilename.Text, ws, wk);
237
FBreakpoint.Expression := edtCondition.Text;
239
FBreakpoint.BreakHitCount := StrToIntDef(edtCounter.Text, FBreakpoint.HitCount);
241
FBreakpoint.AutoContinueTime := StrToIntDef(edtAutocontinueMS.Text, FBreakpoint.AutoContinueTime);
243
GroupName := cmbGroup.Text;
244
NewGroup := DebugBoss.BreakPointGroups.GetGroupByName(GroupName);
245
if not Assigned(NewGroup) and (GroupName <> '') then
247
NewGroup := TIDEBreakPointGroup(DebugBoss.BreakPointGroups.Add);
248
NewGroup.Name := GroupName;
250
FBreakpoint.Group := NewGroup;
252
for i := 0 to DebugBoss.BreakPointGroups.Count-1 do begin
253
NewGroup := DebugBoss.BreakPointGroups[i];
254
if EnableGroupList.IndexOf(NewGroup.Name) >= 0
255
then FBreakpoint.EnableGroupList.Add(NewGroup)
256
else FBreakpoint.EnableGroupList.Remove(NewGroup);
259
for i := 0 to DebugBoss.BreakPointGroups.Count-1 do begin
260
NewGroup := DebugBoss.BreakPointGroups[i];
261
if DisableGroupList.IndexOf(NewGroup.Name) >= 0
262
then FBreakpoint.DisableGroupList.Add(NewGroup)
263
else FBreakpoint.DisableGroupList.Remove(NewGroup);
267
if chkActionBreak.Checked then Include(Actions, bpaStop);
268
if chkDisableGroups.Checked then Include(Actions, bpaDisableGroup);
269
if chkEnableGroups.Checked then Include(Actions, bpaEnableGroup);
270
if chkEvalExpression.Checked then Include(Actions, bpaEValExpression);
271
if chkLogMessage.Checked then Include(Actions, bpaLogMessage);
272
if chkLogCallStack.Checked then Include(Actions, bpaLogCallStack);
273
if chkTakeSnap.Checked then include(Actions, bpaTakeSnapshot);
274
FBreakpoint.Actions := Actions;
275
FBreakpoint.LogEvalExpression := edtEvalExpression.Text;
276
FBreakpoint.LogMessage := edtLogMessage.Text;
277
FBreakpoint.LogCallStackLimit := edtLogCallStack.Value;
279
InputHistories.HistoryLists.GetList('BreakPointExpression', True,
280
rltCaseSensitive).Add(edtCondition.Text);
282
EnableGroupList.Free;
283
DisableGroupList.Free;
112
287
procedure TBreakPropertyDlg.DoEndUpdate;
118
293
procedure TBreakPropertyDlg.UpdateInfo;
120
295
Actions: TIDEBreakPointActions;
299
FUpdatingInfo := True;
122
300
if FBreakpoint = nil then Exit;
124
edtFilename.text := FBreakpoint.Source;
126
if FBreakpoint.Line > 0
127
then edtLine.Text := IntToStr(FBreakpoint.Line)
128
else edtLine.Text := '';
301
case FBreakpoint.Kind of
305
edtFilename.Text := FBreakpoint.Source;
307
if FBreakpoint.Line > 0
308
then edtLine.Value := FBreakpoint.Line
309
else edtLine.Value := 0;
313
edtFilename.Text := '$' + IntToHex(FBreakpoint.Address, 8); // todo: 8/16 depends on platform
317
edtFilename.Text := FBreakpoint.WatchData;
318
rbGlobal.Checked := FBreakpoint.WatchScope = wpsGlobal;
319
rbLocal.Checked := FBreakpoint.WatchScope = wpsLocal;
320
rbWrite.Checked := FBreakpoint.WatchKind = wpkWrite;
321
rbRead.Checked := FBreakpoint.WatchKind = wpkRead;
322
rbReadWrite.Checked := FBreakpoint.WatchKind = wpkReadWrite;
130
326
edtCondition.Text := FBreakpoint.Expression;
134
330
edtAutocontinueMS.Text := IntToStr(FBreakpoint.AutoContinueTime);
332
for I := 0 to DebugBoss.BreakPointGroups.Count - 1 do
333
cmbGroup.Items.Add(DebugBoss.BreakPointGroups[I].Name);
136
334
if FBreakpoint.Group = nil
137
335
then cmbGroup.Text := ''
138
336
else cmbGroup.Text := FBreakpoint.Group.Name;
339
for i := 0 to FBreakpoint.EnableGroupList.Count - 1 do begin
340
if s <> '' then s := s + ';';
341
s := s + FBreakpoint.EnableGroupList[i].Name;
343
edtEnableGroups.Text := s;
346
for i := 0 to FBreakpoint.DisableGroupList.Count - 1 do begin
347
if s <> '' then s := s + ';';
348
s := s + FBreakpoint.DisableGroupList[i].Name;
350
edtDisableGroups.Text := s;
141
353
Actions := FBreakpoint.Actions;
142
354
chkActionBreak.Checked := bpaStop in Actions;
143
355
chkDisableGroups.Checked := bpaDisableGroup in Actions;
144
356
chkEnableGroups.Checked := bpaEnableGroup in Actions;
145
// chkEvalExpression.Checked := bpaEValExpression in Actions;
146
// chkLogMessage.Checked := bpaLogMessage in Actions;
357
chkEvalExpression.Checked := bpaEValExpression in Actions;
358
chkLogMessage.Checked := bpaLogMessage in Actions;
359
edtLogMessage.Text := FBreakpoint.LogMessage;
360
edtEvalExpression.Text := FBreakpoint.LogEvalExpression;
361
chkLogCallStack.Checked := bpaLogCallStack in Actions;
362
edtLogCallStack.Value := FBreakpoint.LogCallStackLimit;
363
chkTakeSnap.Checked := bpaTakeSnapshot in Actions;
364
FUpdatingInfo := False;
149
367
constructor TBreakPropertyDlg.Create(AOwner: TComponent; ABreakPoint: TIDEBreakPoint);
151
369
inherited Create(AOwner);
153
371
Caption := lisBreakPointProperties;
154
lblFileName.Caption := lisPEFilename;
155
lblLine.Caption := lisLine;
372
case ABreakPoint.Kind of
375
lblFileName.Caption := lisPEFilename;
376
lblLine.Caption := lisLine;
380
lblFileName.Caption := lisAddress;
381
lblLine.Visible := False;
382
edtLine.Visible := False;
383
edtFilename.ReadOnly := False;
384
edtFilename.Color := clDefault;
388
lblFileName.Caption := lisWatchData;
389
lblLine.Visible := False;
390
edtLine.Visible := False;
391
edtFilename.ReadOnly := False;
392
edtFilename.Color := clDefault;
393
lblWatchKind.Visible := True;
394
lblWatchScope.Visible := True;
395
rgWatchKind.Visible := True;
396
rgWatchScope.Visible := True;
397
lblWatchScope.Caption := lisWatchScope;
398
lblWatchKind.Caption := lisWatchKind;
399
rbGlobal.Caption := lisWatchScopeGlobal;
400
rbLocal.Caption := lisWatchScopeLocal;
401
rbWrite.Caption := lisWatchKindWrite;
402
rbRead.Caption := lisWatchKindRead;
403
rbReadWrite.Caption := lisWatchKindReadWrite;
156
406
lblCondition.Caption := lisCondition + ':';
157
407
lblHitCount.Caption := lisHitCount + ':';
158
408
lblAutoContinue.Caption := lisAutoContinueAfter;
160
410
lblGroup.Caption := lisGroup + ':';
161
411
gbActions.Caption := lisActions;
162
412
chkActionBreak.Caption := lisBreak;
163
chkEnableGroups.Caption := lisEnableGroup;
164
chkDisableGroups.Caption := lisDisableGroup;
413
chkEnableGroups.Caption := lisEnableGroups;
414
chkDisableGroups.Caption := lisDisableGroups;
165
415
chkEvalExpression.Caption := lisEvalExpression;
166
416
chkLogMessage.Caption := lisLogMessage;
167
edtCondition.Items.Assign(InputHistories.HistoryLists.GetList('BreakPointExpression', True));
417
chkLogCallStack.Caption := lisLogCallStack;
418
lblLogCallStackLimit.Caption := lisLogCallStackLimit;
419
chkTakeSnap.Caption := lisTakeSnapshot;
420
edtCondition.Items.Assign(InputHistories.HistoryLists.GetList(
421
'BreakPointExpression', True,rltCaseSensitive));
169
423
FBreakpoint := ABreakPoint;
170
424
FBreakpointsNotification := TIDEBreakPointsNotification.Create;