mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 05:29:29 +02:00
* Added OnLog event to be able to log to something else then stdout
git-svn-id: trunk@44551 -
This commit is contained in:
parent
4e227f7e97
commit
2cb000b1be
@ -44,6 +44,7 @@ type
|
|||||||
TFPDState = (dsStop, dsRun, dsPause, dsQuit, dsEvent);
|
TFPDState = (dsStop, dsRun, dsPause, dsQuit, dsEvent);
|
||||||
TFPDEvent = (deExitProcess, deBreakpoint, deException, deCreateProcess, deLoadLibrary);
|
TFPDEvent = (deExitProcess, deBreakpoint, deException, deCreateProcess, deLoadLibrary);
|
||||||
TFPDMode = (dm32, dm64);
|
TFPDMode = (dm32, dm64);
|
||||||
|
TOnLog = procedure(AString: string) of object;
|
||||||
|
|
||||||
TDbgProcess = class;
|
TDbgProcess = class;
|
||||||
|
|
||||||
@ -130,6 +131,7 @@ type
|
|||||||
TDbgProcess = class(TDbgInstance)
|
TDbgProcess = class(TDbgInstance)
|
||||||
private
|
private
|
||||||
FExitCode: DWord;
|
FExitCode: DWord;
|
||||||
|
FOnLog: TOnLog;
|
||||||
FProcessID: Integer;
|
FProcessID: Integer;
|
||||||
FThreadID: Integer;
|
FThreadID: Integer;
|
||||||
|
|
||||||
@ -162,6 +164,8 @@ type
|
|||||||
function GetThread(const AID: Integer; out AThread: TDbgThread): Boolean;
|
function GetThread(const AID: Integer; out AThread: TDbgThread): Boolean;
|
||||||
function RemoveBreak(const ALocation: TDbgPtr): Boolean;
|
function RemoveBreak(const ALocation: TDbgPtr): Boolean;
|
||||||
procedure RemoveThread(const AID: DWord);
|
procedure RemoveThread(const AID: DWord);
|
||||||
|
procedure Log(AString: string);
|
||||||
|
procedure Log(AString: string; Options: array of const);
|
||||||
|
|
||||||
function ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean; virtual;
|
function ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean; virtual;
|
||||||
function ReadOrdinal(const AAdress: TDbgPtr; out AData): Boolean; virtual;
|
function ReadOrdinal(const AAdress: TDbgPtr; out AData): Boolean; virtual;
|
||||||
@ -185,6 +189,7 @@ type
|
|||||||
property ThreadID: integer read FThreadID;
|
property ThreadID: integer read FThreadID;
|
||||||
property ExitCode: DWord read FExitCode;
|
property ExitCode: DWord read FExitCode;
|
||||||
property LastEventProcessIdentifier: THandle read GetLastEventProcessIdentifier;
|
property LastEventProcessIdentifier: THandle read GetLastEventProcessIdentifier;
|
||||||
|
property OnLog: TOnLog read FOnLog write FOnLog;
|
||||||
end;
|
end;
|
||||||
TDbgProcessClass = class of TDbgProcess;
|
TDbgProcessClass = class of TDbgProcess;
|
||||||
|
|
||||||
@ -453,6 +458,17 @@ begin
|
|||||||
FThreadMap.Delete(AID);
|
FThreadMap.Delete(AID);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDbgProcess.Log(AString: string);
|
||||||
|
begin
|
||||||
|
if assigned(FOnLog) then
|
||||||
|
FOnLog(AString);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDbgProcess.Log(AString: string; Options: array of const);
|
||||||
|
begin
|
||||||
|
Log(Format(AString, Options));
|
||||||
|
end;
|
||||||
|
|
||||||
function TDbgProcess.GetHandle: THandle;
|
function TDbgProcess.GetHandle: THandle;
|
||||||
begin
|
begin
|
||||||
result := 0;
|
result := 0;
|
||||||
@ -465,7 +481,7 @@ end;
|
|||||||
|
|
||||||
class function TDbgProcess.StartInstance(AFileName: string; AParams: string): TDbgProcess;
|
class function TDbgProcess.StartInstance(AFileName: string; AParams: string): TDbgProcess;
|
||||||
begin
|
begin
|
||||||
Log('Debug support for this platform is not available.');
|
DebugLn('Debug support for this platform is not available.');
|
||||||
result := nil;
|
result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user