mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 07:22:03 +02:00
LazDebuggerFp (pure):
* When a breakpoint is hit, pass the correct breakpoint to the TFpDebugDebugger. * Solve an AV when the IDE exits git-svn-id: trunk@44743 -
This commit is contained in:
parent
ad9ca5afa5
commit
86f9de7b2a
@ -259,6 +259,7 @@ type
|
||||
property ProcessID: integer read FProcessID;
|
||||
property ThreadID: integer read FThreadID;
|
||||
property ExitCode: DWord read FExitCode;
|
||||
property CurrentBreakpoint: TDbgBreakpoint read FCurrentBreakpoint;
|
||||
property LastEventProcessIdentifier: THandle read GetLastEventProcessIdentifier;
|
||||
property OnLog: TOnLog read FOnLog write FOnLog;
|
||||
property MainThread: TDbgThread read FMainThread;
|
||||
|
@ -15,7 +15,7 @@ uses
|
||||
type
|
||||
|
||||
TOnCreateProcessEvent = procedure(var continue: boolean) of object;
|
||||
TOnHitBreakpointEvent = procedure(var continue: boolean) of object;
|
||||
TOnHitBreakpointEvent = procedure(var continue: boolean; const Breakpoint: TDbgBreakpoint) of object;
|
||||
TOnExceptionEvent = procedure(var continue: boolean) of object;
|
||||
TOnProcessExitEvent = procedure(ExitCode: DWord) of object;
|
||||
|
||||
@ -246,7 +246,7 @@ begin
|
||||
debugln('Breakpoint');
|
||||
continue:=false;
|
||||
if assigned(OnHitBreakpointEvent) then
|
||||
OnHitBreakpointEvent(continue);
|
||||
OnHitBreakpointEvent(continue, FCurrentProcess.CurrentBreakpoint);
|
||||
end;
|
||||
deExitProcess:
|
||||
begin
|
||||
|
@ -45,7 +45,7 @@ type
|
||||
FDbgController: TDbgController;
|
||||
FFpDebugThread: TFpDebugThread;
|
||||
procedure FreeDebugThread;
|
||||
procedure FDbgControllerHitBreakpointEvent(var continue: boolean);
|
||||
procedure FDbgControllerHitBreakpointEvent(var continue: boolean; const Breakpoint: FpDbgClasses.TDbgBreakpoint);
|
||||
procedure FDbgControllerCreateProcessEvent(var continue: boolean);
|
||||
procedure FDbgControllerProcessExitEvent(AExitCode: DWord);
|
||||
procedure FDbgControllerExceptionEvent(var continue: boolean);
|
||||
@ -141,6 +141,13 @@ type
|
||||
public
|
||||
end;
|
||||
|
||||
{ TFPBreakpoints }
|
||||
|
||||
TFPBreakpoints = class(TDBGBreakPoints)
|
||||
public
|
||||
function Find(AIntBReakpoint: FpDbgClasses.TDbgBreakpoint): TDBGBreakPoint;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
@ -154,6 +161,21 @@ begin
|
||||
RegisterDebugger(TFpDebugDebugger);
|
||||
end;
|
||||
|
||||
{ TFPBreakpoints }
|
||||
|
||||
function TFPBreakpoints.Find(AIntBReakpoint: FpDbgClasses.TDbgBreakpoint): TDBGBreakPoint;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 0 to count-1 do
|
||||
if TFPBreakpoint(Items[i]).FInternalBreakpoint=AIntBReakpoint then
|
||||
begin
|
||||
result := TFPBreakpoint(Items[i]);
|
||||
Exit;
|
||||
end;
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
{ TFPBreakpoint }
|
||||
|
||||
procedure TFPBreakpoint.SetBreak;
|
||||
@ -173,8 +195,13 @@ end;
|
||||
|
||||
procedure TFPBreakpoint.ResetBreak;
|
||||
begin
|
||||
TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(FInternalBreakpoint.Location);
|
||||
FreeAndNil(FInternalBreakpoint);
|
||||
// If Debugger is not assigned, the Controller's currentprocess is already
|
||||
// freed. And so are the corresponding InternalBreakpoint's.
|
||||
if assigned(Debugger) and assigned(FInternalBreakpoint) then
|
||||
begin
|
||||
TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(FInternalBreakpoint.Location);
|
||||
FreeAndNil(FInternalBreakpoint);
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TFPBreakpoint.Destroy;
|
||||
@ -582,7 +609,7 @@ end;
|
||||
|
||||
function TFpDebugDebugger.CreateBreakPoints: TDBGBreakPoints;
|
||||
begin
|
||||
Result := TDBGBreakPoints.Create(Self, TFPBreakpoint);
|
||||
Result := TFPBreakPoints.Create(Self, TFPBreakpoint);
|
||||
end;
|
||||
|
||||
procedure TFpDebugDebugger.FDbgControllerDebugInfoLoaded(Sender: TObject);
|
||||
@ -603,9 +630,13 @@ begin
|
||||
FFpDebugThread := nil;
|
||||
end;
|
||||
|
||||
procedure TFpDebugDebugger.FDbgControllerHitBreakpointEvent(var continue: boolean);
|
||||
procedure TFpDebugDebugger.FDbgControllerHitBreakpointEvent(var continue: boolean; const Breakpoint: FpDbgClasses.TDbgBreakpoint);
|
||||
var
|
||||
ABreakPoint: TDBGBreakPoint;
|
||||
begin
|
||||
BreakPoints[0].Hit(continue);
|
||||
ABreakPoint := TFPBreakpoints(BreakPoints).Find(Breakpoint);
|
||||
if assigned(ABreakPoint) then
|
||||
ABreakPoint.Hit(continue);
|
||||
SetState(dsPause);
|
||||
DoCurrent(GetLocation);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user