mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:39:24 +02:00
LazDebuggerFpLLDB/Gdbmi: Fix cached context
(cherry picked from commit 6cded56ae9
)
This commit is contained in:
parent
672e289ef3
commit
2187550bd5
@ -932,6 +932,7 @@ function TFpGDBMIDebugger.GetInfoContextForContext(AThreadId,
|
|||||||
var
|
var
|
||||||
Addr: TDBGPtr;
|
Addr: TDBGPtr;
|
||||||
i, sa: Integer;
|
i, sa: Integer;
|
||||||
|
LocCtx: TFpDbgSimpleLocationContext;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if FDwarfInfo = nil then
|
if FDwarfInfo = nil then
|
||||||
@ -968,10 +969,9 @@ begin
|
|||||||
sa := 4
|
sa := 4
|
||||||
else
|
else
|
||||||
sa := 8;
|
sa := 8;
|
||||||
Result := FDwarfInfo.FindSymbolScope(
|
LocCtx := TFpDbgSimpleLocationContext.Create(FMemManager, Addr, sa, AThreadId, AStackFrame);
|
||||||
TFpDbgSimpleLocationContext.Create(FMemManager, Addr, sa, AThreadId, AStackFrame),
|
Result := FDwarfInfo.FindSymbolScope(LocCtx, Addr);
|
||||||
Addr
|
LocCtx.ReleaseReference;
|
||||||
);
|
|
||||||
|
|
||||||
if Result = nil then begin
|
if Result = nil then begin
|
||||||
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
|
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
|
||||||
@ -979,7 +979,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
|
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
|
||||||
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) + SizeOf(FLastContext[0]));
|
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) * SizeOf(FLastContext[0]));
|
||||||
FLastContext[0] := Result;
|
FLastContext[0] := Result;
|
||||||
// TODO Result.AddReference;
|
// TODO Result.AddReference;
|
||||||
end;
|
end;
|
||||||
|
@ -1398,6 +1398,7 @@ function TFpLldbDebugger.GetInfoContextForContext(AThreadId,
|
|||||||
var
|
var
|
||||||
Addr: TDBGPtr;
|
Addr: TDBGPtr;
|
||||||
i, sa: Integer;
|
i, sa: Integer;
|
||||||
|
LocCtx: TFpDbgSimpleLocationContext;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if FDwarfInfo = nil then
|
if FDwarfInfo = nil then
|
||||||
@ -1435,11 +1436,9 @@ begin
|
|||||||
sa := 4
|
sa := 4
|
||||||
else
|
else
|
||||||
sa := 8;
|
sa := 8;
|
||||||
Result := FDwarfInfo.FindSymbolScope(
|
LocCtx := TFpDbgSimpleLocationContext.Create(FMemManager, Addr, sa, AThreadId, AStackFrame);
|
||||||
TFpDbgSimpleLocationContext.Create(FMemManager, Addr, sa, AThreadId, AStackFrame),
|
Result := FDwarfInfo.FindSymbolScope(LocCtx, Addr);
|
||||||
Addr
|
LocCtx.ReleaseReference;
|
||||||
);
|
|
||||||
Result.LocationContext.ReleaseReference;
|
|
||||||
|
|
||||||
if Result = nil then begin
|
if Result = nil then begin
|
||||||
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
|
debugln(DBG_VERBOSE, ['GetInfoContextForContext CTX NOT FOUND for ', AThreadId, ', ', AStackFrame]);
|
||||||
@ -1447,7 +1446,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
|
ReleaseRefAndNil(FLastContext[MAX_CTX_CACHE-1]);
|
||||||
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) + SizeOf(FLastContext[0]));
|
move(FLastContext[0], FLastContext[1], (MAX_CTX_CACHE-1) * SizeOf(FLastContext[0]));
|
||||||
FLastContext[0] := Result;
|
FLastContext[0] := Result;
|
||||||
Result.AddReference;
|
Result.AddReference;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user