Fp based/mixed debuggers: Fix context caching / clean up logging

git-svn-id: trunk@58352 -
This commit is contained in:
martin 2018-06-20 15:26:24 +00:00
parent a11d49bd4b
commit 4295b09fdb
2 changed files with 30 additions and 18 deletions

View File

@ -908,7 +908,7 @@ begin
Addr := GetLocationForContext(AThreadId, AStackFrame);
if Addr = 0 then begin
debugln(DBG_VERBOSE, ['GetInfoContextForContext NOT FOUND for ', AThreadId, ', ', AStackFrame]);
debugln(DBG_VERBOSE, ['GetInfoContextForContext ADDR NOT FOUND for ', AThreadId, ', ', AStackFrame]);
Result := nil;
exit;
end;
@ -930,6 +930,11 @@ begin
DebugLn(DBG_VERBOSE, ['* FDwarfInfo.FindContext ', dbgs(Addr)]);
Result := FDwarfInfo.FindContext(AThreadId, AStackFrame, Addr);
if Result = nil then begin
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
exit;
end;
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) + SizeOf(FLastContext[0]));
FLastContext[0] := Result;

View File

@ -378,22 +378,25 @@ begin
Result := False;
InStr := TLldbInstructionMemory.Create(AnAddress, ASize);
InStr.AddReference;
FDebugger.DebugInstructionQueue.QueueInstruction(InStr);
while not InStr.IsCompleted do begin
Application.ProcessMessages;
sleep(30);
try
FDebugger.DebugInstructionQueue.QueueInstruction(InStr);
while not InStr.IsCompleted do begin
Application.ProcessMessages;
sleep(30);
end;
debugln(['TFpLldbDbgMemReader.ReadMemory got mem ', AnAddress, ' ', ASize, ' ', Length(InStr.Res)]);
if Length(InStr.Res) <> ASize then
exit;
for i := 0 to ASize - 1 do begin
PByte(ADest + i)^ := InStr.Res[i];
end;
finally
InStr.ReleaseReference;
end;
debugln(['TFpLldbDbgMemReader.ReadMemory got mem ', AnAddress, ' ', ASize, ' ', Length(InStr.Res)]);
if Length(InStr.Res) <> ASize then
exit;
for i := 0 to ASize - 1 do begin
PByte(ADest + i)^ := InStr.Res[i];
end;
InStr.ReleaseReference;
Result := True;
debugln(DBG_VERBOSE, ['TFpLldbDbgMemReader.ReadMemory ', dbgs(AnAddress), ' ', dbgMemRange(ADest, ASize)]);
@ -413,7 +416,6 @@ var
i: Integer;
Reg: TRegisters;
RegVObj: TRegisterDisplayValue;
InStr: TLldbInstructionRegister;
begin
Result := False;
@ -855,7 +857,7 @@ begin
Addr := GetLocationForContext(AThreadId, AStackFrame);
if Addr = 0 then begin
debugln(DBG_VERBOSE, ['GetInfoContextForContext NOT FOUND for ', AThreadId, ', ', AStackFrame]);
debugln(DBG_VERBOSE, ['GetInfoContextForContext ADDR NOT FOUND for ', AThreadId, ', ', AStackFrame]);
Result := nil;
exit;
end;
@ -877,6 +879,11 @@ begin
DebugLn(DBG_VERBOSE, ['* FDwarfInfo.FindContext ', dbgs(Addr)]);
Result := FDwarfInfo.FindContext(AThreadId, AStackFrame, Addr);
if Result = nil then begin
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
exit;
end;
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) + SizeOf(FLastContext[0]));
FLastContext[0] := Result;