FpDebug: Fixed uninitialized variables.

This commit is contained in:
Martin 2022-02-21 21:22:12 +01:00
parent d233f9981f
commit 8335731953
3 changed files with 11 additions and 7 deletions

View File

@ -1691,7 +1691,7 @@ end;
function TDbgInstance.EnclosesAddress(AnAddress: TDBGPtr): Boolean; function TDbgInstance.EnclosesAddress(AnAddress: TDBGPtr): Boolean;
begin begin
EnclosesAddressRange(AnAddress, AnAddress); Result := EnclosesAddressRange(AnAddress, AnAddress);
end; end;
function TDbgInstance.EnclosesAddressRange(AStartAddress, AnEndAddress: TDBGPtr): Boolean; function TDbgInstance.EnclosesAddressRange(AStartAddress, AnEndAddress: TDBGPtr): Boolean;
@ -1931,7 +1931,7 @@ var
sym: TFpSymbol; sym: TFpSymbol;
begin begin
Result := nil; Result := nil;
Ctx := TFpDbgSimpleLocationContext.Create(MemManager, Addr, DBGPTRSIZE[Mode], AThreadId, AStackFrame); Ctx := nil;
if GetThread(AThreadId, Thread) then begin if GetThread(AThreadId, Thread) then begin
Thread.PrepareCallStackEntryList(AStackFrame + 1); Thread.PrepareCallStackEntryList(AStackFrame + 1);
@ -1940,12 +1940,13 @@ begin
Frame := Thread.CallStackEntryList[AStackFrame]; Frame := Thread.CallStackEntryList[AStackFrame];
if Frame <> nil then begin if Frame <> nil then begin
Addr := Frame.AnAddress;
Ctx := TFpDbgSimpleLocationContext.Create(MemManager, Addr, DBGPTRSIZE[Mode], AThreadId, AStackFrame);
sym := Frame.ProcSymbol; sym := Frame.ProcSymbol;
if sym <> nil then if sym <> nil then
Result := sym.CreateSymbolScope(Ctx); Result := sym.CreateSymbolScope(Ctx);
if Result = nil then begin if Result = nil then begin
Addr := Frame.AnAddress;
if (Addr <> 0) or (FDbgInfo.TargetInfo.machineType = mtAVR8) then if (Addr <> 0) or (FDbgInfo.TargetInfo.machineType = mtAVR8) then
Result := FDbgInfo.FindSymbolScope(Ctx, Addr); Result := FDbgInfo.FindSymbolScope(Ctx, Addr);
end; end;
@ -1955,8 +1956,11 @@ begin
// SymbolTableInfo.FindSymbolScope() // SymbolTableInfo.FindSymbolScope()
end; end;
if Result = nil then if Result = nil then begin
if Ctx = nil then
Ctx := TFpDbgSimpleLocationContext.Create(MemManager, 0, DBGPTRSIZE[Mode], AThreadId, AStackFrame);
Result := TFpDbgSymbolScope.Create(Ctx); Result := TFpDbgSymbolScope.Create(Ctx);
end;
Ctx.ReleaseReference; Ctx.ReleaseReference;
end; end;

View File

@ -130,7 +130,7 @@ type
FIdleThreadCount: integer; FIdleThreadCount: integer;
function GetRtlEvent: PRTLEvent; function GetRtlEvent: PRTLEvent;
procedure FreeRtrEvent(AnEvent: PRTLEvent); procedure FreeRtrEvent(AnEvent: PRTLEvent);
function RemoveThread(Item: TFpWorkerThread): Integer; procedure RemoveThread(Item: TFpWorkerThread);
property WantedCount: Integer read GetWantedCount; property WantedCount: Integer read GetWantedCount;
property CurrentCount: Integer read GetCurrentCount; property CurrentCount: Integer read GetCurrentCount;
property ThreadMonitor: TLazMonitor read FThreadMonitor; property ThreadMonitor: TLazMonitor read FThreadMonitor;
@ -978,7 +978,7 @@ begin
RTLEventDestroy(AnEvent); RTLEventDestroy(AnEvent);
end; end;
function TFpThreadWorkerQueue.RemoveThread(Item: TFpWorkerThread): Integer; procedure TFpThreadWorkerQueue.RemoveThread(Item: TFpWorkerThread);
begin begin
FThreadMonitor.Enter; FThreadMonitor.Enter;
try try