FpDebugger (pure): Remove breakpoints from within the debug-thread on Linux

git-svn-id: trunk@45934 -
This commit is contained in:
joost 2014-07-20 14:36:42 +00:00
parent ac95b9c55d
commit 70300be121

View File

@ -124,9 +124,11 @@ type
procedure DoAddBreakLocation; procedure DoAddBreakLocation;
procedure DoReadData; procedure DoReadData;
procedure DoPrepareCallStackEntryList; procedure DoPrepareCallStackEntryList;
procedure DoFreeBreakpoint;
{$endif linux} {$endif linux}
function AddBreak(const ALocation: TDbgPtr): FpDbgClasses.TDbgBreakpoint; overload; function AddBreak(const ALocation: TDbgPtr): FpDbgClasses.TDbgBreakpoint; overload;
function AddBreak(const AFileName: String; ALine: Cardinal): FpDbgClasses.TDbgBreakpoint; overload; function AddBreak(const AFileName: String; ALine: Cardinal): FpDbgClasses.TDbgBreakpoint; overload;
procedure FreeBreakpoint(const ABreakpoint: FpDbgClasses.TDbgBreakpoint);
function ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean; function ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean;
function ReadAddress(const AAdress: TDbgPtr; out AData: TDBGPtr): Boolean; function ReadAddress(const AAdress: TDbgPtr; out AData: TDBGPtr): Boolean;
procedure PrepareCallStackEntryList; procedure PrepareCallStackEntryList;
@ -501,7 +503,8 @@ begin
begin begin
ABrkPoint := FpDbgClasses.TDbgBreakpoint(FDelayedRemoveBreakpointList[i]); ABrkPoint := FpDbgClasses.TDbgBreakpoint(FDelayedRemoveBreakpointList[i]);
TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(ABrkPoint.Location); TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(ABrkPoint.Location);
FreeAndNil(ABrkPoint); TFpDebugDebugger(Debugger).FreeBreakpoint(ABrkPoint);
ABrkPoint := nil;
FDelayedRemoveBreakpointList.Delete(i); FDelayedRemoveBreakpointList.Delete(i);
end; end;
end; end;
@ -543,7 +546,7 @@ procedure TFPBreakpoint.SetBreak;
begin begin
assert(FInternalBreakpoint=nil); assert(FInternalBreakpoint=nil);
case Kind of case Kind of
bpkAddress: FInternalBreakpoint := TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.AddBreak(Address); bpkAddress: FInternalBreakpoint := TFpDebugDebugger(Debugger).AddBreak(Address);
bpkSource: FInternalBreakpoint := TFpDebugDebugger(Debugger).AddBreak(Source, cardinal(Line)); bpkSource: FInternalBreakpoint := TFpDebugDebugger(Debugger).AddBreak(Source, cardinal(Line));
else else
Raise Exception.Create('Breakpoints of this kind are not suported.'); Raise Exception.Create('Breakpoints of this kind are not suported.');
@ -562,7 +565,8 @@ begin
if assigned(Debugger) and assigned(FInternalBreakpoint) then if assigned(Debugger) and assigned(FInternalBreakpoint) then
begin begin
TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(FInternalBreakpoint.Location); TFpDebugDebugger(Debugger).FDbgController.CurrentProcess.RemoveBreak(FInternalBreakpoint.Location);
FreeAndNil(FInternalBreakpoint); TFpDebugDebugger(Debugger).FreeBreakpoint(FInternalBreakpoint);
FInternalBreakpoint := nil;
end; end;
FIsSet:=false; FIsSet:=false;
end; end;
@ -1498,6 +1502,12 @@ procedure TFpDebugDebugger.DoPrepareCallStackEntryList;
begin begin
FDbgController.CurrentThread.PrepareCallStackEntryList; FDbgController.CurrentThread.PrepareCallStackEntryList;
end; end;
procedure TFpDebugDebugger.DoFreeBreakpoint;
begin
FCacheBreakpoint.Free;
end;
{$endif linux} {$endif linux}
function TFpDebugDebugger.AddBreak(const ALocation: TDbgPtr): FpDbgClasses.TDbgBreakpoint; function TFpDebugDebugger.AddBreak(const ALocation: TDbgPtr): FpDbgClasses.TDbgBreakpoint;
@ -1523,6 +1533,16 @@ begin
{$endif linux} {$endif linux}
end; end;
procedure TFpDebugDebugger.FreeBreakpoint(const ABreakpoint: FpDbgClasses.TDbgBreakpoint);
begin
{$ifdef linux}
FCacheBreakpoint:=ABreakpoint;
ExecuteInDebugThread(@DoFreeBreakpoint);
{$else linux}
ABreakpoint.Free;
{$endif linux}
end;
function TFpDebugDebugger.ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean; function TFpDebugDebugger.ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean;
begin begin
{$ifdef linux} {$ifdef linux}