mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 02:07:34 +02:00
LazDebuggerFp (pure): Pass arguments to debuggee
git-svn-id: trunk@44928 -
This commit is contained in:
parent
805a4e6542
commit
04283997b4
@ -263,7 +263,7 @@ type
|
|||||||
function DoBreak(BreakpointAddress: TDBGPtr; AThreadID: integer): Boolean;
|
function DoBreak(BreakpointAddress: TDBGPtr; AThreadID: integer): Boolean;
|
||||||
procedure MaskBreakpointsInReadData(const AAdress: TDbgPtr; const ASize: Cardinal; var AData);
|
procedure MaskBreakpointsInReadData(const AAdress: TDbgPtr; const ASize: Cardinal; var AData);
|
||||||
public
|
public
|
||||||
class function StartInstance(AFileName: string; AParams: string): TDbgProcess; virtual;
|
class function StartInstance(AFileName: string; AParams: TStringList): TDbgProcess; virtual;
|
||||||
constructor Create(const AName: string; const AProcessID, AThreadID: Integer); virtual;
|
constructor Create(const AName: string; const AProcessID, AThreadID: Integer); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function AddBreak(const ALocation: TDbgPtr): TDbgBreakpoint; overload;
|
function AddBreak(const ALocation: TDbgPtr): TDbgBreakpoint; overload;
|
||||||
@ -799,7 +799,7 @@ begin
|
|||||||
FExitCode:=AValue;
|
FExitCode:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDbgProcess.StartInstance(AFileName: string; AParams: string): TDbgProcess;
|
class function TDbgProcess.StartInstance(AFileName: string; AParams: TStringList): TDbgProcess;
|
||||||
begin
|
begin
|
||||||
DebugLn('Debug support for this platform is not available.');
|
DebugLn('Debug support for this platform is not available.');
|
||||||
result := nil;
|
result := nil;
|
||||||
|
@ -33,9 +33,11 @@ type
|
|||||||
FProcessMap: TMap;
|
FProcessMap: TMap;
|
||||||
FExitCode: DWord;
|
FExitCode: DWord;
|
||||||
FPDEvent: TFPDEvent;
|
FPDEvent: TFPDEvent;
|
||||||
|
FParams: TStringList;
|
||||||
procedure SetExecutableFilename(AValue: string);
|
procedure SetExecutableFilename(AValue: string);
|
||||||
procedure SetOnLog(AValue: TOnLog);
|
procedure SetOnLog(AValue: TOnLog);
|
||||||
procedure DoOnDebugInfoLoaded(Sender: TObject);
|
procedure DoOnDebugInfoLoaded(Sender: TObject);
|
||||||
|
procedure SetParams(AValue: TStringList);
|
||||||
protected
|
protected
|
||||||
FMainProcess: TDbgProcess;
|
FMainProcess: TDbgProcess;
|
||||||
FCurrentProcess: TDbgProcess;
|
FCurrentProcess: TDbgProcess;
|
||||||
@ -61,6 +63,7 @@ type
|
|||||||
property OnLog: TOnLog read FOnLog write SetOnLog;
|
property OnLog: TOnLog read FOnLog write SetOnLog;
|
||||||
property CurrentProcess: TDbgProcess read FCurrentProcess;
|
property CurrentProcess: TDbgProcess read FCurrentProcess;
|
||||||
property MainProcess: TDbgProcess read FMainProcess;
|
property MainProcess: TDbgProcess read FMainProcess;
|
||||||
|
property Params: TStringList read FParams write SetParams;
|
||||||
|
|
||||||
property OnCreateProcessEvent: TOnCreateProcessEvent read FOnCreateProcessEvent write FOnCreateProcessEvent;
|
property OnCreateProcessEvent: TOnCreateProcessEvent read FOnCreateProcessEvent write FOnCreateProcessEvent;
|
||||||
property OnHitBreakpointEvent: TOnHitBreakpointEvent read FOnHitBreakpointEvent write FOnHitBreakpointEvent;
|
property OnHitBreakpointEvent: TOnHitBreakpointEvent read FOnHitBreakpointEvent write FOnHitBreakpointEvent;
|
||||||
@ -79,6 +82,12 @@ begin
|
|||||||
FOnDebugInfoLoaded(Self);
|
FOnDebugInfoLoaded(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDbgController.SetParams(AValue: TStringList);
|
||||||
|
begin
|
||||||
|
if FParams=AValue then Exit;
|
||||||
|
FParams.Assign(AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDbgController.SetExecutableFilename(AValue: string);
|
procedure TDbgController.SetExecutableFilename(AValue: string);
|
||||||
begin
|
begin
|
||||||
if FExecutableFilename=AValue then Exit;
|
if FExecutableFilename=AValue then Exit;
|
||||||
@ -96,6 +105,7 @@ end;
|
|||||||
destructor TDbgController.Destroy;
|
destructor TDbgController.Destroy;
|
||||||
begin
|
begin
|
||||||
//FCurrentProcess.Free;
|
//FCurrentProcess.Free;
|
||||||
|
FParams.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -120,7 +130,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FCurrentProcess := OSDbgClasses.DbgProcessClass.StartInstance(FExecutableFilename, '');
|
FCurrentProcess := OSDbgClasses.DbgProcessClass.StartInstance(FExecutableFilename, FParams);
|
||||||
if assigned(FCurrentProcess) then
|
if assigned(FCurrentProcess) then
|
||||||
begin
|
begin
|
||||||
FCurrentProcess.OnDebugInfoLoaded := @DoOnDebugInfoLoaded;
|
FCurrentProcess.OnDebugInfoLoaded := @DoOnDebugInfoLoaded;
|
||||||
@ -321,6 +331,7 @@ end;
|
|||||||
|
|
||||||
constructor TDbgController.Create;
|
constructor TDbgController.Create;
|
||||||
begin
|
begin
|
||||||
|
FParams := TStringList.Create;
|
||||||
FProcessMap := TMap.Create(itu4, SizeOf(TDbgProcess));
|
FProcessMap := TMap.Create(itu4, SizeOf(TDbgProcess));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function InitializeLoader: TDbgImageLoader; override;
|
function InitializeLoader: TDbgImageLoader; override;
|
||||||
public
|
public
|
||||||
class function StartInstance(AFileName: string; AParams: string): TDbgProcess; override;
|
class function StartInstance(AFileName: string; AParams: TStringList): TDbgProcess; override;
|
||||||
constructor Create(const AName: string; const AProcessID, AThreadID: Integer); override;
|
constructor Create(const AName: string; const AProcessID, AThreadID: Integer); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDbgDarwinProcess.StartInstance(AFileName: string; AParams: string): TDbgProcess;
|
class function TDbgDarwinProcess.StartInstance(AFileName: string; AParams: TStringList): TDbgProcess;
|
||||||
var
|
var
|
||||||
PID: TPid;
|
PID: TPid;
|
||||||
stat: longint;
|
stat: longint;
|
||||||
@ -320,6 +320,7 @@ begin
|
|||||||
try
|
try
|
||||||
AProcess.OnForkEvent:=@OnForkEvent;
|
AProcess.OnForkEvent:=@OnForkEvent;
|
||||||
AProcess.Executable:=AnExecutabeFilename;
|
AProcess.Executable:=AnExecutabeFilename;
|
||||||
|
AProcess.Parameters:=AParams;
|
||||||
AProcess.Execute;
|
AProcess.Execute;
|
||||||
PID:=AProcess.ProcessID;
|
PID:=AProcess.ProcessID;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ type
|
|||||||
procedure Interrupt;
|
procedure Interrupt;
|
||||||
function HandleDebugEvent(const ADebugEvent: TDebugEvent): Boolean;
|
function HandleDebugEvent(const ADebugEvent: TDebugEvent): Boolean;
|
||||||
|
|
||||||
class function StartInstance(AFileName: string; AParams: string): TDbgProcess; override;
|
class function StartInstance(AFileName: string; AParams: TStringList): TDbgProcess; override;
|
||||||
function Continue(AProcess: TDbgProcess; AThread: TDbgThread): boolean; override;
|
function Continue(AProcess: TDbgProcess; AThread: TDbgThread): boolean; override;
|
||||||
function WaitForDebugEvent(out ProcessIdentifier, ThreadIdentifier: THandle): boolean; override;
|
function WaitForDebugEvent(out ProcessIdentifier, ThreadIdentifier: THandle): boolean; override;
|
||||||
function ResolveDebugEvent(AThread: TDbgThread): TFPDEvent; override;
|
function ResolveDebugEvent(AThread: TDbgThread): TFPDEvent; override;
|
||||||
@ -398,7 +398,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDbgWinProcess.StartInstance(AFileName: string; AParams: string): TDbgProcess;
|
class function TDbgWinProcess.StartInstance(AFileName: string; AParams: TStringList): TDbgProcess;
|
||||||
var
|
var
|
||||||
AProcess: TProcess;
|
AProcess: TProcess;
|
||||||
begin
|
begin
|
||||||
@ -406,6 +406,7 @@ begin
|
|||||||
try
|
try
|
||||||
AProcess.Options:=[poDebugProcess, poNewProcessGroup];
|
AProcess.Options:=[poDebugProcess, poNewProcessGroup];
|
||||||
AProcess.Executable:=AFilename;
|
AProcess.Executable:=AFilename;
|
||||||
|
AProcess.Parameters:=AParams;
|
||||||
AProcess.Execute;
|
AProcess.Execute;
|
||||||
|
|
||||||
result := TDbgWinProcess.Create(AFileName, AProcess.ProcessID, AProcess.ThreadID);
|
result := TDbgWinProcess.Create(AFileName, AProcess.ProcessID, AProcess.ThreadID);
|
||||||
|
@ -9,6 +9,7 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
Forms,
|
Forms,
|
||||||
Maps,
|
Maps,
|
||||||
|
process,
|
||||||
LazLogger,
|
LazLogger,
|
||||||
FpDbgClasses,
|
FpDbgClasses,
|
||||||
FpDbgInfo,
|
FpDbgInfo,
|
||||||
@ -858,6 +859,9 @@ begin
|
|||||||
if not assigned(FDbgController.MainProcess) then
|
if not assigned(FDbgController.MainProcess) then
|
||||||
begin
|
begin
|
||||||
FDbgController.ExecutableFilename:=FileName;
|
FDbgController.ExecutableFilename:=FileName;
|
||||||
|
FDbgController.Params.Clear;
|
||||||
|
if Arguments<>'' then
|
||||||
|
CommandToList(Arguments, FDbgController.Params);
|
||||||
FFpDebugThread := TFpDebugThread.Create(Self);
|
FFpDebugThread := TFpDebugThread.Create(Self);
|
||||||
RTLeventWaitFor(FFpDebugThread.DebugLoopStoppedEvent);
|
RTLeventWaitFor(FFpDebugThread.DebugLoopStoppedEvent);
|
||||||
RTLeventResetEvent(FFpDebugThread.DebugLoopStoppedEvent);
|
RTLeventResetEvent(FFpDebugThread.DebugLoopStoppedEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user