mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 13:39:30 +02:00
FpDebug: move some breakpoint checks to TFpBreakPointTargetHandler
This commit is contained in:
parent
c6d52ae4b7
commit
ef78dcf1ba
@ -494,6 +494,8 @@ type
|
|||||||
procedure UpdateMapForNewTargetCode(const AAdress: TDbgPtr; const ASize: Cardinal; const AData); virtual; abstract;
|
procedure UpdateMapForNewTargetCode(const AAdress: TDbgPtr; const ASize: Cardinal; const AData); virtual; abstract;
|
||||||
|
|
||||||
function IsHardcodeBreakPoint(const ALocation: TDBGPtr): Boolean; virtual; abstract;
|
function IsHardcodeBreakPoint(const ALocation: TDBGPtr): Boolean; virtual; abstract;
|
||||||
|
// IsHardcodeBreakPointInCode checks even if no TFpInternalBreakpoint is set at the location
|
||||||
|
function IsHardcodeBreakPointInCode(const ALocation: TDBGPtr): Boolean; virtual; abstract;
|
||||||
|
|
||||||
procedure TempRemoveBreakInstructionCode(const ALocation: TDBGPtr); virtual; abstract;
|
procedure TempRemoveBreakInstructionCode(const ALocation: TDBGPtr); virtual; abstract;
|
||||||
procedure RestoreTempBreakInstructionCodes; virtual; abstract;
|
procedure RestoreTempBreakInstructionCodes; virtual; abstract;
|
||||||
@ -531,6 +533,7 @@ type
|
|||||||
procedure UpdateMapForNewTargetCode(const AAdress: TDbgPtr; const ASize: Cardinal; const AData); override;
|
procedure UpdateMapForNewTargetCode(const AAdress: TDbgPtr; const ASize: Cardinal; const AData); override;
|
||||||
|
|
||||||
function IsHardcodeBreakPoint(const ALocation: TDBGPtr): Boolean; override;
|
function IsHardcodeBreakPoint(const ALocation: TDBGPtr): Boolean; override;
|
||||||
|
function IsHardcodeBreakPointInCode(const ALocation: TDBGPtr): Boolean; override;
|
||||||
|
|
||||||
procedure TempRemoveBreakInstructionCode(const ALocation: TDBGPtr); override;
|
procedure TempRemoveBreakInstructionCode(const ALocation: TDBGPtr); override;
|
||||||
procedure RestoreTempBreakInstructionCodes; override;
|
procedure RestoreTempBreakInstructionCodes; override;
|
||||||
@ -1556,6 +1559,16 @@ begin
|
|||||||
Result := GetOrigValueAtLocation(ALocation) = _BREAK._CODE;
|
Result := GetOrigValueAtLocation(ALocation) = _BREAK._CODE;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGenericBreakPointTargetHandler.IsHardcodeBreakPointInCode(
|
||||||
|
const ALocation: TDBGPtr): Boolean;
|
||||||
|
var
|
||||||
|
OVal: _BRK_STORE;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if Process.ReadData(ALocation, SizeOf(_BRK_STORE), OVal) then
|
||||||
|
Result := OVal = _BREAK._CODE;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGenericBreakPointTargetHandler.TempRemoveBreakInstructionCode(
|
procedure TGenericBreakPointTargetHandler.TempRemoveBreakInstructionCode(
|
||||||
const ALocation: TDBGPtr);
|
const ALocation: TDBGPtr);
|
||||||
var
|
var
|
||||||
@ -3561,7 +3574,6 @@ end;
|
|||||||
procedure TDbgThread.CheckAndResetInstructionPointerAfterBreakpoint;
|
procedure TDbgThread.CheckAndResetInstructionPointerAfterBreakpoint;
|
||||||
var
|
var
|
||||||
t: TDBGPtr;
|
t: TDBGPtr;
|
||||||
OVal: Byte;
|
|
||||||
begin
|
begin
|
||||||
// todo: check that the breakpoint is NOT in the temp removed list
|
// todo: check that the breakpoint is NOT in the temp removed list
|
||||||
t := GetInstructionPointerForHasBreakpointInfoForAddress;
|
t := GetInstructionPointerForHasBreakpointInfoForAddress;
|
||||||
@ -3574,20 +3586,16 @@ begin
|
|||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
// TODO: allow to skip this, while detaching
|
// TODO: allow to skip this, while detaching
|
||||||
if FProcess.ReadData(t, 1, OVal) then
|
FPausedAtHardcodeBreakPoint := Process.FBreakTargetHandler.IsHardcodeBreakPointInCode(t);
|
||||||
FPausedAtHardcodeBreakPoint := OVal = TDbgProcess.Int3;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDbgThread.CheckForHardcodeBreakPoint(AnAddr: TDBGPtr): boolean;
|
function TDbgThread.CheckForHardcodeBreakPoint(AnAddr: TDBGPtr): boolean;
|
||||||
var
|
|
||||||
OVal: Byte;
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if AnAddr = 0 then
|
if AnAddr = 0 then
|
||||||
exit;
|
exit;
|
||||||
if FProcess.ReadData(AnAddr, 1, OVal) then
|
FPausedAtHardcodeBreakPoint := Process.FBreakTargetHandler.IsHardcodeBreakPointInCode(AnAddr);
|
||||||
FPausedAtHardcodeBreakPoint := OVal = TDbgProcess.Int3;
|
|
||||||
Result := FPausedAtHardcodeBreakPoint;
|
Result := FPausedAtHardcodeBreakPoint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user