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

View File

@ -1525,7 +1525,7 @@ begin
// use these hardcoded information, and hope that FPC does not change and
// we never reach this point for a compilationunit that is not compiled by
// fpc.
if TFpDwarfFreePascalSymbolClassMapDwarf3(TypeInfo.CompilationUnit.DwarfSymbolClassMap).FCompilerVersion >= $030300{$030301} then
if TFpDwarfFreePascalSymbolClassMapDwarf3(TypeInfo.CompilationUnit.DwarfSymbolClassMap).FCompilerVersion >= $030300 { $030301 } then
CodepageOffset := AddressSize + SizeOf(Longint) + SizeOf(Word) + SizeOf(Word)
else
CodepageOffset := AddressSize * 3;

View File

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