mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 00:49:36 +01:00
Debugger/DbgIntf: Moved registration
git-svn-id: trunk@44102 -
This commit is contained in:
parent
7b45286e2d
commit
8b589d149c
@ -1555,6 +1555,16 @@ type
|
|||||||
end;
|
end;
|
||||||
TDebuggerClass = class of TDebuggerIntf;
|
TDebuggerClass = class of TDebuggerIntf;
|
||||||
|
|
||||||
|
TBaseDebugManagerIntf = class(TComponent)
|
||||||
|
protected
|
||||||
|
function GetDebuggerClass(const AIndex: Integer): TDebuggerClass;
|
||||||
|
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
||||||
|
public
|
||||||
|
function DebuggerCount: Integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
||||||
|
|
||||||
function dbgs(AState: TDBGState): String; overload;
|
function dbgs(AState: TDBGState): String; overload;
|
||||||
function dbgs(ADataState: TDebuggerDataState): String; overload;
|
function dbgs(ADataState: TDebuggerDataState): String; overload;
|
||||||
function dbgs(AKind: TDBGSymbolKind): String; overload;
|
function dbgs(AKind: TDBGSymbolKind): String; overload;
|
||||||
@ -1595,6 +1605,12 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
MDebuggerPropertiesList: TStringlist = nil;
|
MDebuggerPropertiesList: TStringlist = nil;
|
||||||
|
MDebuggerClasses: TStringList;
|
||||||
|
|
||||||
|
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
||||||
|
begin
|
||||||
|
MDebuggerClasses.AddObject(ADebuggerClass.ClassName, TObject(Pointer(ADebuggerClass)));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DoFinalization;
|
procedure DoFinalization;
|
||||||
var
|
var
|
||||||
@ -4375,6 +4391,26 @@ begin
|
|||||||
DebugLn(DBG_WARNINGS, 'TDebuggerIntf.Stop Class=',ClassName,' failed.');
|
DebugLn(DBG_WARNINGS, 'TDebuggerIntf.Stop Class=',ClassName,' failed.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseDebugManagerIntf.DebuggerCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := MDebuggerClasses.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBaseDebugManagerIntf.FindDebuggerClass(const AString: String): TDebuggerClass;
|
||||||
|
var
|
||||||
|
idx: Integer;
|
||||||
|
begin
|
||||||
|
idx := MDebuggerClasses.IndexOf(AString);
|
||||||
|
if idx = -1
|
||||||
|
then Result := nil
|
||||||
|
else Result := TDebuggerClass(MDebuggerClasses.Objects[idx]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBaseDebugManagerIntf.GetDebuggerClass(const AIndex: Integer): TDebuggerClass;
|
||||||
|
begin
|
||||||
|
Result := TDebuggerClass(MDebuggerClasses.Objects[AIndex]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
MDebuggerPropertiesList := nil;
|
MDebuggerPropertiesList := nil;
|
||||||
@ -4388,7 +4424,12 @@ initialization
|
|||||||
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
|
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
|
||||||
DBG_DISASSEMBLER := DebugLogger.FindOrRegisterLogGroup('DBG_DISASSEMBLER' {$IFDEF DBG_DISASSEMBLER} , True {$ENDIF} );
|
DBG_DISASSEMBLER := DebugLogger.FindOrRegisterLogGroup('DBG_DISASSEMBLER' {$IFDEF DBG_DISASSEMBLER} , True {$ENDIF} );
|
||||||
|
|
||||||
|
MDebuggerClasses := TStringList.Create;
|
||||||
|
MDebuggerClasses.Sorted := True;
|
||||||
|
MDebuggerClasses.Duplicates := dupError;
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
DoFinalization;
|
DoFinalization;
|
||||||
|
FreeAndNil(MDebuggerClasses);
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -39,14 +39,14 @@ unit CmdLineDebugger;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Types, Process, FileUtil, Debugger, LCLProc, LazLoggerBase, DbgIntfDebuggerBase,
|
Classes, Types, Process, FileUtil, LCLProc, LazLoggerBase, DbgIntfDebuggerBase,
|
||||||
Forms, DebugUtils;
|
Forms, DebugUtils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCmdLineDebugger }
|
{ TCmdLineDebugger }
|
||||||
|
|
||||||
TCmdLineDebugger = class(TDebugger)
|
TCmdLineDebugger = class(TDebuggerIntf)
|
||||||
private
|
private
|
||||||
FDbgProcess: TProcess; // The process used to call the debugger
|
FDbgProcess: TProcess; // The process used to call the debugger
|
||||||
FLineEnds: TStringDynArray; // List of strings considered as lineends
|
FLineEnds: TStringDynArray; // List of strings considered as lineends
|
||||||
|
|||||||
@ -40,9 +40,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, strutils, Controls, Math, Maps, Variants, FileUtil, Dialogs,
|
Classes, SysUtils, strutils, Controls, Math, Maps, Variants, FileUtil, Dialogs,
|
||||||
BaseIDEIntf, LCLProc, LCLIntf, LazClasses, LazLoggerBase,
|
BaseIDEIntf, LCLProc, LazClasses, LazLoggerBase,
|
||||||
DebugUtils, Debugger, GDBTypeInfo, GDBMIDebugInstructions, GDBMIMiscClasses,
|
DebugUtils, Debugger, GDBTypeInfo, GDBMIDebugInstructions, GDBMIMiscClasses,
|
||||||
BaseDebugManager, DbgIntfBaseTypes, DbgIntfDebuggerBase,
|
DbgIntfBaseTypes, DbgIntfDebuggerBase,
|
||||||
{$IFdef MSWindows}
|
{$IFdef MSWindows}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|||||||
@ -104,9 +104,7 @@ type
|
|||||||
class function GetInstance: TAbstractIDEOptions; override;
|
class function GetInstance: TAbstractIDEOptions; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TBaseDebugManager = class(TComponent)
|
TBaseDebugManager = class(TBaseDebugManagerIntf)
|
||||||
private
|
|
||||||
function GetDebuggerClass(const AIndex: Integer): TDebuggerClass;
|
|
||||||
protected
|
protected
|
||||||
FDestroying: boolean;
|
FDestroying: boolean;
|
||||||
FCallStack: TCallStackMonitor;
|
FCallStack: TCallStackMonitor;
|
||||||
@ -122,7 +120,6 @@ type
|
|||||||
FRegisters: TIDERegisters;
|
FRegisters: TIDERegisters;
|
||||||
FSnapshots: TSnapshotManager;
|
FSnapshots: TSnapshotManager;
|
||||||
FManagerStates: TDebugManagerStates;
|
FManagerStates: TDebugManagerStates;
|
||||||
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
|
||||||
function GetState: TDBGState; virtual; abstract;
|
function GetState: TDBGState; virtual; abstract;
|
||||||
function GetCommands: TDBGCommands; virtual; abstract;
|
function GetCommands: TDBGCommands; virtual; abstract;
|
||||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
@ -144,7 +141,6 @@ type
|
|||||||
procedure SaveProjectSpecificInfo(XMLConfig: TXMLConfig;
|
procedure SaveProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||||
Flags: TProjectWriteFlags); virtual; abstract;
|
Flags: TProjectWriteFlags); virtual; abstract;
|
||||||
|
|
||||||
function DebuggerCount: Integer;
|
|
||||||
|
|
||||||
procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); virtual; abstract;
|
procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); virtual; abstract;
|
||||||
|
|
||||||
@ -236,7 +232,6 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
|
||||||
|
|
||||||
var
|
var
|
||||||
DebugBoss: TBaseDebugManager;
|
DebugBoss: TBaseDebugManager;
|
||||||
@ -244,43 +239,14 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
var
|
|
||||||
MDebuggerClasses: TStringList;
|
|
||||||
|
|
||||||
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
|
||||||
begin
|
|
||||||
MDebuggerClasses.AddObject(ADebuggerClass.ClassName, TObject(Pointer(ADebuggerClass)));
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TBaseDebugManager }
|
{ TBaseDebugManager }
|
||||||
|
|
||||||
function TBaseDebugManager.DebuggerCount: Integer;
|
|
||||||
begin
|
|
||||||
Result := MDebuggerClasses.Count;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TBaseDebugManager.FindDebuggerClass(const AString: String): TDebuggerClass;
|
|
||||||
var
|
|
||||||
idx: Integer;
|
|
||||||
begin
|
|
||||||
idx := MDebuggerClasses.IndexOf(AString);
|
|
||||||
if idx = -1
|
|
||||||
then Result := nil
|
|
||||||
else Result := TDebuggerClass(MDebuggerClasses.Objects[idx]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TBaseDebugManager.CreateDebugDialog(Sender: TObject; aFormName: string;
|
procedure TBaseDebugManager.CreateDebugDialog(Sender: TObject; aFormName: string;
|
||||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseDebugManager.GetDebuggerClass(const AIndex: Integer): TDebuggerClass;
|
|
||||||
begin
|
|
||||||
Result := TDebuggerClass(MDebuggerClasses.Objects[AIndex]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TDebuggerOptions }
|
{ TDebuggerOptions }
|
||||||
|
|
||||||
class function TDebuggerOptions.GetGroupCaption: string;
|
class function TDebuggerOptions.GetGroupCaption: string;
|
||||||
@ -296,12 +262,6 @@ end;
|
|||||||
initialization
|
initialization
|
||||||
RegisterIDEOptionsGroup(GroupDebugger, TDebuggerOptions);
|
RegisterIDEOptionsGroup(GroupDebugger, TDebuggerOptions);
|
||||||
DebugBoss := nil;
|
DebugBoss := nil;
|
||||||
MDebuggerClasses := TStringList.Create;
|
|
||||||
MDebuggerClasses.Sorted := True;
|
|
||||||
MDebuggerClasses.Duplicates := dupError;
|
|
||||||
|
|
||||||
finalization
|
|
||||||
FreeAndNil(MDebuggerClasses);
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user