mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 12:12:47 +02:00
FPDebug: fix scanning past end of infodata / fix memleak
git-svn-id: trunk@43321 -
This commit is contained in:
parent
37802bc55d
commit
f1c0a8c344
@ -1466,21 +1466,21 @@ var
|
|||||||
NewInfo: TDwarfInformationEntry;
|
NewInfo: TDwarfInformationEntry;
|
||||||
FwdInfoPtr: Pointer;
|
FwdInfoPtr: Pointer;
|
||||||
FwdCompUint: TDwarfCompilationUnit;
|
FwdCompUint: TDwarfCompilationUnit;
|
||||||
ti: TDwarfInformationEntry;
|
ti: TDbgDwarfIdentifier;
|
||||||
begin
|
begin
|
||||||
ti := nil;
|
ti:= nil;
|
||||||
NewInfo := FInformationEntry.FindChildByTag(DW_TAG_inheritance);
|
NewInfo := FInformationEntry.FindChildByTag(DW_TAG_inheritance);
|
||||||
if (NewInfo <> nil) and
|
if (NewInfo <> nil) and
|
||||||
NewInfo.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint)
|
NewInfo.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint)
|
||||||
then begin
|
then begin
|
||||||
ti := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
NewInfo.ReleaseReference;
|
||||||
DebugLn(FPDBG_DWARF_SEARCH, ['Inherited from ', dbgs(ti.FInformationEntry, FwdCompUint) ]);
|
NewInfo := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
||||||
|
DebugLn(FPDBG_DWARF_SEARCH, ['Inherited from ', dbgs(NewInfo.FInformationEntry, FwdCompUint) ]);
|
||||||
|
ti := TDbgDwarfIdentifier.CreateSubClass('', NewInfo)
|
||||||
end;
|
end;
|
||||||
if ti = nil
|
SetTypeInfo(ti);
|
||||||
then SetTypeInfo(nil)
|
ti.ReleaseReference;
|
||||||
else SetTypeInfo(TDbgDwarfIdentifier.CreateSubClass('', ti));
|
NewInfo.ReleaseReference;
|
||||||
ReleaseRefAndNil(NewInfo);
|
|
||||||
ReleaseRefAndNil(ti);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDbgDwarfTypeIdentifierModifier }
|
{ TDbgDwarfTypeIdentifierModifier }
|
||||||
@ -3978,13 +3978,17 @@ begin
|
|||||||
Scope.Index := AStartScope.ParentIndex;
|
Scope.Index := AStartScope.ParentIndex;
|
||||||
//if not Scope2.IsValid then Exit;
|
//if not Scope2.IsValid then Exit;
|
||||||
if Scope.HasNext then Exit;
|
if Scope.HasNext then Exit;
|
||||||
|
if p >= MaxData then break;
|
||||||
Scope.CreateNextForEntry(p);
|
Scope.CreateNextForEntry(p);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ni := Scope.NextIndex;
|
ni := Scope.NextIndex;
|
||||||
if ni < 0 // not Scope.HasNext
|
if ni < 0 // not Scope.HasNext
|
||||||
then ni := Scope.CreateNextForEntry(p);
|
then begin
|
||||||
|
if p >= MaxData then break;
|
||||||
|
ni := Scope.CreateNextForEntry(p);
|
||||||
|
end;
|
||||||
// if Level = 0 then Exit;
|
// if Level = 0 then Exit;
|
||||||
if CanExit(Result) then Exit;
|
if CanExit(Result) then Exit;
|
||||||
if (Level = 0) and not (lefSearchSibling in AFlags) then Exit;
|
if (Level = 0) and not (lefSearchSibling in AFlags) then Exit;
|
||||||
@ -4083,6 +4087,7 @@ begin
|
|||||||
// we cannot have a next without a defined child
|
// we cannot have a next without a defined child
|
||||||
if Def.Children
|
if Def.Children
|
||||||
then begin
|
then begin
|
||||||
|
assert(p < MaxData, 'Got data for children');
|
||||||
ni := Scope.ChildIndex;
|
ni := Scope.ChildIndex;
|
||||||
if ni < 0 // not Scope.HasChild
|
if ni < 0 // not Scope.HasChild
|
||||||
then ni := Scope.CreateChildForEntry(p);
|
then ni := Scope.CreateChildForEntry(p);
|
||||||
@ -4094,7 +4099,10 @@ begin
|
|||||||
|
|
||||||
ni := Scope.NextIndex;
|
ni := Scope.NextIndex;
|
||||||
if ni < 0 // not Scope.HasNext
|
if ni < 0 // not Scope.HasNext
|
||||||
then ni := Scope.CreateNextForEntry(p);
|
then begin
|
||||||
|
if p >= MaxData then break;
|
||||||
|
ni := Scope.CreateNextForEntry(p);
|
||||||
|
end;
|
||||||
if CanExit(Result) then Exit;
|
if CanExit(Result) then Exit;
|
||||||
if (Level = 0) and not (lefSearchSibling in AFlags) then Exit;
|
if (Level = 0) and not (lefSearchSibling in AFlags) then Exit;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user