diff --git a/.gitattributes b/.gitattributes index e252725175..ce7eea9263 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,8 +14,10 @@ components/synedit/synedittextbuffer.pp svneol=native#text/pascal components/synedit/synedittypes.pp svneol=native#text/pascal components/synedit/synhighlighterpas.pp svneol=native#text/pascal components/synedit/syntextdrawer.pp svneol=native#text/pascal +debugger/dbgbreakpoint.pp svneol=native#text/pascal +debugger/dbgdebugger.pp svneol=native#text/pascal +debugger/dbgwatch.pp svneol=native#text/pascal designer/abstractcompiler.pp svneol=native#text/pascal -designer/abstractdebugger.pp svneol=native#text/pascal designer/abstracteditor.pp svneol=native#text/pascal designer/abstractfilesystem.pp svneol=native#text/pascal designer/abstractformeditor.pp svneol=native#text/pascal diff --git a/Makefile b/Makefile index e949de661e..439e45f70c 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ override EXAMPLEDIROBJECTS+=examples # Clean -override EXTRACLEANUNITS+=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) +override EXTRACLEANUNITS+=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) $(basename $(wildcard ./debugger/*$(PPUEXT))) override EXTRACLEANFILES+=$(wildcard ./designer/*$(OEXT)) # Install @@ -206,7 +206,7 @@ ZIPTARGET=install # Directories -override NEEDUNITDIR=. ./lcl/units ./components/units ./designer +override NEEDUNITDIR=. ./lcl/units ./components/units ./designer ./debugger override NEEDINCDIR=. ./include ./include/$(OS_TARGET) # Packages diff --git a/Makefile.fpc b/Makefile.fpc index d1a373ff8d..4a2f71fccd 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -8,7 +8,7 @@ dirs=lcl components exampledirs=examples [clean] -units=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) +units=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) $(basename $(wildcard ./debugger/*$(PPUEXT))) files=$(wildcard ./designer/*$(OEXT)) [require] @@ -18,7 +18,7 @@ packages=fcl gtk [dirs] # not with the lazarusmake.ini # targetdir=. -unitdir=. ./lcl/units ./components/units ./designer +unitdir=. ./lcl/units ./components/units ./designer ./debugger incdir=. ./include ./include/$(OS_TARGET) [install] diff --git a/debugger/dbgbreakpoint.pp b/debugger/dbgbreakpoint.pp new file mode 100644 index 0000000000..603b39dbeb --- /dev/null +++ b/debugger/dbgbreakpoint.pp @@ -0,0 +1,140 @@ +unit DBGBreakpoint; + +{$mode objfpc} + +interface + +uses + Classes; + +type + TDBGBreakPointActions = (bpaStop, bpaEnableGroup, bpaDisableGroup); + + TDBGBreakPointGroup = class; + + TDBGBreakPoint = class(TCollectionItem) + private + FValid: Boolean; + FEnabled: Boolean; + FHitCount: Integer; + FExpression: String; + FActions: TDBGBreakPointActions; + procedure SetActions(const AValue: TDBGBreakPointActions); + procedure SetEnabled(const AValue: Boolean); + procedure SetExpression(const AValue: String); + procedure SetHitCount(const AValue: Integer); + procedure SetValid(const AValue: Boolean); + protected + public + procedure AddDisableGroup(const AGroup: TDBGBreakPointGroup); + procedure AddEnableGroup(const AGroup: TDBGBreakPointGroup); + procedure RemoveDisableGroup(const AGroup: TDBGBreakPointGroup); + procedure RemoveEnableGroup(const AGroup: TDBGBreakPointGroup); + property Actions: TDBGBreakPointActions read FActions write SetActions; + property Enabled: Boolean read FEnabled write SetEnabled; + property HitCount: Integer read FHitCount write SetHitCount; + property Expression: String read FExpression write SetExpression; + property Valid: Boolean read FValid write SetValid; + end; + + TDBGBreakPointGroup = class(TCollection) + private + FEnabled: Boolean; + FName: String; + function GetItem(const AnIndex: Integer): TDBGBreakPoint; + procedure SetEnabled(const AValue: Boolean); + procedure SetItem(const AnIndex: Integer; const AValue: TDBGBreakPoint); + procedure SetName(const AValue: String); + protected + public + property Enabled: Boolean read FEnabled write SetEnabled; + property Items[const AnIndex: Integer]: TDBGBreakPoint read GetItem write SetItem; default; + property Name: String read FName write SetName; + end; + + TDBGBreakPointGroups = class(TCollection) + private + function GetItem(const AnIndex: Integer): TDBGBreakPointGroup; + procedure SetItem(const AnIndex: Integer; const Value: TDBGBreakPointGroup); + protected + public + property Items[const AnIndex: Integer]: TDBGBreakPointGroup read GetItem write SetItem; default; + end; + + +implementation + +{ TDBGBreakPoint } + +procedure TDBGBreakPoint.AddDisableGroup(const AGroup: TDBGBreakPointGroup); +begin +end; + +procedure TDBGBreakPoint.AddEnableGroup(const AGroup: TDBGBreakPointGroup); +begin +end; + +procedure TDBGBreakPoint.RemoveDisableGroup(const AGroup: TDBGBreakPointGroup); +begin +end; + +procedure TDBGBreakPoint.RemoveEnableGroup(const AGroup: TDBGBreakPointGroup); +begin +end; + +procedure TDBGBreakPoint.SetActions(const AValue: TDBGBreakPointActions); +begin + FActions := AValue; +end; + +procedure TDBGBreakPoint.SetEnabled(const AValue: Boolean); +begin + FEnabled := AValue; +end; + +procedure TDBGBreakPoint.SetExpression(const AValue: String); +begin + FExpression := AValue; +end; + +procedure TDBGBreakPoint.SetHitCount(const AValue: Integer); +begin + FHitCount := AValue; +end; + +procedure TDBGBreakPoint.SetValid(const AValue: Boolean); +begin + FValid := AValue; +end; + +{ TDBGBreakPointGroup } + +function TDBGBreakPointGroup.GetItem(const AnIndex: Integer): TDBGBreakPoint; +begin +end; + +procedure TDBGBreakPointGroup.SetEnabled(const AValue: Boolean); +begin + FEnabled := AValue; +end; + +procedure TDBGBreakPointGroup.SetItem(const AnIndex: Integer; const AValue: TDBGBreakPoint); +begin +end; + +procedure TDBGBreakPointGroup.SetName(const AValue: String); +begin + FName := AValue; +end; + +{ TDBGBreakPointGroups } + +function TDBGBreakPointGroups.GetItem(const AnIndex: Integer): TDBGBreakPointGroup; +begin +end; + +procedure TDBGBreakPointGroups.SetItem(const AnIndex: Integer; const Value: TDBGBreakPointGroup); +begin +end; + +end. diff --git a/debugger/dbgdebugger.pp b/debugger/dbgdebugger.pp new file mode 100644 index 0000000000..8bf2e72eef --- /dev/null +++ b/debugger/dbgdebugger.pp @@ -0,0 +1,100 @@ +unit DBGDebugger; + +{$mode objfpc} + +interface + +uses + Classes, DBGWatch, DBGBreakpoint; + +type + TDBGCommandFlags = set of (dcfRun, dcfPause, dcfStop, dcfStepOver, dcfStepInto, dcfRunTo, dcfJumpto, dcfBreak); + TDBGState = (dsStop, dsPause, dsRun, dsError); + + TDBGCurrentLineEvent = procedure(Sender: TObject; const ASource: String; const ALine: Integer) of object; + + TDebugger = class + private + FFileName: String; + FBreakPointGroups: TDBGBreakPointGroups; + FOnCurrent: TDBGCurrentLineEvent; + FOnState: TNotifyEvent; + FWatches: TDBGWatches; + protected + function GetDBGState: TDBGState; virtual; + procedure SetFileName(const Value: String); virtual; + function GetFlags: TDBGCommandFlags; virtual; + public + procedure Init; virtual; // Initializes external debugger + procedure Done; virtual; // Kills external debugger + procedure Run; virtual; // Starts / continues debugging + procedure Pause; virtual; // Stops running + procedure Stop; virtual; // quit debugging + procedure StepOver; virtual; + procedure StepInto; virtual; + procedure RunTo(const ASource: String; const ALine: Integer); virtual; // Executes til a certain point + procedure JumpTo(const ASource: String; const ALine: Integer); virtual; // No execute, only set exec point + property BreakPointGroups: TDBGBreakPointGroups read FBreakPointGroups; // list of all breakpoints + property FileName: String read FFileName write SetFileName; // The name of the exe to be debugged + property Flags: TDBGCommandFlags read GetFlags; // All available commands of the debugger + property State: TDBGState read GetDBGState; + property Watches: TDBGWatches read FWatches; // list of all watches localvars etc + property OnState: TNotifyEvent read FOnState write FOnState; // Fires when the current state of the debugger changes + property OnCurrent: TDBGCurrentLineEvent read FOnCurrent write FOnCurrent; //Passes info about the current line being debugged + end; + + +implementation + +{ TDebugger } + +procedure TDebugger.Done; +begin +end; + + +function TDebugger.GetDBGState: TDBGState; +begin +end; + +function TDebugger.GetFlags: TDBGCommandFlags; +begin +end; + +procedure TDebugger.Init; +begin +end; + +procedure TDebugger.JumpTo(const ASource: String; const ALine: Integer); +begin +end; + +procedure TDebugger.Pause; +begin +end; + +procedure TDebugger.Run; +begin +end; + +procedure TDebugger.RunTo(const ASource: String; const ALine: Integer); +begin +end; + +procedure TDebugger.SetFileName(const Value: String); +begin +end; + +procedure TDebugger.StepInto; +begin +end; + +procedure TDebugger.StepOver; +begin +end; + +procedure TDebugger.Stop; +begin +end; + +end. diff --git a/debugger/dbgwatch.pp b/debugger/dbgwatch.pp new file mode 100644 index 0000000000..e6a11545d1 --- /dev/null +++ b/debugger/dbgwatch.pp @@ -0,0 +1,58 @@ +unit DBGWatch; + +{$mode objfpc} + +interface + +uses + Classes; + +type + TDBGWatch = class(TCollectionItem) + private + FValue: String; + FName: String; + FOnChange: TNotifyEvent; + procedure SetValue(const AValue: String); + procedure SetName(const AValue: String); + protected + public + property Name: String read FName write SetName; + property Value: String read FValue write SetValue; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + TDBGWatches = class(TCollection) + private + function GetItem(const AnIndex: Integer): TDBGWatch; + procedure SetItem(const AnIndex: Integer; const Value: TDBGWatch); + protected + public + property Items[const AnIndex: Integer]: TDBGWatch read GetItem write SetItem; default; + end; + +implementation + +{ TDBGWatch } + +procedure TDBGWatch.SetName(const AValue: String); +begin + FName := AValue; +end; + +procedure TDBGWatch.SetValue(const AValue: String); +begin + FValue := AValue; +end; + +{ TDBGWatches } + +function TDBGWatches.GetItem(const AnIndex: Integer): TDBGWatch; +begin +end; + +procedure TDBGWatches.SetItem(const AnIndex: Integer; const Value: TDBGWatch); +begin +end; + +end. diff --git a/designer/abstractdebugger.pp b/designer/abstractdebugger.pp deleted file mode 100644 index 7756acfc38..0000000000 --- a/designer/abstractdebugger.pp +++ /dev/null @@ -1,51 +0,0 @@ -{ - /*************************************************************************** - AbstractDebugger.pp - ------------------- - - - - - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 AbstractDebugger; - -{$mode objfpc} - -interface - -uses - classes, Controls, forms,buttons,sysutils, Graphics,Extctrls; - -type - - TAbstractDebugger = class - public - procedure Go; abstract; virtual;//Starts / continues debugging - procedure Pause; abstract; virtual;//Stops running - procedure Stop; abstract; virtual;//quit debugging - procedure StepOver; abstract; virtual; - procedure StepInto; abstract; virtual; - procedure Goto(const ASource: String; ALine: Integer); abstract; virtual;//Executes til a certain point - procedure ExecuteTo(const ASource: String; ALine: Integer); abstract; virtual; //Executes til a certain point - procedure Goto; abstract; virtual; //No execute, only set exec point - property FileName: String; abstract; virtual;//The name of the exe to be debugged - property Flags: TCommandFlags; abstract; virtual; //All available flags of the debugger - property OnCurrent: TDebuggerCurrentLineEvent; abstract; virtual; //Passes info about the current line being debugged - property BreakPoints: TDBGBreakPoints; abstract; virtual; //list of all breakpoints - property Variables: TDBGVariables; abstract; virtual; //list of all watches localvars etc - property OnState: TDebuggerStateEvent; abstract; virtual; //Fires when the current state of the debugger changes - end; - -implementation - -end. diff --git a/ide/main.pp b/ide/main.pp index 74d8408528..b4df7786cb 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -32,7 +32,8 @@ uses Project, Sysutils, Controls, Graphics, ExtCtrls, Dialogs, CompReg, DlgMessage, Process, IDEComp, AbstractFormEditor, FormEditor, CustomFormEditor, ObjectInspector, ControlSelection, PropEdits, UnitEditor, - CompilerOptions, EditorOptions, {CodeTemplateDialog,} EnvironmentOpts; + CompilerOptions, EditorOptions, {CodeTemplateDialog,} EnvironmentOpts, + DBGDebugger; const Version_String = '0.7'; @@ -1782,6 +1783,10 @@ end. { ============================================================================= $Log$ + Revision 1.65 2001/02/25 16:32:48 lazarus + MWE: + + Added new debugger classes + Revision 1.64 2001/02/23 19:22:20 lazarus Added code to create the LFM when saving the file. Shane