+ Added watches
  * Updated watches and watchproperty dialog to load as resource
  = renamed debugger resource files from *.lrc to *.lrs
  * Temporary fixed language problems on GDB (bug )
  * Made Debugmanager dialog handling more generic

git-svn-id: trunk@1636 -
This commit is contained in:
lazarus 2002-04-24 20:42:29 +00:00
parent d969776637
commit d894f24b93
28 changed files with 1715 additions and 1023 deletions

13
.gitattributes vendored
View File

@ -51,22 +51,32 @@ components/synedit/synhighlighterpas.pp svneol=native#text/pascal
components/synedit/synhighlighterperl.pas svneol=native#text/pascal
components/synedit/synhighlighterxml.pas svneol=native#text/pascal
components/synedit/syntextdrawer.pp svneol=native#text/pascal
debugger/breakpointsdlg.lrs svneol=native#text/pascal
debugger/breakpointsdlg.pp svneol=native#text/pascal
debugger/cmdlinedebugger.pp svneol=native#text/pascal
debugger/dbgoutputform.lrs svneol=native#text/pascal
debugger/dbgoutputform.pp svneol=native#text/pascal
debugger/debugger.pp svneol=native#text/pascal
debugger/debuggerdlg.pp svneol=native#text/pascal
debugger/gdbdebugger.pp svneol=native#text/pascal
debugger/gdbmidebugger.pp svneol=native#text/pascal
debugger/localsdlg.lrs svneol=native#text/pascal
debugger/localsdlg.pp svneol=native#text/pascal
debugger/tbreakpointsdlg.lfm svneol=native#text/plain
debugger/tdbgoutputform.lfm svneol=native#text/plain
debugger/test/debugtest.pp svneol=native#text/pascal
debugger/test/debugtestform.lrs svneol=native#text/pascal
debugger/test/debugtestform.pp svneol=native#text/pascal
debugger/test/examples/testcntr.pp svneol=native#text/pascal
debugger/test/examples/testwait.pp svneol=native#text/pascal
debugger/test/tdebugtesttorm.lfm svneol=native#text/plain
debugger/tlocalsdlg.lfm svneol=native#text/plain
debugger/twatchesdlg.lfm svneol=native#text/plain
debugger/twatchpropertydlg.lfm svneol=native#text/plain
debugger/watchesdlg.lrs svneol=native#text/pascal
debugger/watchesdlg.pp svneol=native#text/pascal
debugger/watchpropertydlg.lrs svneol=native#text/pascal
debugger/watchpropertydlg.pp svneol=native#text/pascal
designer/abstractcompiler.pp svneol=native#text/pascal
designer/abstracteditor.pp svneol=native#text/pascal
designer/abstractfilesystem.pp svneol=native#text/pascal
@ -152,7 +162,6 @@ ide/include/netbsd/lazconf.inc svneol=native#text/pascal
ide/include/win32/lazconf.inc svneol=native#text/pascal
ide/inputfiledialog.pas svneol=native#text/pascal
ide/inputhistory.pas svneol=native#text/pascal
ide/insertwatch.lrs svneol=native#text/pascal
ide/keymapping.pp svneol=native#text/pascal
ide/lazarus.pp svneol=native#text/pascal
ide/lazarus.rc svneol=native#text/plain
@ -185,8 +194,6 @@ ide/viewforms1.lrs svneol=native#text/pascal
ide/viewunit_dlg.lfm svneol=native#text/plain
ide/viewunit_dlg.pp svneol=native#text/pascal
ide/viewunits1.lrs svneol=native#text/pascal
ide/watches_dlg.lrs svneol=native#text/pascal
ide/watchesdlg.pp svneol=native#text/pascal
ide/wordcompletion.pp svneol=native#text/pascal
images/bookmark.lrs svneol=native#text/pascal
images/btn_downarrow.ico -text svneol=unset#image/x-icon

View File

@ -1,24 +0,0 @@
LazarusResources.Add('TBreakpointsDlg','FORMDATA',
'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#4'Left'#3'T'#1#3'Top'#2'u'#5
+'Width'#3'*'#2#6'Height'#3#200#0#7'Caption'#6#11'Breakpoints'#0#9'TListVi'
+'ew'#13'lvBreakPoints'#4'Left'#2#0#3'Top'#2#0#5'Width'#3'"'#2#6'Height'#3
+#171#0#5'Align'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6#5'State'#5'Wid'
+'th'#2'2'#0#1#7'Caption'#6#16'Filename/Address'#5'Width'#3#150#0#0#1#7'Ca'
+'ption'#6#11'Line/Length'#5'Width'#2'd'#0#1#7'Caption'#6#9'Condition'#5'W'
+'idth'#2'K'#0#1#7'Caption'#6#6'Action'#5'Width'#2'2'#0#1#7'Caption'#6#10
+'Pass Count'#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#0#0#11'MultiSelect'#9
+#9'PopupMenu'#7#8'mnuPopup'#9'ViewStyle'#7#8'vsReport'#7'OnClick'#7#18'lv'
+'BreakPointsClick'#12'OnSelectItem'#7#23'lvBreakPointsSelectItem'#0#0#10
+'TPopupMenu'#8'mnuPopup'#4'Left'#2'd'#3'Top'#2'`'#0#9'TMenuItem'#6'popAdd'
+#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'popAddSourceBP'#7'Caption'#6#18
+'&Source breakpoint'#7'OnClick'#7#19'popAddSourceBPClick'#0#0#0#9'TMenuIt'
+'em'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnClick'#7#17'popDel'
+'eteAllClick'#0#0#9'TMenuItem'#13'popDisableAll'#7'Caption'#6#12'D&isable'
+' All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem'#12'popEnableA'
+'ll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllClick'#0#0#0
+#10'TPopupMenu'#14'mnuPopSelected'#4'Left'#3#150#0#3'Top'#2'`'#0#9'TMenuI'
+'tem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#7'OnClick'#7#15'popEnabledC'
+'lick'#0#0#9'TMenuItem'#9'popDelete'#7'Caption'#6#7'&Delete'#7'OnClick'#7
+#14'popDeleteClick'#0#0#9'TMenuItem'#13'popProperties'#7'Caption'#6#11'&P'
+'roperties'#7'OnClick'#7#18'popPropertiesClick'#0#0#0#0
);

View File

@ -0,0 +1,25 @@
LazarusResources.Add('TBreakpointsDlg','FORMDATA',
'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#4'Left'#3'T'#1#3'Top'#2'u'#5
+'Width'#3#244#1#6'Height'#3#200#0#7'Caption'#6#15'Breakpoint list'#0#9'TL'
+'istView'#13'lvBreakPoints'#4'Left'#2#0#3'Top'#2#0#5'Width'#3#228#1#6'Hei'
+'ght'#3#171#0#5'Align'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6#5'State'
+#5'Width'#2'2'#0#1#7'Caption'#6#16'Filename/Address'#5'Width'#3#150#0#0#1
+#7'Caption'#6#11'Line/Length'#5'Width'#2'd'#0#1#7'Caption'#6#9'Condition'
+#5'Width'#2'K'#0#1#7'Caption'#6#6'Action'#5'Width'#2'2'#0#1#7'Caption'#6
+#10'Pass Count'#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#0#0#11'MultiSelec'
+'t'#9#9'PopupMenu'#7#8'mnuPopup'#9'ViewStyle'#7#8'vsReport'#7'OnClick'#7
+#18'lvBreakPointsClick'#12'OnSelectItem'#7#23'lvBreakPointsSelectItem'#0#0
+#10'TPopupMenu'#8'mnuPopup'#4'Left'#2'd'#3'Top'#2'`'#0#9'TMenuItem'#6'pop'
+'Add'#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'popAddSourceBP'#7'Caption'
+#6#18'&Source breakpoint'#7'OnClick'#7#19'popAddSourceBPClick'#0#0#0#9'TM'
+'enuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popProperties'#7'Ca'
+'ption'#6#11'&Properties'#7'OnClick'#7#18'popPropertiesClick'#0#0#9'TMenu'
+'Item'#10'popEnabled'#7'Caption'#6#8'&Enabled'#7'OnClick'#7#15'popEnabled'
+'Click'#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'TMenuI'
+'tem'#13'popDisableAll'#7'Caption'#6#12'D&isable All'#7'OnClick'#7#18'pop'
+'DisableAllClick'#0#0#9'TMenuItem'#12'popEnableAll'#7'Caption'#6#11'&Enab'
+'le All'#7'OnClick'#7#17'popEnableAllClick'#0#0#9'TMenuItem'#12'popDelete'
+'All'#7'Caption'#6#11'&Delete All'#7'OnClick'#7#17'popDeleteAllClick'#0#0
+#0#0
);

View File

