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