mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 22:41:42 +02:00
LazDebuggerFp: Ensure MemReader.RegisterSize is run in debug-thread. It currently needs the thread-state, as the size is read from the RegisterValue-list.
(cherry picked from commit 12b1484637
)
This commit is contained in:
parent
30d615e33a
commit
357120fb44
@ -560,6 +560,7 @@ type
|
|||||||
FRegContext: TFpDbgLocationContext;
|
FRegContext: TFpDbgLocationContext;
|
||||||
FRegResult: Boolean;
|
FRegResult: Boolean;
|
||||||
procedure DoReadRegister;
|
procedure DoReadRegister;
|
||||||
|
procedure DoRegisterSize;
|
||||||
protected
|
protected
|
||||||
function GetDbgProcess: TDbgProcess; override;
|
function GetDbgProcess: TDbgProcess; override;
|
||||||
function GetDbgThread(AContext: TFpDbgLocationContext): TDbgThread; override;
|
function GetDbgThread(AContext: TFpDbgLocationContext): TDbgThread; override;
|
||||||
@ -571,6 +572,7 @@ type
|
|||||||
function ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
|
function ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
|
||||||
function ReadRegister(ARegNum: Cardinal; out AValue: TDbgPtr;
|
function ReadRegister(ARegNum: Cardinal; out AValue: TDbgPtr;
|
||||||
AContext: TFpDbgLocationContext): Boolean; override;
|
AContext: TFpDbgLocationContext): Boolean; override;
|
||||||
|
function RegisterSize(ARegNum: Cardinal): Integer; override;
|
||||||
//WriteMemory is not overwritten. It must ONLY be called in the debug-thread
|
//WriteMemory is not overwritten. It must ONLY be called in the debug-thread
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1402,6 +1404,11 @@ begin
|
|||||||
FRegResult := inherited ReadRegister(FRegNum, FRegValue, FRegContext);
|
FRegResult := inherited ReadRegister(FRegNum, FRegValue, FRegContext);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFpDbgMemReader.DoRegisterSize;
|
||||||
|
begin
|
||||||
|
FRegValue := inherited RegisterSize(FRegNum);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TFpDbgMemReader.create(AFpDebugDebuger: TFpDebugDebugger);
|
constructor TFpDbgMemReader.create(AFpDebugDebuger: TFpDebugDebugger);
|
||||||
begin
|
begin
|
||||||
FFpDebugDebugger := AFpDebugDebuger;
|
FFpDebugDebugger := AFpDebugDebuger;
|
||||||
@ -1439,6 +1446,17 @@ begin
|
|||||||
result := FRegResult;
|
result := FRegResult;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFpDbgMemReader.RegisterSize(ARegNum: Cardinal): Integer;
|
||||||
|
begin
|
||||||
|
// Shortcut, if in debug-thread / do not use Self.F*
|
||||||
|
if ThreadID = FFpDebugDebugger.FWorkerThreadId then
|
||||||
|
exit(inherited RegisterSize(ARegNum));
|
||||||
|
|
||||||
|
FRegNum := ARegNum;
|
||||||
|
FFpDebugDebugger.ExecuteInDebugThread(@DoRegisterSize);
|
||||||
|
result := FRegValue;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFPCallStackSupplier }
|
{ TFPCallStackSupplier }
|
||||||
|
|
||||||
function TFPCallStackSupplier.FpDebugger: TFpDebugDebugger;
|
function TFPCallStackSupplier.FpDebugger: TFpDebugDebugger;
|
||||||
|
Loading…
Reference in New Issue
Block a user