@ -40,19 +40,20 @@ type
popAdd: TMenuItem;
popAddSourceBP: TMenuItem;
procedure popAddSourceBPClick(Sender: TObject);
popDeleteAll: TMenuItem;
procedure popDeleteAllClick(Sender: TObject);
popDisableAll: TMenuItem;
procedure popDisableAllClick(Sender: TObject);
popEnableAll: TMenuItem;
procedure popEnableAllClick(Sender: TObject);
mnuPopSelected: TPopupMenu;
N1: TMenuItem; //--------------
popProperties: TMenuItem;
procedure popPropertiesClick(Sender: TObject);
popEnabled: TMenuItem;
procedure popEnabledClick(Sender: TObject);
popDelete: TMenuItem;
procedure popDeleteClick(Sender: TObject);
popProperties: TMenuItem;
procedure popPropertiesClick(Sender: TObject);
N2: TMenuItem; //--------------
popDisableAll: TMenuItem;
procedure popDisableAllClick(Sender: TObject);
popEnableAll: TMenuItem;
procedure popEnableAllClick(Sender: TObject);
popDeleteAll: TMenuItem;
procedure popDeleteAllClick(Sender: TObject);
private
FBreakpointsNotification: TDBGBreakPointsNotification;
procedure BreakPointAdd(const ASender: TDBGBreakPoints; const ABreakpoint: TDBGBreakPoint);
@ -67,7 +68,12 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
//property Dummy: Boolean; // insert some dummies until fpcbug #1888 is fixed
// publish some properties until fpcbug #1888 is fixed
property Top;
property Left;
property Width;
property Height;
property Caption;
end;
@ -134,13 +140,14 @@ begin
// Not yet through resources
mnuPopUp.Items.Add(popAdd);
popAdd.Add(popAddSourceBP);
mnuPopUp.Items.Add(popDeleteAll);
mnuPopUp.Items.Add(N1);
mnuPopUp.Items.Add(popProperties);
mnuPopUp.Items.Add(popEnabled);
mnuPopUp.Items.Add(popDelete);
mnuPopUp.Items.Add(N2);
mnuPopUp.Items.Add(popDisableAll);
mnuPopUp.Items.Add(popEnableAll);
mnuPopSelected.Items.Add(popEnabled);
mnuPopSelected.Items.Add(popDelete);
mnuPopSelected.Items.Add(popProperties);
mnuPopUp.Items.Add(popDeleteAll);
end;
procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject);
@ -149,12 +156,12 @@ end;
procedure TBreakPointsDlg.lvBreakPointsSelectItem(Sender: TObject; AItem: TListItem; Selected: Boolean);
var
Item: TListItem;
Enable: Boolean;
begin
Item := lvBreakPoints.Selected;
if Item = nil
then lvBreakPoints.PopupMenu := mnuPopup
else lvBreakPoints.PopupMenu := mnuPopSelected;
Enable := lvBreakPoints.Selected <> nil;
popProperties.Enabled := Enable;
popEnabled.Enabled := Enable;
popDelete.Enabled := Enable;
end;
procedure TBreakPointsDlg.popAddSourceBPClick(Sender: TObject);
@ -262,12 +269,20 @@ end;
initialization
{$I breakpointsdlg.lrc}
{$I breakpointsdlg.lrs}
end.
{ =============================================================================
$Log$
Revision 1.5 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
Revision 1.4 2002/03/27 00:31:02 lazarus
MWE:
* activated selection dependent popup

View File

@ -411,6 +411,10 @@ begin
if ACommand <> ''
then FDbgProcess.Input.Write(ACommand[1], Length(ACommand));
FDbgProcess.Input.Write(LINE_END, 1);
end
else begin
WriteLN('[TCmdLineDebugger.SendCmdLn] Process stopped running when sending: <', ACommand, '>');
SetState(dsError);
end;
end;
@ -427,6 +431,14 @@ end;
end.
{ =============================================================================
$Log$
Revision 1.9 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
Revision 1.8 2002/03/23 15:54:30 lazarus
MWE:
+ Added locals dialog

View File

@ -42,7 +42,12 @@ type
procedure AddText(const AText: String);
procedure Clear;
published
// property Dummy: Boolean; // insert some dummies until fpcbug #1888 is fixed
// publish some properties until fpcbug #1888 is fixed
property Top;
property Left;
property Width;
property Height;
property Caption;
end;
implementation
@ -84,11 +89,19 @@ begin
end;
initialization
{$I dbgoutputform.lrc}
{$I dbgoutputform.lrs}
end.
{ =============================================================================
$Log$
Revision 1.5 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
Revision 1.4 2002/03/23 15:54:30 lazarus
MWE:
+ Added locals dialog

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
LazarusResources.Add('TLocalsDlg','FORMDATA',
'TPF0'#10'TLocalsDlg'#9'LocalsDlg'#4'Left'#3'g'#1#3'Top'#2'~'#5'Width'#3'<'
+#2#6'Height'#3#12#1#7'Caption'#6#6'Locals'#0#9'TListView'#8'lvLocals'#4'L'
+'eft'#2#0#3'Top'#2#0#5'Width'#3'4'#2#6'Height'#3#239#0#5'Align'#7#8'alCli'
+'ent'#7'Columns'#14#1#7'Caption'#6#4'Name'#5'Width'#3#150#0#0#1#7'Caption'
+#6#5'Value'#5'Width'#3#144#1#0#0#11'MultiSelect'#9#9'ViewStyle'#7#8'vsRep'
+'ort'#0#0#0
);

8
debugger/localsdlg.lrs Normal file
View File

@ -0,0 +1,8 @@
LazarusResources.Add('TLocalsDlg','FORMDATA',
'TPF0'#10'TLocalsDlg'#9'LocalsDlg'#4'Left'#3'g'#1#3'Top'#2'~'#5'Width'#3
+#244#1#6'Height'#3#200#0#7'Caption'#6#6'Locals'#0#9'TListView'#8'lvLocals'
+#4'Left'#2#0#3'Top'#2#0#5'Width'#3#228#1#6'Height'#3#200#0#5'Align'#7#8'a'
+'lClient'#7'Columns'#14#1#7'Caption'#6#4'Name'#5'Width'#3#150#0#0#1#7'Cap'
+'tion'#6#5'Value'#5'Width'#3#144#1#0#0#11'MultiSelect'#9#9'ViewStyle'#7#8
+'vsReport'#0#0#0
);

View File

@ -37,8 +37,13 @@ type
protected
procedure SetDebugger(const ADebugger: TDebugger); override;
public
published
property Dummy: Boolean; // insert some dummies until fpcbug #1888 is fixed
published
// publish some properties until fpcbug #1888 is fixed
property Top;
property Left;
property Width;
property Height;
property Caption;
end;
@ -108,12 +113,20 @@ begin
end;
initialization
{$I localsdlg.lrc}
{$I localsdlg.lrs}
end.
{ =============================================================================
$Log$
Revision 1.2 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
Revision 1.1 2002/03/23 15:54:30 lazarus
MWE:
+ Added locals dialog

View File

@ -1,13 +1,13 @@
object BreakpointsDlg: TBreakpointsDlg
Left = 340
Top = 117
Width = 554
Width = 500
Height = 200
Caption = 'Breakpoints'
Caption = 'Breakpoint list'
object lvBreakPoints: TListView
Left = 0
Top = 0
Width = 546
Width = 484
Height = 171
Align = alClient
Columns = <
@ -54,9 +54,23 @@ object BreakpointsDlg: TBreakpointsDlg
OnClick = popAddSourceBPClick
end
end
object popDeleteAll: TMenuItem
Caption = '&Delete All'
OnClick = popDeleteAllClick
object N1: TMenuItem
Caption = '-'
end
object popProperties: TMenuItem
Caption = '&Properties'
OnClick = popPropertiesClick
end
object popEnabled: TMenuItem
Caption = '&Enabled'
OnClick = popEnabledClick
end
object popDelete: TMenuItem
Caption = '&Delete'
OnClick = popDeleteClick
end
object N2: TMenuItem
Caption = '-'
end
object popDisableAll: TMenuItem
Caption = 'D&isable All'
@ -66,21 +80,9 @@ object BreakpointsDlg: TBreakpointsDlg
Caption = '&Enable All'
OnClick = popEnableAllClick
end
end
object mnuPopSelected: TPopupMenu
Left = 150
Top = 96
object popEnabled: TMenuItem
Caption = '&Enabled'
OnClick = popEnabledClick
end
object popDelete: TMenuItem
Caption = '&Delete'
OnClick = popDeleteClick
end
object popProperties: TMenuItem
Caption = '&Properties'
OnClick = popPropertiesClick
object popDeleteAll: TMenuItem
Caption = '&Delete All'
OnClick = popDeleteAllClick
end
end
end

View File

@ -1,41 +0,0 @@
LazarusResources.Add('TDebugTestForm','FORMDATA',
'TPF0'#14'TDebugTestForm'#14'DebugTestForm1'#7'CAPTION'#6#13'DebugTestForm'
+#4'LEFT'#2#25#6'HEIGHT'#3'@'#1#3'TOP'#2#25#5'WIDTH'#3'l'#2#8'OnCreate'#7
+#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#0#7'TBUTTON'#7'cmdInit'#7
+'CAPTION'#6#4'Init'#4'LEFT'#2#10#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'
+#7'OnClick'#7#12'cmdInitClick'#0#0#7'TBUTTON'#7'cmdDone'#7'CAPTION'#6#4'D'
+'one'#4'LEFT'#2'F'#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7
+#12'cmdDoneClick'#0#0#7'TBUTTON'#6'cmdRun'#7'CAPTION'#6#3'Run'#4'LEFT'#3
+#130#0#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#11'cmdRunCl'
+'ick'#0#0#7'TBUTTON'#8'cmdPause'#7'CAPTION'#6#5'Pause'#4'LEFT'#3#190#0#6
+'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#13'cmdPauseClick'#0
+#0#7'TBUTTON'#7'cmdStop'#7'CAPTION'#6#4'Stop'#4'LEFT'#3#250#0#6'HEIGHT'#2
+#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#12'cmdStopClick'#0#0#7'TBUTTO'
+'N'#7'cmdStep'#7'CAPTION'#6#4'Step'#4'LEFT'#3'6'#1#6'HEIGHT'#2#25#3'TOP'#2
+''''#5'WIDTH'#2'2'#7'OnClick'#7#12'cmdStepClick'#0#0#7'TBUTTON'#11'cmdSte'
+'pInto'#7'CAPTION'#6#9'Step into'#4'LEFT'#3'r'#1#6'HEIGHT'#2#25#3'TOP'#2
+''''#5'WIDTH'#2'2'#7'OnClick'#7#16'cmdStepIntoClick'#0#0#6'TLabel'#8'lblS'
+'tate'#4'Left'#2#8#3'Top'#2'h'#5'WIDTH'#2'2'#0#0#6'TLabel'#9'lblAdress'#4
+'Left'#2':'#3'Top'#2'h'#5'WIDTH'#2'd'#0#0#6'TLabel'#9'lblSource'#4'Left'#3
+#166#0#3'Top'#2'h'#5'WIDTH'#2'd'#0#0#6'TLabel'#7'lblLine'#4'Left'#3#18#1#3
+'Top'#2'h'#5'WIDTH'#2'd'#0#0#6'TLabel'#7'lblFunc'#4'Left'#3'~'#1#3'Top'#2
+'h'#5'WIDTH'#2'd'#0#0#5'TMemo'#6'txtLog'#4'Left'#2#8#3'Top'#3#165#0#5'Wid'
+'th'#3'X'#2#6'Height'#3#150#0#0#0#7'TButton'#10'cmdCommand'#4'Left'#3#252
+#0#3'Top'#2'G'#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#3'CMD'#7'OnClick'
+#7#15'cmdCommandClick'#0#0#7'TButton'#8'cmdCLear'#4'Left'#3'9'#1#3'Top'#2
+'G'#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#5'Clear'#7'OnClick'#7#13'cm'
+'dClearClick'#0#0#5'TEdit'#10'txtCommand'#4'Left'#2#8#3'Top'#2'H'#5'Width'
+#3#237#0#6'Height'#2#24#4'Text'#6#0#0#0#7'TButton'#11'cmdSetBreak'#4'Left'
+#3#252#0#3'Top'#3#132#0#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#5'Set B'
+#7'OnClick'#7#16'cmdSetBreakClick'#0#0#7'TButton'#13'cmdResetBreak'#4'Lef'
+'t'#3'9'#1#3'Top'#3#132#0#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#5'Del'
+' B'#7'OnClick'#7#18'cmdResetBreakClick'#0#0#9'TCheckBox'#14'chkBreakEnab'
+'le'#4'Left'#3'v'#1#3'Top'#3#132#0#5'Width'#2'd'#6'Height'#2#25#7'Caption'
+#6#12'Enable break'#7'OnClick'#7#19'chkBreakEnableClick'#0#0#5'TEdit'#12
+'txtBreakFile'#4'Left'#2#8#3'Top'#3#132#0#5'Width'#3#150#0#6'Height'#2#24
+#4'Text'#6#11'testcntr.pp'#0#0#5'TEdit'#12'txtBreakLine'#4'Left'#3#165#0#3
+'Top'#3#132#0#5'Width'#2'P'#6'Height'#2#24#4'Text'#6#1'1'#0#0#6'TLabel'#11
+'lblFileName'#4'Left'#2#8#3'Top'#2#8#5'WIDTH'#2'F'#7'Caption'#6#8'FileNam'
+'e'#0#0#5'TEdit'#11'txtFileName'#4'Left'#2'F'#3'Top'#2#8#5'Width'#3'%'#1#6
+'Height'#2#24#4'Text'#6#17'examples/testcntr'#0#0#0
);

View File

@ -0,0 +1,49 @@
LazarusResources.Add('TDebugTestForm','FORMDATA',
'TPF0'#14'TDebugTestForm'#14'DebugTestForm1'#7'CAPTION'#6#13'DebugTestForm'
+#4'LEFT'#2#25#6'HEIGHT'#3'@'#1#3'TOP'#2#25#5'WIDTH'#3'l'#2#8'OnCreate'#7
+#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#0#6'TLabel'#11'lblFileName'
+#4'Left'#2#8#3'Top'#2#8#5'WIDTH'#2'F'#7'Caption'#6#9'Filename:'#0#0#5'TEd'
+'it'#11'txtFileName'#4'Left'#2'F'#3'Top'#2#8#5'Width'#3'%'#1#6'Height'#2
+#24#4'Text'#6#17'examples/testcntr'#0#0#7'TBUTTON'#7'cmdInit'#7'CAPTION'#6
+#4'Init'#4'LEFT'#2#10#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'
+#7#12'cmdInitClick'#0#0#7'TBUTTON'#7'cmdDone'#7'CAPTION'#6#4'Done'#4'LEFT'
+#2'F'#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#12'cmdDoneCl'
+'ick'#0#0#7'TBUTTON'#6'cmdRun'#7'CAPTION'#6#3'Run'#4'LEFT'#3#130#0#6'HEIG'
+'HT'#2#25#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#11'cmdRunClick'#0#0#7'T'
+'BUTTON'#8'cmdPause'#7'CAPTION'#6#5'Pause'#4'LEFT'#3#190#0#6'HEIGHT'#2#25
+#3'TOP'#2''''#5'WIDTH'#2'2'#7'OnClick'#7#13'cmdPauseClick'#0#0#7'TBUTTON'
+#7'cmdStop'#7'CAPTION'#6#4'Stop'#4'LEFT'#3#250#0#6'HEIGHT'#2#25#3'TOP'#2
+''''#5'WIDTH'#2'2'#7'OnClick'#7#12'cmdStopClick'#0#0#7'TBUTTON'#7'cmdStep'
+#7'CAPTION'#6#4'Step'#4'LEFT'#3'6'#1#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'
+#2'2'#7'OnClick'#7#12'cmdStepClick'#0#0#7'TBUTTON'#11'cmdStepInto'#7'CAPT'
+'ION'#6#9'Step into'#4'LEFT'#3'r'#1#6'HEIGHT'#2#25#3'TOP'#2''''#5'WIDTH'#2
+'2'#7'OnClick'#7#16'cmdStepIntoClick'#0#0#6'TLabel'#8'lblState'#4'Left'#2
+#8#3'Top'#3#165#0#5'WIDTH'#2'2'#0#0#6'TLabel'#9'lblAdress'#4'Left'#2':'#3
+'Top'#3#165#0#5'WIDTH'#2'd'#0#0#6'TLabel'#9'lblSource'#4'Left'#3#166#0#3
+'Top'#3#165#0#5'WIDTH'#2'd'#0#0#6'TLabel'#7'lblLine'#4'Left'#3#18#1#3'Top'
+#3#165#0#5'WIDTH'#2'd'#0#0#6'TLabel'#7'lblFunc'#4'Left'#3'~'#1#3'Top'#3
+#165#0#5'WIDTH'#2'd'#0#0#5'TMemo'#6'txtLog'#4'Left'#2#8#3'Top'#3#190#0#5
+'Width'#3'X'#2#6'Height'#3#150#0#0#0#6'TLabel'#7'lblTest'#4'Left'#2#8#3'T'
+'op'#2'G'#5'WIDTH'#2'F'#7'Caption'#6#5'Test:'#0#0#7'TButton'#10'cmdComman'
+'d'#4'Left'#3':'#1#3'Top'#2'G'#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#3
+'CMD'#7'OnClick'#7#15'cmdCommandClick'#0#0#7'TButton'#8'cmdCLear'#4'Left'
+#3'w'#1#3'Top'#2'G'#5'Width'#2'2'#6'Height'#2#25#7'Caption'#6#5'Clear'#7
+'OnClick'#7#13'cmdClearClick'#0#0#5'TEdit'#10'txtCommand'#4'Left'#2'F'#3
+'Top'#2'G'#5'Width'#3#237#0#6'Height'#2#24#4'Text'#6#0#0#0#6'TLabel'#8'lb'
+'lBreak'#4'Left'#2#8#3'Top'#3#132#0#5'WIDTH'#2'F'#7'Caption'#6#6'Break:'#0
+#0#7'TButton'#11'cmdSetBreak'#4'Left'#3':'#1#3'Top'#3#132#0#5'Width'#2'2'
+#6'Height'#2#25#7'Caption'#6#5'Set B'#7'OnClick'#7#16'cmdSetBreakClick'#0
+#0#7'TButton'#13'cmdResetBreak'#4'Left'#3'w'#1#3'Top'#3#132#0#5'Width'#2
+'2'#6'Height'#2#25#7'Caption'#6#5'Del B'#7'OnClick'#7#18'cmdResetBreakCli'
+'ck'#0#0#9'TCheckBox'#14'chkBreakEnable'#4'Left'#3#180#1#3'Top'#3#132#0#5
+'Width'#2'd'#6'Height'#2#25#7'Caption'#6#6'Enable'#7'OnClick'#7#19'chkBre'
+'akEnableClick'#0#0#5'TEdit'#12'txtBreakFile'#4'Left'#2'F'#3'Top'#3#132#0
+#5'Width'#3#150#0#6'Height'#2#24#4'Text'#6#11'testcntr.pp'#0#0#5'TEdit'#12
+'txtBreakLine'#4'Left'#3#227#0#3'Top'#3#132#0#5'Width'#2'P'#6'Height'#2#24
+#4'Text'#6#1'1'#0#0#6'TLabel'#11'lblEvaluate'#4'Left'#2#8#3'Top'#2'h'#5'W'
+'IDTH'#2'F'#7'Caption'#6#9'Evaluate:'#0#0#5'TEdit'#11'txtEvaluate'#4'Left'
+#2'F'#3'Top'#2'h'#5'Width'#3#237#0#0#0#7'TButton'#11'cmdEvaluate'#4'Left'
+#3':'#1#3'Top'#2'h'#5'WIDTH'#2'2'#6'Height'#2#25#7'Caption'#6#4'Eval'#7'O'
+'nClick'#7#16'cmdEvaluateClick'#0#0#6'TLabel'#13'lblEvalResult'#4'Left'#3
+'w'#1#3'Top'#2'h'#5'WIDTH'#3#200#0#7'Caption'#6#3'---'#0#0#0
);

View File

@ -1,21 +1,21 @@
{ $Id$ }
{ ----------------------------------------
{ ----------------------------------------
debugtestform.pp - Debugger test app
----------------------------------------
----------------------------------------
@created(Wed Feb 25st WET 2001)
@lastmod($Date$)
@author(Marc Weustink <marc@@dommelstein.net>)
@author(Marc Weustink <marc@@dommelstein.net>)
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
unit debugtestform;
{$mode objfpc}
@ -25,7 +25,7 @@ interface
uses
Classes, Graphics, Controls, Forms, Dialogs, LResources,
Buttons, StdCtrls, Debugger, DbgOutputForm, BreakpointsDlg, LocalsDlg;
Buttons, StdCtrls, Debugger, DbgOutputForm, BreakpointsDlg, LocalsDlg, WatchesDlg;
type
@ -45,6 +45,9 @@ type
lblLine: TLabel;
lblFunc: TLabel;
lblState: TLabel;
lblBreak: TLabel;
lblEvaluate: TLabel;
lblTest: TLabel;
txtLog: TMemo;
cmdCommand: TButton;
cmdClear: TButton;
@ -53,6 +56,9 @@ type
txtBreakFile: TEdit;
txtBreakLine: TEdit;
chkBreakEnable: TCheckBox;
txtEvaluate: TEdit;
lblEvalResult: TLabel;
cmdEvaluate: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure cmdInitClick(Sender: TObject);
@ -65,13 +71,15 @@ type
procedure cmdCommandClick(Sender: TObject);
procedure cmdClearClick(Sender: TObject);
procedure cmdSetBreakClick(Sender: TObject);
procedure cmdResetBreakClick(Sender: TObject);
procedure cmdResetBreakClick(Sender: TObject);
procedure cmdEvaluateClick(Sender: TObject);
procedure chkBreakEnableClick(Sender: TObject);
private
FDebugger: TDebugger;
FOutputForm: TDBGOutputForm;
FBreakpointDlg: TBreakpointsDlg;
FLocalsDlg: TLocalsDlg;
FWatchesDlg: TWatchesDlg;
FDummy: Boolean;
procedure DBGState(Sender: TObject);
procedure DBGCurrent(Sender: TObject; const ALocation: TDBGLocationRec);
@ -81,7 +89,7 @@ type
protected
procedure Loaded; override;
public
destructor Destroy; override;
destructor Destroy; override;
published
property Dummy: Boolean read FDummy write FDummy; // insert some dummies until fpcbug #1888 is fixed
property Dummy1: Boolean read FDummy write FDummy; // insert some dummies until fpcbug #1888 is fixed
@ -101,15 +109,15 @@ uses
procedure TDebugTestForm.Loaded;
begin
inherited Loaded;
// Not yet through resources
txtLog.Scrollbars := ssBoth;
end;
destructor TDebugTestForm.Destroy;
destructor TDebugTestForm.Destroy;
begin
// This shouldn't be needed, but the OnDestroy event isn't called
inherited;
inherited;
FormDestroy(Self);
end;
@ -119,38 +127,48 @@ begin
FDebugger := nil;
FBreakpointDlg := TBreakpointsDlg.Create(Application);
FBreakpointDlg.Show;
FLocalsDlg := TLocalsDlg.Create(Application);
FLocalsDlg.Show;
FWatchesDlg := TWatchesDlg.Create(Application);
FWatchesDlg.Show;
FOutputForm := TDBGOutputForm.Create(Application);
FOutputForm.Show;
end;
procedure TDebugTestForm.FormDestroy(Sender: TObject);
begin
begin
try
FBreakpointDlg.Debugger := nil;
FLocalsDlg.Debugger := nil;
FWatchesDlg.Debugger := nil;
FOutputForm.Debugger := nil;
FWatchesDlg.Debugger := nil;
except
on Exception do;
end;
FDebugger.Free;
FDebugger := nil;
end;
procedure TDebugTestForm.cmdInitClick(Sender: TObject);
begin
if FDebugger = nil
if FDebugger = nil
then begin
FDebugger := TGDBMIDebugger.Create('/usr/bin/gdb');
FDebugger.OnDbgOutput := @DBGOutput;
FDebugger.OnOutput := @DBGTargetOutput;
FDebugger.OnCurrent := @DBGCurrent;
FDebugger.OnState := @DBGState;
FDebugger.OnState := @DBGState;
TDBGBreakPointGroup(FDebugger.BreakPointGroups.Add).Name := 'Default';
FBreakpointDlg.Debugger := FDebugger;
FLocalsDlg.Debugger := FDebugger;
// Something strange going on here,
// sometimes the form crashes during load with Application as owner
// sometimes the form crashes during load with nil as owner
// FOutputForm := TDBGOutputForm.Create(nil);
// FOutputForm.OnDestroy := @OutputFormDestroy;
// FOutputForm.Show;
FOutputForm := nil;
FWatchesDlg.Debugger := FDebugger;
FOutputForm.Debugger := FDebugger;
FWatchesDlg.Debugger := FDebugger;
end;
FDebugger.Init;
FDebugger.FileName := txtFileName.Text;
@ -158,9 +176,14 @@ end;
procedure TDebugTestForm.cmdDoneClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.Done;
FBreakpointDlg.Debugger := nil;
FLocalsDlg.Debugger := nil;
FWatchesDlg.Debugger := nil;
FOutputForm.Debugger := nil;
FWatchesDlg.Debugger := nil;
FDebugger.Free;
FDebugger := nil;
end;
@ -168,42 +191,42 @@ end;
procedure TDebugTestForm.cmdRunClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.FileName := txtFileName.Text;
FDebugger.Run;
FDebugger.Run;
end;
end;
procedure TDebugTestForm.cmdPauseClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.Pause;
FDebugger.Pause;
end;
end;
procedure TDebugTestForm.cmdStepClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.StepOver;
FDebugger.StepOver;
end;
end;
procedure TDebugTestForm.cmdStepIntoClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.StepInto;
FDebugger.StepInto;
end;
end;
procedure TDebugTestForm.cmdStopClick(Sender: TObject);
begin
if FDebugger <> nil
if FDebugger <> nil
then begin
FDebugger.Stop;
FDebugger.Stop;
end;
end;
@ -234,6 +257,14 @@ begin
then FDebugger.Breakpoints[0].Enabled := chkBreakEnable.Checked;
end;
procedure TDebugTestForm.cmdEvaluateClick(Sender: TObject);
var
S: String;
begin
FDebugger.Evaluate(txtEvaluate.Text, S);
lblEvalResult.Caption := S;
end;
procedure TDebugTestForm.OutputFormDestroy(Sender: TObject);
begin
FOutputForm := nil;
@ -253,7 +284,7 @@ end;
procedure TDebugTestForm.DBGCurrent(Sender: TObject; const ALocation: TDBGLocationRec);
begin
lblAdress.Caption := Format('$%p', [ALocation.Adress]);
lblSource.Caption := ALocation.SrcFile;
lblSource.Caption := ALocation.SrcFile;
lblLine.Caption := IntToStr(ALocation.SrcLine);
lblFunc.Caption := ALocation.FuncName;
end;
@ -267,7 +298,7 @@ begin
dsIdle :lblState.Caption := 'dsIdle ';
dsStop :lblState.Caption := 'dsStop ';
dsPause: begin
lblState.Caption := 'dsPause';
lblState.Caption := 'dsPause';
txtLog.Lines.Add('[locals]');
for n := 0 to FDebugger.Locals.Count - 1 do
begin
@ -282,11 +313,19 @@ begin
end;
initialization
{$I debugtestform.lrc}
{$I debugtestform.lrs}
end.
{ =============================================================================
$Log$
Revision 1.7 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
Revision 1.6 2002/03/23 15:54:30 lazarus
MWE:
+ Added locals dialog

View File

@ -6,6 +6,19 @@ object DebugTestForm1: TDebugTestForm
WIDTH = 620
OnCreate = FormCreate
OnDestroy = FormDestroy
object lblFileName: TLabel
Left = 8
Top = 8
WIDTH = 70
Caption = 'Filename:'
end
object txtFileName: TEdit
Left = 70
Top = 8
Width = 293
Height = 24
Text = 'examples/testcntr'
end
object cmdInit: TBUTTON
CAPTION = 'Init'
LEFT = 10
@ -64,37 +77,43 @@ object DebugTestForm1: TDebugTestForm
end
object lblState: TLabel
Left = 8
Top = 104
Top = 165
WIDTH = 50
end
object lblAdress: TLabel
Left = 58
Top = 104
Top = 165
WIDTH = 100
end
object lblSource: TLabel
Left = 166
Top = 104
Top = 165
WIDTH = 100
end
object lblLine: TLabel
Left = 274
Top = 104
Top = 165
WIDTH = 100
end
object lblFunc: TLabel
Left = 382
Top = 104
Top = 165
WIDTH = 100
end
object txtLog: TMemo
Left = 8
Top = 165
Top = 190
Width = 600
Height = 150
end
object lblTest: TLabel
Left = 8
Top = 71
WIDTH = 70
Caption = 'Test:'
end
object cmdCommand: TButton
Left = 252
Left = 314
Top = 71
Width = 50
Height = 25
@ -102,7 +121,7 @@ object DebugTestForm1: TDebugTestForm
OnClick = cmdCommandClick
end
object cmdCLear: TButton
Left = 313
Left = 375
Top = 71
Width = 50
Height = 25
@ -110,14 +129,20 @@ object DebugTestForm1: TDebugTestForm
OnClick = cmdClearClick
end
object txtCommand: TEdit
Left = 8
Top = 72
Left = 70
Top = 71
Width = 237
Height = 24
Text = ''
end
object lblBreak: TLabel
Left = 8
Top = 132
WIDTH = 70
Caption = 'Break:'
end
object cmdSetBreak: TButton
Left = 252
Left = 314
Top = 132
Width = 50
Height = 25
@ -125,7 +150,7 @@ object DebugTestForm1: TDebugTestForm
OnClick = cmdSetBreakClick
end
object cmdResetBreak: TButton
Left = 313
Left = 375
Top = 132
Width = 50
Height = 25
@ -133,38 +158,50 @@ object DebugTestForm1: TDebugTestForm
OnClick = cmdResetBreakClick
end
object chkBreakEnable: TCheckBox
Left = 374
Left = 436
Top = 132
Width = 100
Height = 25
Caption = 'Enable break'
Caption = 'Enable'
OnClick = chkBreakEnableClick
end
object txtBreakFile: TEdit
Left = 8
Left = 70
Top = 132
Width = 150
Height = 24
Text = 'testcntr.pp'
end
object txtBreakLine: TEdit
Left = 165
Left = 227
Top = 132
Width = 80
Height = 24
Text = '1'
end
object lblFileName: TLabel
object lblEvaluate: TLabel
Left = 8
Top = 8
Top = 104
WIDTH = 70
Caption = 'FileName'
Caption = 'Evaluate:'
end
object txtFileName: TEdit
object txtEvaluate: TEdit
Left = 70
Top = 8
Width = 293
Height = 24
Text = 'examples/testcntr'
Top = 104
Width = 237
end
object cmdEvaluate: TButton
Left = 314
Top = 104
WIDTH = 50
Height = 25
Caption = 'Eval'
OnClick = cmdEvaluateClick
end
object lblEvalResult: TLabel
Left = 375
Top = 104
WIDTH = 200
Caption = '---'
end
end

View File

@ -1,13 +1,13 @@
object LocalsDlg: TLocalsDlg
Left = 359
Top = 126
Width = 572
Width = 500
Height = 200
Caption = 'Locals'
object lvLocals: TListView
Left = 0
Top = 0
Width = 564
Width = 484
Height = 200
Align = alClient
Columns = <
@ -20,7 +20,6 @@ object LocalsDlg: TLocalsDlg
Width = 400
end>
MultiSelect = True
ScrollBars = sbBoth
ViewStyle = vsReport
end
end

66
debugger/twatchesdlg.lfm Normal file
View File

@ -0,0 +1,66 @@
object WatchesDlg: TWatchesDlg
Left = 359
Top = 126
Width = 500
Height = 200
Caption = 'Watch list'
object lvWatches: TListView
Left = 0
Top = 0
Width = 484
Height = 200
Align = alClient
Columns = <
item
Caption = 'Expression'
Width = 150
end
item
Caption = 'Value'
Width = 400
end>
PopupMenu = mnuPopup
MultiSelect = True
ViewStyle = vsReport
OnClick = lvWatchesClick
OnSelectItem = lvWatchesSelectItem
end
object mnuPopup: TPopupMenu
Left = 100
Top = 96
object popAdd: TMenuItem
Caption = '&Add'
OnClick = popAddClick
end
object N1: TMenuItem
Caption = '-'
end
object popProperties: TMenuItem
Caption = '&Properties'
OnClick = popPropertiesClick
end
object popEnabled: TMenuItem
Caption = '&Enabled'
OnClick = popEnabledClick
end
object popDelete: TMenuItem
Caption = '&Delete'
OnClick = popDeleteClick
end
object N2: TMenuItem
Caption = '-'
end
object popDisableAll: TMenuItem
Caption = 'D&isable All'
OnClick = popDisableAllClick
end
object popEnableAll: TMenuItem
Caption = 'E&nable All'
OnClick = popEnableAllClick
end
object popDeleteAll: TMenuItem
Caption = 'De&lete All'
OnClick = popDeleteAllClick
end
end
end

View File

@ -0,0 +1,104 @@
object TWatchPropertyDlg
CAPTION = 'Watch Properties'
POSITION = poscreencenter
HEIGHT = 200
WIDTH = 420
object lblExpression: TLABEL
CAPTION = 'Expression:'
LEFT = 15
HEIGHT = 17
TOP = 20
WIDTH = 65
end
object txtExpression: TEDIT
LEFT = 105
TOP = 17
WIDTH = 300
end
object lblRepCount: TLABEL
CAPTION = 'Repeat Count:'
LEFT = 15
HEIGHT = 17
TOP = 45
WIDTH = 80
end
object txtRepCount: TEDIT
TEXT = '0'
LEFT = 105
TOP = 42
WIDTH = 60
end
object lblDigits: TLABEL
CAPTION = 'Digits:'
LEFT = 175
HEIGHT = 17
TOP = 45
WIDTH = 40
end
object txtDigits: TEDIT
TEXT = '0'
LEFT = 225
TOP = 45
WIDTH = 180
end
object chkEnabled: TCHECKBOX
CAPTION = 'Enabled'
STATE = cbchecked
DRAGCURSOR = 0
TABORDER = 0
LEFT = 15
TOP = 65
WIDTH = 60
end
object chkAllowFunc: TCHECKBOX
CAPTION = 'Allow Function Calls'
DRAGCURSOR = 0
TABORDER = 0
LEFT = 105
TOP = 65
end
object rgStyle: TRADIOGROUP
CAPTION = 'Style'
ITEMINDEX = 7
ITEMS.Strings = (
'Character'
'String'
'Decimal'
'Hexadecimal'
'Floating Point'
'Pointer'
'Record/Structure'
'Default'
'Memory Dump'
)
COLUMNS = 3
LEFT = 15
HEIGHT = 70
TOP = 90
WIDTH = 390
end
object btnOK: TBUTTON
MODALRESULT = 1
CAPTION = 'OK'
LEFT = 170
HEIGHT = 25
TOP = 170
WIDTH = 75
OnClick = btnOKClick
end
object btnCancel: TBUTTON
MODALRESULT = 2
CAPTION = 'Cancel'
LEFT = 250
HEIGHT = 25
TOP = 170
WIDTH = 75
end
object btnHelp: TBUTTON
CAPTION = 'Help'
LEFT = 330
HEIGHT = 25
TOP = 170
WIDTH = 75
end
end

20
debugger/watchesdlg.lrs Normal file
View File

@ -0,0 +1,20 @@
LazarusResources.Add('TWatchesDlg','FORMDATA',
'TPF0'#11'TWatchesDlg'#10'WatchesDlg'#4'Left'#3'g'#1#3'Top'#2'~'#5'Width'#3
+#244#1#6'Height'#3#200#0#7'Caption'#6#10'Watch list'#0#9'TListView'#9'lvW'
+'atches'#4'Left'#2#0#3'Top'#2#0#5'Width'#3#228#1#6'Height'#3#200#0#5'Alig'
+'n'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6#10'Expression'#5'Width'#3
+#150#0#0#1#7'Caption'#6#5'Value'#5'Width'#3#144#1#0#0#9'PopupMenu'#7#8'mn'
+'uPopup'#11'MultiSelect'#9#9'ViewStyle'#7#8'vsReport'#7'OnClick'#7#14'lvW'
+'atchesClick'#12'OnSelectItem'#7#19'lvWatchesSelectItem'#0#0#10'TPopupMen'
+'u'#8'mnuPopup'#4'Left'#2'd'#3'Top'#2'`'#0#9'TMenuItem'#6'popAdd'#7'Capti'
+'on'#6#4'&Add'#7'OnClick'#7#11'popAddClick'#0#0#9'TMenuItem'#2'N1'#7'Capt'
+'ion'#6#1'-'#0#0#9'TMenuItem'#13'popProperties'#7'Caption'#6#11'&Properti'
+'es'#7'OnClick'#7#18'popPropertiesClick'#0#0#9'TMenuItem'#10'popEnabled'#7
+'Caption'#6#8'&Enabled'#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'TM'
+'enuItem'#12'popEnableAll'#7'Caption'#6#11'E&nable All'#7'OnClick'#7#17'p'
+'opEnableAllClick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'De&l'
+'ete All'#7'OnClick'#7#17'popDeleteAllClick'#0#0#0#0
);

291
debugger/watchesdlg.pp Normal file
View File

@ -0,0 +1,291 @@
{ $Id$ }
{ ----------------------------------------------
watchesdlg.pp - Overview of watches
----------------------------------------------
@created(Fri Dec 14st WET 2001)
@lastmod($Date$)
@author(Shane Miller)
@author(Marc Weustink <marc@@dommelstein.net>)
This unit contains the watches dialog.
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
unit WatchesDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,
Buttons, Extctrls, Menus, ComCtrls, Debugger, DebuggerDlg;
type
TWatchesDlg = class(TDebuggerDlg)
lvWatches: TListView;
procedure lvWatchesClick(Sender: TObject);
procedure lvWatchesSelectItem(Sender: TObject; AItem: TListItem; Selected: Boolean);
mnuPopup: TPopupMenu;
popAdd: TMenuItem;
procedure popAddClick(Sender: TObject);
N1: TMenuItem; //--------------
popProperties: TMenuItem;
procedure popPropertiesClick(Sender: TObject);
popEnabled: TMenuItem;
procedure popEnabledClick(Sender: TObject);
popDelete: TMenuItem;
procedure popDeleteClick(Sender: TObject);
N2: TMenuItem; //--------------
popDisableAll: TMenuItem;
procedure popDisableAllClick(Sender: TObject);
popEnableAll: TMenuItem;
procedure popEnableAllClick(Sender: TObject);
popDeleteAll: TMenuItem;
procedure popDeleteAllClick(Sender: TObject);
private
FWatchesNotification: TDBGWatchesNotification;
function GetSelected: TDBGWatch;
procedure WatchAdd(const ASender: TDBGWatches; const AWatch: TDBGWatch);
procedure WatchUpdate(const ASender: TDBGWatches; const AWatch: TDBGWatch);
procedure WatchRemove(const ASender: TDBGWatches; const AWatch: TDBGWatch);
procedure UpdateItem(const AItem: TListItem; const AWatch: TDBGWatch);
protected
procedure Loaded; override;
procedure SetDebugger(const ADebugger: TDebugger); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
// publish some properties until fpcbug #1888 is fixed
property Top;
property Left;
property Width;
property Height;
property Caption;
end;
implementation
uses
WatchPropertyDlg;
{ TWatchesDlg }
constructor TWatchesDlg.Create(AOwner: TComponent);
begin
inherited;
FWatchesNotification := TDBGWatchesNotification.Create;
FWatchesNotification.AddReference;
FWatchesNotification.OnAdd := @WatchAdd;
FWatchesNotification.OnUpdate := @WatchUpdate;
FWatchesNotification.OnRemove := @WatchRemove;
end;
destructor TWatchesDlg.Destroy;
begin
SetDebugger(nil);
FWatchesNotification.OnAdd := nil;
FWatchesNotification.OnUpdate := nil;
FWatchesNotification.OnRemove := nil;
FWatchesNotification.ReleaseReference;
inherited;
end;
function TWatchesDlg.GetSelected: TDBGWatch;
var
Item: TListItem;
begin
Item := lvWatches.Selected;
if Item = nil
then Result := nil
else Result := TDBGWatch(Item.Data);
end;
procedure TWatchesDlg.Loaded;
begin
inherited Loaded;
// Not yet through resources
mnuPopUp.Items.Add(popAdd);
mnuPopUp.Items.Add(N1);
mnuPopUp.Items.Add(popProperties);
mnuPopUp.Items.Add(popEnabled);
mnuPopUp.Items.Add(popDelete);
mnuPopUp.Items.Add(N2);
mnuPopUp.Items.Add(popDisableAll);
mnuPopUp.Items.Add(popEnableAll);
mnuPopUp.Items.Add(popDeleteAll);
end;
procedure TWatchesDlg.lvWatchesClick(Sender: TObject);
begin
end;
procedure TWatchesDlg.lvWatchesSelectItem(Sender: TObject; AItem: TListItem; Selected: Boolean);
var
Enable: Boolean;
Watch: TDBGWatch;
begin
Watch := GetSelected;
Enable := Watch <> nil;
popProperties.Enabled := Enable;
popEnabled.Enabled := Enable;
popDelete.Enabled := Enable;
popEnabled.Checked := Enable and Watch.Enabled;
end;
procedure TWatchesDlg.popAddClick(Sender: TObject);
begin
with TWatchPropertyDlg.Create(Self, nil, Debugger) do
begin
ShowModal;
Free;
end;
end;
procedure TWatchesDlg.popDeleteAllClick(Sender: TObject);
var
n: Integer;
begin
for n := lvWatches.Items.Count - 1 downto 0 do
TDBGWatch(lvWatches.Items[n].Data).Free;
end;
procedure TWatchesDlg.popDeleteClick(Sender: TObject);
begin
GetSelected.Free;
end;
procedure TWatchesDlg.popDisableAllClick(Sender: TObject);
var
n: Integer;
Item: TListItem;
begin
for n := 0 to lvWatches.Items.Count - 1 do
begin
Item := lvWatches.Items[n];
if Item.Data <> nil
then TDBGWatch(Item.Data).Enabled := False;
end;
end;
procedure TWatchesDlg.popEnableAllClick(Sender: TObject);
var
n: Integer;
Item: TListItem;
begin
for n := 0 to lvWatches.Items.Count - 1 do
begin
Item := lvWatches.Items[n];
if Item.Data <> nil
then TDBGWatch(Item.Data).Enabled := True;
end;
end;
procedure TWatchesDlg.popEnabledClick(Sender: TObject);
var
Watch: TDBGWatch;
begin
Watch := GetSelected;
if Watch = nil then Exit;
popEnabled.Checked := not popEnabled.Checked;
Watch.Enabled := popEnabled.Checked;
end;
procedure TWatchesDlg.popPropertiesClick(Sender: TObject);
begin
with TWatchPropertyDlg.Create(Self, GetSelected, Debugger) do
begin
ShowModal;
Free;
end;
end;
procedure TWatchesDlg.UpdateItem(const AItem: TListItem; const AWatch: TDBGWatch);
begin
// Expression
// Result
AItem.Caption := AWatch.Expression;
AItem.SubItems[0] := AWatch.Value;
end;
procedure TWatchesDlg.SetDebugger(const ADebugger: TDebugger);
begin
if ADebugger <> Debugger
then begin
if Debugger <> nil
then begin
Debugger.Watches.RemoveNotification(FWatchesNotification);
end;
inherited;
if Debugger <> nil
then begin
Debugger.Watches.AddNotification(FWatchesNotification);
end;
end
else inherited;
end;
procedure TWatchesDlg.WatchAdd(const ASender: TDBGWatches; const AWatch: TDBGWatch);
var
Item: TListItem;
begin
Item := lvWatches.Items.FindData(AWatch);
if Item = nil
then begin
Item := lvWatches.Items.Add;
Item.Data := AWatch;
Item.SubItems.Add('');
end;
UpdateItem(Item, AWatch);
end;
procedure TWatchesDlg.WatchUpdate(const ASender: TDBGWatches; const AWatch: TDBGWatch);
var
Item: TListItem;
begin
if AWatch = nil then Exit;
Item := lvWatches.Items.FindData(AWatch);
if Item = nil
then WatchAdd(ASender, AWatch)
else UpdateItem(Item, AWatch);
end;
procedure TWatchesDlg.WatchRemove(const ASender: TDBGWatches; const AWatch: TDBGWatch);
begin
lvWatches.Items.FindData(AWatch).Free;
end;
initialization
{$I watchesdlg.lrs}
end.
{ =============================================================================
$Log$
Revision 1.1 2002/04/24 20:42:29 lazarus
MWE:
+ Added watches
* Updated watches and watchproperty dialog to load as resource
= renamed debugger resource files from *.lrc to *.lrs
* Temporary fixed language problems on GDB (bug #508)
* Made Debugmanager dialog handling more generic
}

View File

@ -0,0 +1,26 @@
LazarusResources.Add('TWatchPropertyDlg','FORMDATA',
'TPF0'#17'TWatchPropertyDlg'#0#7'CAPTION'#6#16'Watch Properties'#8'POSITIO'
+'N'#7#14'poscreencenter'#6'HEIGHT'#3#200#0#5'WIDTH'#3#164#1#0#6'TLABEL'#13
+'lblExpression'#7'CAPTION'#6#11'Expression:'#4'LEFT'#2#15#6'HEIGHT'#2#17#3
+'TOP'#2#20#5'WIDTH'#2'A'#0#0#5'TEDIT'#13'txtExpression'#4'LEFT'#2'i'#3'TO'
+'P'#2#17#5'WIDTH'#3','#1#0#0#6'TLABEL'#11'lblRepCount'#7'CAPTION'#6#13'Re'
+'peat Count:'#4'LEFT'#2#15#6'HEIGHT'#2#17#3'TOP'#2'-'#5'WIDTH'#2'P'#0#0#5
+'TEDIT'#11'txtRepCount'#4'TEXT'#6#1'0'#4'LEFT'#2'i'#3'TOP'#2'*'#5'WIDTH'#2
+'<'#0#0#6'TLABEL'#9'lblDigits'#7'CAPTION'#6#7'Digits:'#4'LEFT'#3#175#0#6
+'HEIGHT'#2#17#3'TOP'#2'-'#5'WIDTH'#2'('#0#0#5'TEDIT'#9'txtDigits'#4'TEXT'
+#6#1'0'#4'LEFT'#3#225#0#3'TOP'#2'-'#5'WIDTH'#3#180#0#0#0#9'TCHECKBOX'#10
+'chkEnabled'#7'CAPTION'#6#7'Enabled'#5'STATE'#7#9'cbchecked'#10'DRAGCURSO'
+'R'#2#0#8'TABORDER'#2#0#4'LEFT'#2#15#3'TOP'#2'A'#5'WIDTH'#2'<'#0#0#9'TCHE'
+'CKBOX'#12'chkAllowFunc'#7'CAPTION'#6#20'Allow Function Calls'#10'DRAGCUR'
+'SOR'#2#0#8'TABORDER'#2#0#4'LEFT'#2'i'#3'TOP'#2'A'#0#0#11'TRADIOGROUP'#7
+'rgStyle'#7'CAPTION'#6#5'Style'#9'ITEMINDEX'#2#7#13'ITEMS.Strings'#1#6#9
+'Character'#6#6'String'#6#7'Decimal'#6#11'Hexadecimal'#6#14'Floating Poin'
+'t'#6#7'Pointer'#6#16'Record/Structure'#6#7'Default'#6#11'Memory Dump'#0#7
+'COLUMNS'#2#3#4'LEFT'#2#15#6'HEIGHT'#2'F'#3'TOP'#2'Z'#5'WIDTH'#3#134#1#0#0
+#7'TBUTTON'#5'btnOK'#11'MODALRESULT'#2#1#7'CAPTION'#6#2'OK'#4'LEFT'#3#170
+#0#6'HEIGHT'#2#25#3'TOP'#3#170#0#5'WIDTH'#2'K'#7'OnClick'#7#10'btnOKClick'
+#0#0#7'TBUTTON'#9'btnCancel'#11'MODALRESULT'#2#2#7'CAPTION'#6#6'Cancel'#4
+'LEFT'#3#250#0#6'HEIGHT'#2#25#3'TOP'#3#170#0#5'WIDTH'#2'K'#0#0#7'TBUTTON'
+#7'btnHelp'#7'CAPTION'#6#4'Help'#4'LEFT'#3'J'#1#6'HEIGHT'#2#25#3'TOP'#3
+#170#0#5'WIDTH'#2'K'#0#0#0
);

View File

@ -0,0 +1,112 @@
{ $Id$ }
{ ----------------------------------------------
watchproperydlg.pp - property editor for
watches
----------------------------------------------
@created(Fri Dec 14st WET 2001)
@lastmod($Date$)
@author(Shane Miller)
@author(Marc Weustink <marc@@dommelstein.net>)
This unit contains the watch property dialog.
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
unit WatchPropertyDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,
Buttons, Extctrls, Debugger;
type
TWatchPropertyDlg = class(TForm)
lblExpression: TLabel;
lblRepCount: TLabel;
lblDigits: TLabel;
chkEnabled: TCHeckbox;
chkAllowFunc: TCheckbox;
rgStyle: TRadioGroup;
btnOK: TButton;
btnCancel: TButton;
btnHelp: TButton;
txtExpression: TEdit;
txtRepCount: TEdit;
txtDigits: TEdit;
procedure btnOKClick(Sender: TObject);
private
FWatch: TDBGWatch;
FDebugger: TDebugger;
public
constructor Create(AOWner: TCOmponent; const AWatch: TDBGWatch; const ADebugger: TDebugger); //reintroduce;
destructor Destroy; override;
published
// publish some properties until fpcbug #1888 is fixed
property Top;
property Left;
property Width;
property Height;
property Caption;
end;
implementation
{ TWatchPropertyDlg }
procedure TWatchPropertyDlg.btnOKClick(Sender: TObject);
begin
if FWatch = nil
then begin
if FDebugger = nil then Exit;
FWatch := FDebugger.Watches.Add(txtExpression.Text);
end;
FWatch.Expression := txtExpression.Text;
FWatch.Enabled := chkEnabled.Checked;
end;
constructor TWatchPropertyDlg.Create(AOwner: TComponent; const AWatch: TDBGWatch; const ADebugger: TDebugger);
begin
FWatch := AWatch;
FDebugger := ADebugger;
inherited Create(AOwner);
if FWatch <> nil
then begin
txtExpression.Text := FWatch.Expression;
chkEnabled.Checked := FWatch.Enabled;
end;
lblRepCount.Enabled := False;
txtRepCount.Enabled := False;
lblDigits.Enabled := False;
txtDigits.Enabled := False;
chkAllowFunc.Enabled := False;
rgStyle.Enabled := False;
end;
destructor TWatchPropertyDlg.destroy;
begin
inherited;
end;
initialization
{$I watchpropertydlg.lrs}
end.

View File

@ -31,17 +31,15 @@ uses
{$ENDIF}
Classes, SysUtils, Forms, Controls, Dialogs, CompilerOptions, EditorOptions,
EnvironmentOpts, KeyMapping, UnitEditor, Project, IDEProcs,
Debugger, DBGOutputForm, GDBMIDebugger, RunParamsOpts, ExtToolDialog,
ProjectDefs, Watchesdlg, BreakPointsdlg, LocalsDlg, DebuggerDlg,
BaseDebugManager, MainBar;
Debugger, RunParamsOpts, ExtToolDialog,
ProjectDefs, BaseDebugManager, MainBar, DebuggerDlg;
type
TDebugDialogType = (ddtOutput, ddtBreakpoints, ddtWatches, ddtLocals);
TDebugManager = class(TBaseDebugManager)
// Menu events
procedure mnuViewWatchesClick(Sender: TObject);
procedure mnuViewBreakPointsClick(Sender: TObject);
procedure mnuViewDebugOutputClick(Sender: TObject);
procedure mnuViewLocalsClick(Sender: TObject);
procedure mnuViewDebugDialogClick(Sender: TObject);
// SrcNotebook events
procedure OnSrcNotebookAddWatchesAtCursor(Sender: TObject);
@ -56,16 +54,15 @@ type
private
FBreakPoints: TDBGBreakPoints; // Points to debugger breakpoints if available
// Else to own objet
FDebugOutputDlg: TDBGOutputForm;
FBreakPointsDlg: TBreakPointsDlg;
FLocalsDlg: TLocalsDlg;
FWatches: TDBGWatches; // Points to debugger watchess if available
// Else to own objet
FDialogs: array[TDebugDialogType] of TDebuggerDlg;
FDebugger: TDebugger;
procedure DebugConstructor;
procedure DebugDialogDestroy(Sender: TObject);
procedure ViewDebugDialog(const ADialogClass: TDebuggerDlgClass; var ADialog: TDebuggerDlg);
procedure ViewDebugDialog(const ADialogType: TDebugDialogType);
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -88,39 +85,18 @@ type
implementation
procedure TDebugManager.DebugConstructor;
begin
// TWatchesDlg
Watches_Dlg := TWatchesDlg.Create(Self);
FBreakPointsDlg := nil;
FLocalsDlg := nil;
FDebugger := nil;
FBreakPoints := TDBGBreakPoints.Create(nil, TDBGBreakPoint);
end;
uses
Menus,
Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm, GDBMIDebugger;
//-----------------------------------------------------------------------------
// Menu events
//-----------------------------------------------------------------------------
procedure TDebugManager.mnuViewWatchesClick(Sender : TObject);
begin
Watches_dlg.Show;
end;
procedure TDebugManager.mnuViewBreakPointsClick(Sender : TObject);
begin
ViewDebugDialog(TBreakPointsDlg, FBreakPointsDlg);
end;
procedure TDebugManager.mnuViewDebugOutputClick(Sender : TObject);
begin
ViewDebugDialog(TDBGOutputForm, FDebugOutputDlg);
end;
procedure TDebugManager.mnuViewLocalsClick(Sender : TObject);
begin
ViewDebugDialog(TLocalsDlg, FLocalsDlg);
procedure TDebugManager.mnuViewDebugDialogClick(Sender: TObject);
begin
ViewDebugDialog(TDebugDialogType(TMenuItem(Sender).Tag));
end;
//-----------------------------------------------------------------------------
@ -141,8 +117,7 @@ begin
WatchVar := SE.GetWordAtCurrentCaret;
if WatchVar = '' then Exit;
NewWatch := TdbgWatch(FDebugger.Watches.Add);
NewWatch.Expression := WatchVar;
NewWatch := FWatches.Add(WatchVar);
NewWatch.Enabled := True;
end;
@ -176,8 +151,8 @@ end;
procedure TDebugManager.OnDebuggerOutput(Sender: TObject; const AText: String);
begin
if FDebugOutputDlg <> nil
then FDebugOutputDlg.AddText(AText);
if FDialogs[ddtOutput] <> nil
then TDbgOutputForm(FDialogs[ddtOutput]).AddText(AText);
end;
procedure TDebugManager.OnDebuggerChangeState(Sender: TObject);
@ -267,53 +242,94 @@ end;
// The tag of the destroyed form contains the form variable pointing to it
procedure TDebugManager.DebugDialogDestroy(Sender: TObject);
begin
if TForm(Sender).Tag <> 0
then PPointer(TForm(Sender).Tag)^ := nil;
if (TForm(Sender).Tag >= Ord(Low(TDebugDialogType)))
and (TForm(Sender).Tag <= Ord(High(TDebugDialogType)))
then FDialogs[TDebugDialogType(TForm(Sender).Tag)] := nil;
end;
procedure TDebugManager.ViewDebugDialog(const ADialogClass: TDebuggerDlgClass; var ADialog: TDebuggerDlg);
procedure TDebugManager.ViewDebugDialog(const ADialogType: TDebugDialogType);
const
DEBUGDIALOGCLASS: array[TDebugDialogType] of TDebuggerDlgClass = (
TDbgOutputForm, TBreakPointsDlg, TWatchesDlg, TLocalsDlg
);
begin
if ADialog = nil
if FDialogs[ADialogType] = nil
then begin
try
ADialog := ADialogClass.Create(Self);
FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self);
except
on E: Exception do begin
WriteLN('[ERROR] IDE: Probably FPC bug #1888 caused an exception while creating class ''', ADialogClass.ClassName, '''');
WriteLN('[ERROR] IDE: Probably FPC bug #1888 caused an exception while creating class ''', DEBUGDIALOGCLASS[ADialogType].ClassName, '''');
WriteLN('[ERROR] IDE: Exception message: ', E.Message);
Exit;
end;
end;
ADialog.Tag := Integer(@ADialog);
ADialog.OnDestroy := @DebugDialogDestroy;
FDialogs[ADialogType].Tag := Integer(ADialogType);
FDialogs[ADialogType].OnDestroy := @DebugDialogDestroy;
DoInitDebugger;
ADialog.Debugger := FDebugger;
FDialogs[ADialogType].Debugger := FDebugger;
end;
ADialog.Show;
ADialog.BringToFront;
FDialogs[ADialogType].Show;
FDialogs[ADialogType].BringToFront;
end;
procedure TDebugManager.DestroyDebugDialog(const ADialogType: TDebugDialogType);
begin
if FDialogs[ADialogType] = nil then Exit;
FDialogs[ADialogType].OnDestroy := nil;
FDialogs[ADialogType].Debugger := nil;
FDialogs[ADialogType].Free;
FDialogs[ADialogType] := nil;
end;
constructor TDebugManager.Create(TheOwner: TComponent);
begin
var
DialogType: TDebugDialogType;
begin
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
FDialogs[DialogType] := nil;
FDebugger := nil;
FBreakPoints := TDBGBreakPoints.Create(nil, TDBGBreakPoint);
FWatches := TDBGWatches.Create(nil, TDBGWatch);
inherited Create(TheOwner);
DebugConstructor;
end;
destructor TDebugManager.Destroy;
begin
FreeThenNil(FDebugger);
FreeThenNil(FBreakPoints);
FreeThenNil(Watches_Dlg);
var
DialogType: TDebugDialogType;
begin
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
DestroyDebugDialog(DialogType);
if FDebugger <> nil
then begin
if FDebugger.BreakPoints = FBreakPoints
then FBreakPoints := nil;
if FDebugger.Watches = FWatches
then FWatches := nil;
FreeThenNil(FDebugger);
end
else begin
FreeThenNil(FBreakPoints);
FreeThenNil(FWatches);
end;
inherited Destroy;
end;
procedure TDebugManager.ConnectMainBarEvents;
begin
with MainIDE do begin
itmViewWatches.OnClick := @mnuViewWatchesClick;
itmViewBreakPoints.OnClick := @mnuViewBreakPointsClick;
itmViewLocals.OnClick := @mnuViewLocalsClick;
itmViewDebugOutput.OnClick := @mnuViewDebugOutputClick;
itmViewWatches.OnClick := @mnuViewDebugDialogClick;
itmViewWatches.Tag := Ord(ddtWatches);
itmViewBreakPoints.OnClick := @mnuViewDebugDialogClick;
itmViewBreakPoints.Tag := Ord(ddtBreakPoints);
itmViewLocals.OnClick := @mnuViewDebugDialogClick;
itmViewLocals.Tag := Ord(ddtLocals);
itmViewDebugOutput.OnClick := @mnuViewDebugDialogClick;
itmViewDebugOutput.Tag := Ord(ddtOutput);
end;
end;
@ -341,16 +357,18 @@ end;
function TDebugManager.DoInitDebugger: TModalResult;
procedure ResetDialogs;
begin
if FDebugOutputDlg <> nil
then FDebugOutputDlg.Debugger := FDebugger;
if FBreakPointsDlg <> nil
then FBreakPointsDlg.Debugger := FDebugger;
if FLocalsDlg <> nil
then FLocalsDlg.Debugger := FDebugger;
var
DialogType: TDebugDialogType;
begin
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
begin
if FDialogs[DialogType] <> nil
then FDialogs[DialogType].Debugger := FDebugger;
end;
end;
var
OldBreakpoints: TDBGBreakpoints;
OldWatches: TDBGWatches;
LaunchingCmdLine, LaunchingApplication, LaunchingParams: String;
begin
WriteLN('[TDebugManager.DoInitDebugger] A');
@ -362,6 +380,7 @@ begin
SplitCmdLine(LaunchingCmdLine,LaunchingApplication,LaunchingParams);
OldBreakpoints := nil;
OldWatches := nil;
case EnvironmentOptions.DebuggerType of
dtGnuDebugger: begin
@ -374,6 +393,10 @@ begin
OldBreakpoints.Assign(FBreakPoints);
FBreakPoints := nil;
OldWatches := TDBGWatches.Create(nil, TDBGWatch);
OldWatches.Assign(FWatches);
FWatches := nil;
FDebugger.Free;
FDebugger := nil;
ResetDialogs;
@ -385,25 +408,37 @@ begin
OldBreakpoints := TDBGBreakpoints.Create(nil, TDBGBreakpoint);
OldBreakpoints.Assign(FBreakPoints);
end;
if FWatches <> nil
then begin
OldWatches := TDBGWatches.Create(nil, TDBGWatch);
OldWatches.Assign(FWatches);
end;
FDebugger := TGDBMIDebugger.Create(EnvironmentOptions.DebuggerFilename);
FBreakPoints := FDebugger.BreakPoints;
FWatches := FDebugger.Watches;
ResetDialogs;
end;
if OldBreakpoints <> nil
then FBreakPoints.Assign(OldBreakpoints);
if OldWatches <> nil
then FWatches.Assign(OldWatches);
end;
else
OldBreakpoints := FBreakPoints;
FBreakPoints := TDBGBreakpoints.Create(nil, TDBGBreakpoint);
FBreakPoints.Assign(OldBreakpoints);
OldWatches := FWatches;
FWatches := TDBGWatches.Create(nil, TDBGWatch);
FWatches.Assign(OldWatches);
FDebugger.Free;
FDebugger := nil;
ResetDialogs;
Exit;
end;
FDebugger.OnState:=@OnDebuggerChangeState;
FDebugger.OnCurrent:=@OnDebuggerCurrentLine;
FDebugger.OnState := @OnDebuggerChangeState;
FDebugger.OnCurrent := @OnDebuggerCurrentLine;
FDebugger.OnDbgOutput := @OnDebuggerOutput;
FDebugger.OnException := @OnDebuggerException;
if FDebugger.State = dsNone
@ -412,8 +447,8 @@ begin
FDebugger.FileName := LaunchingApplication;
FDebugger.Arguments := LaunchingParams;
if FDebugOutputDlg <> nil
then FDebugOutputDlg.Clear;
if FDialogs[ddtOutput] <> nil
then TDbgOutputForm(FDialogs[ddtOutput]).Clear;
//TODO: Show/hide debug menuitems based on FDebugger.SupportedCommands

View File

@ -1,28 +0,0 @@
LazarusResources.Add('TINSERTWATCH','FORMDATA',
'TPF0'#12'TINSERTWATCH'#0#7'CAPTION'#6#16'Watch Properties'#5'COLOR'#4#15#0
+#0#128#12'CLIENTHEIGHT'#3#200#0#11'CLIENTWIDTH'#3#164#1#8'POSITION'#7#14
+'poscreencenter'#6'HEIGHT'#3#200#0#5'WIDTH'#3#164#1#0#6'TLABEL'#13'lblExp'
+'ression'#7'CAPTION'#6#11'Expression:'#10'FONT.COLOR'#4#8#0#0#128#4'LEFT'
+#2#15#6'HEIGHT'#2#17#3'TOP'#2#20#5'WIDTH'#2'A'#0#0#5'TEDIT'#13'edtExpress'
+'ion'#4'LEFT'#2'i'#3'TOP'#2#17#5'WIDTH'#3','#1#0#0#6'TLABEL'#11'lblRepCou'
+'nt'#7'CAPTION'#6#13'Repeat Count:'#10'FONT.COLOR'#4#8#0#0#128#4'LEFT'#2
+#15#6'HEIGHT'#2#17#3'TOP'#2'-'#5'WIDTH'#2'P'#0#0#5'TEDIT'#11'edtRepCount'
+#4'TEXT'#6#1'0'#4'LEFT'#2'i'#3'TOP'#2'*'#5'WIDTH'#2'<'#0#0#6'TLABEL'#9'lb'
+'lDigits'#7'CAPTION'#6#7'Digits:'#10'FONT.COLOR'#4#8#0#0#128#4'LEFT'#3#175
+#0#6'HEIGHT'#2#17#3'TOP'#2'-'#5'WIDTH'#2'('#0#0#5'TEDIT'#9'edtDigits'#4'T'
+'EXT'#6#1'0'#4'LEFT'#3#225#0#3'TOP'#2'-'#5'WIDTH'#3#180#0#0#0#9'TCHECKBOX'
+#9'cbEnabled'#7'CAPTION'#6#7'Enabled'#5'STATE'#7#9'cbchecked'#10'DRAGCURS'
+'OR'#2#0#8'TABORDER'#2#0#4'LEFT'#2#15#3'TOP'#2'A'#5'WIDTH'#2'<'#0#0#9'TCH'
+'ECKBOX'#11'cbAllowFunc'#7'CAPTION'#6#20'Allow Function Calls'#10'DRAGCUR'
+'SOR'#2#0#8'TABORDER'#2#0#4'LEFT'#2'i'#3'TOP'#2'A'#0#0#11'TRADIOGROUP'#5
+'Style'#7'CAPTION'#6#5'Style'#9'ITEMINDEX'#2#7#13'ITEMS.Strings'#1#6#9'Ch'
+'aracter'#6#6'String'#6#7'Decimal'#6#11'Hexadecimal'#6#14'Floating Point'
+#6#7'Pointer'#6#16'Record/Structure'#6#7'Default'#6#11'Memory Dump'#0#7'C'
+'OLUMNS'#2#3#4'LEFT'#2#15#6'HEIGHT'#2'F'#3'TOP'#2'Z'#5'WIDTH'#3#134#1#0#0
+#7'TBUTTON'#0#11'MODALRESULT'#2#1#7'CAPTION'#6#2'OK'#10'FONT.COLOR'#4#8#0
+#0#128#4'LEFT'#3#170#0#6'HEIGHT'#2#25#3'TOP'#3#170#0#5'WIDTH'#2'K'#0#0#7
+'TBUTTON'#0#11'MODALRESULT'#2#2#7'CAPTION'#6#6'Cancel'#10'FONT.COLOR'#4#8
+#0#0#128#4'LEFT'#3#250#0#6'HEIGHT'#2#25#3'TOP'#3#170#0#5'WIDTH'#2'K'#0#0#7
+'TBUTTON'#0#7'CAPTION'#6#4'Help'#10'FONT.COLOR'#4#8#0#0#128#4'LEFT'#3'J'#1
+#6'HEIGHT'#2#25#3'TOP'#3#170#0#5'WIDTH'#2'K'#0#0#0
);

View File

@ -1,8 +0,0 @@
LazarusResources.Add('TWATCHESDLG','FORMDATA',
'TPF0'#11'TWATCHESDLG'#10'WatchesDlg'#7'CAPTION'#6#7'Watches'#5'COLOR'#4#15
+#0#0#128#12'CLIENTHEIGHT'#2'd'#11'CLIENTWIDTH'#3#250#0#8'POSITION'#7#14'p'
+'oscreencenter'#4'LEFT'#3#3#2#6'HEIGHT'#2'd'#3'TOP'#3#206#1#5'WIDTH'#3#250
+#0#0#8'TLISTBOX'#8'ListBox1'#5'ALIGN'#7#8'alclient'#11'BORDERSTYLE'#7#8'b'
+'ssingle'#10'ONKEYPRESS'#13#9'ONKEYDOWN'#13#4'LEFT'#2#1#6'HEIGHT'#2#25#3
+'TOP'#2#1#5'WIDTH'#2'd'#0#0#0
);

View File

@ -1,349 +0,0 @@
unit watchesdlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls;
type
TWatchAddedEvent = procedure (sender : TObject; Expression : String) of Object;
TWatchesdlg = class(TForm)
Listbox1: TLISTBOX;
procedure WatchesdlgResize(Sender: TObject);
private
{ private declarations }
FOnWatchAddedEvent : TWatchAddedEvent;
protected
Procedure Listbox1KeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
public
{ public declarations }
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
Procedure AddWatch(WatchVar : String);
Procedure UpdateWatch(WatchVar, NewDisplay : String);
property OnWatchAddedEvent : TWatchAddedEvent read FOnWatchAddedEvent write FOnWatchAddedEvent;
end;
TInsertWatch = class(TForm)
lblExpression : TLabel;
lblRepCount : TLabel;
lblDigits : TLabel;
cbEnabled : TCHeckbox;
cbAllowFunc : TCheckbox;
Style : TRadioGroup;
btnOK : TButton;
btnCancel : TButton;
btnHelp : TButton;
edtExpression: TEdit;
edtRepCount : TEdit;
edtDigits : TEdit;
private
public
constructor Create(AOWner : TCOmponent); override;
destructor Destroy; override;
end;
var
Watches_Dlg : TWatchesDlg;
InsertWatch : TInsertWatch;
implementation
constructor TWatchesdlg.Create(AOwner : TComponent);
Begin
inherited;
if LazarusResources.Find(Classname)=nil then begin
Caption := 'Watches';
Name := 'WatchesDlg';
Width := 250;
Height := 100;
//TListBox currently does NOT fire keypress, keyDown, KeyUp events. This is a fix for now.
OnKeyDown := @ListBox1KeyDown;
Position := poScreenCenter;
OnResize:=@WatchesdlgResize;
Listbox1 := TListbox.Create(self);
with Listbox1 do
Begin
Parent := self;
Align := alClient;
Visible := True;
Name := 'ListBox1';
OnKeyDown := @Listbox1KeyDown;
end;
end;
//unitl events are saved in the lfm
Listbox1.OnKeyDown := @Listbox1KeyDown;
//until the listbox events actually fire...
OnKeyDown := @ListBox1KeyDown;
WatchesdlgResize(nil);
InsertWatch := TInsertWatch.Create(nil);
End;
destructor TWatchesDlg.Destroy;
Begin
InsertWatch.Free;
inherited;
end;
procedure TWatchesdlg.WatchesdlgResize(Sender: TObject);
begin
end;
Procedure TWatchesDlg.Listbox1KeyDown(Sender : TObject; var Key : Word; Shift : TShiftState);
var
Count : Integer;
Begin
Writeln('Key is ',Key);
case Key of
45 : begin //insert
if InsertWatch.ShowMOdal = mrOK then
Begin
//just for now...
if InsertWatch.edtExpression.Text <> '' then
AddWatch(InsertWatch.edtExpression.Text);
end;
end;
46 : begin //delete
if Listbox1.SelCount > 0 then
Begin
Count := 0;
while Count <= Listbox1.Items.Count-1 do
if Listbox1.Selected[Count] then
Listbox1.Items.Delete(Count)
else
Inc(Count);
end;
end;
end; //case
end;
//This is used by MAIN to add a watch to the list. It should have already been added to TDebugger.
//In the future, maybe pass in a TWatch or something similiar
Procedure TWatchesDlg.AddWatch(WatchVar : String);
Begin
if pos(':',WatchVar) = 0 then
ListBox1.Items.Add(WatchVar+':')
else
ListBox1.Items.Add(WatchVar);
if Assigned(OnWatchAddedEvent) then
OnWatchAddedEvent(self,watchVar);
end;
{This is used by MAin.pp. It passed the Watchvar, we look for it in our list and then set that line to display NewDisplay.
New display is added to WatchVar so we end up with WatchVar ':'+ NewDisplay.
Watchvar is usually sometyhnig like
I
or
Texts
a Colon is added, then we search. When found we add Watchvar + ':' + Newdisplay
}
Procedure TWatchesDlg.UpdateWatch(WatchVar, NewDisplay : String);
Var
I : Integer;
Begin
//search for watchvar
for I := 0 to ListBox1.Items.count-1 do
if pos(WatchVar+':',Listbox1.Items[i]) = 1 then
Listbox1.Items[i] := WatchVar+':'+NewDisplay;
end;
{ TInsertWatch }
constructor TInsertWatch.Create(AOwner : TComponent);
Begin
inherited;
if LazarusResources.Find(Classname)=nil then
begin
Width := 420;
Height := 200;
Position := poScreenCenter;
Caption := 'Watch Properties';
lblExpression := TLabel.Create(self);
with lblExpression do
Begin
Parent := self;
Caption := 'Expression:';
Name := 'lblExpression';
Left := 15;
Top := 20;
Visible := TRue;
end;
edtExpression := TEdit.Create(self);
with edtExpression do
Begin
Parent := Self;
Name := 'edtExpression';
Left := lblExpression.Left+lblExpression.Width+25;
top := lblExpression.top-3;
Width := self.width-left-15;
Visible := TRue;
Text := '';
end;
lblRepCount := TLabel.Create(self);
with lblRepCount do
Begin
Parent := self;
Caption := 'Repeat Count:';
Name := 'lblRepCount';
Left := 15;
Top := 45;
Width := 80;
Visible := TRue;
end;
edtRepCount := TEdit.Create(self);
with edtRepCount do
Begin
Parent := Self;
Text := '0';
NAme := 'edtRepCount';
Left := lblExpression.Left+lblExpression.Width+25;
Top := lblRepCount.Top -3;
Width := 60;
Visible := TRue;
end;
lblDigits := TLAbel.Create(self);
with lblDigits do
Begin
Parent := self;
Caption := 'Digits:';
Name := 'lblDigits';
Left := edtRepCount.left+edtRepCount.Width+10;
Width := 40;
Top := lblRepCount.Top;
Visible := TRue;
end;
edtDigits := TEdit.Create(self);
with edtDigits do
Begin
Parent := self;
Text := '0';
Name := 'edtDigits';
Left := lblDigits.Left+lblDigits.Width+10;
Top := lblRepCount.Top;
Width := self.width-left-15;
Visible := TRue;
end;
cbEnabled := TCheckbox.Create(self);
with cbEnabled do
Begin
Parent := self;
Left := 15;
Top := lblDigits.Top+20;
Name := 'cbEnabled';
Text := 'Enabled';
Width := 60;
Checked := True;
Visible := TRue;
end;
cbAllowFunc := TCheckBox.Create(self);
with cbAllowFunc do
Begin
Parent := self;
Left := edtRepCount.Left;
Text := 'Allow Function Calls';
Name := 'cbAllowFunc';
Checked := False;
Top := cbEnabled.Top;
Visible := TRue;
end;
Style := TRadioGroup.Create(self);
with Style do
Begin
Parent := self;
Name := 'Style';
Left := 15;
Top := cbEnabled.Top + 25;
Width := self.width-left-15;
Columns := 3;
Items.Add('Character');
Items.Add('String');
Items.Add('Decimal');
Items.Add('Hexadecimal');
Items.Add('Floating Point');
Items.Add('Pointer');
Items.Add('Record/Structure');
Items.Add('Default');
Items.Add('Memory Dump');
ItemIndex := 7; //default
Height := self.height-top-40;
Visible := True;
end;
btnOK := TButton.Create(self);
with btnOK do
Begin
Parent := self;
caption := 'OK';
Left := (self.width div 2) -25 -15;
Top := Self.Height-30;
ModalResult := mrOK;
Visible := TRue;
end;
btnCancel := TButton.Create(self);
with btncancel do
Begin
Parent := self;
caption := 'Cancel';
Left := (self.width div 2) -25+Width+5 -15;
Top := Self.Height-30;
ModalResult := mrCancel;
Visible := TRue;
end;
btnHelp := TButton.Create(self);
with btnHelp do
Begin
Parent := self;
caption := 'Help';
Left := (self.width div 2) -25+(2*width)+10 -15;
Top := Self.Height-30;
// ModalResult := mrHelp;
Enabled := FAlse;
Visible := TRue;
end;
end;
end;
destructor TInsertWatch.destroy;
begin
inherited;
end;
initialization
{$I watches_dlg.lrs}
{$I insertwatch.lrs}
end.