mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 00:39:26 +02:00
FPDebug: mem leak / fix wrong release
git-svn-id: trunk@43155 -
This commit is contained in:
parent
11680d18c7
commit
3db67cfb00
@ -243,7 +243,7 @@ type
|
|||||||
|
|
||||||
{ TDwarfInformationEntry }
|
{ TDwarfInformationEntry }
|
||||||
|
|
||||||
TDwarfInformationEntry = class
|
TDwarfInformationEntry = class(TRefCountedObject)
|
||||||
private
|
private
|
||||||
FCompUnit: TDwarfCompilationUnit;
|
FCompUnit: TDwarfCompilationUnit;
|
||||||
FInformationEntry: Pointer; // pointer to the LEB128 Abbrev at the start of an Information entry in debug_info
|
FInformationEntry: Pointer; // pointer to the LEB128 Abbrev at the start of an Information entry in debug_info
|
||||||
@ -1178,6 +1178,7 @@ end;
|
|||||||
constructor TDwarfInformationEntry.Create(ACompUnit: TDwarfCompilationUnit;
|
constructor TDwarfInformationEntry.Create(ACompUnit: TDwarfCompilationUnit;
|
||||||
AnInformationEntry: Pointer);
|
AnInformationEntry: Pointer);
|
||||||
begin
|
begin
|
||||||
|
AddReference;
|
||||||
FCompUnit := ACompUnit;
|
FCompUnit := ACompUnit;
|
||||||
FInformationEntry := AnInformationEntry;
|
FInformationEntry := AnInformationEntry;
|
||||||
FScope.Init(@FCompUnit.FScopeList);
|
FScope.Init(@FCompUnit.FScopeList);
|
||||||
@ -1186,6 +1187,7 @@ end;
|
|||||||
constructor TDwarfInformationEntry.Create(ACompUnit: TDwarfCompilationUnit;
|
constructor TDwarfInformationEntry.Create(ACompUnit: TDwarfCompilationUnit;
|
||||||
AScope: TDwarfScopeInfo);
|
AScope: TDwarfScopeInfo);
|
||||||
begin
|
begin
|
||||||
|
AddReference;
|
||||||
FCompUnit := ACompUnit;
|
FCompUnit := ACompUnit;
|
||||||
FScope := AScope;
|
FScope := AScope;
|
||||||
ScopeChanged;
|
ScopeChanged;
|
||||||
@ -1357,8 +1359,10 @@ begin
|
|||||||
if FInformationEntry.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint) then begin
|
if FInformationEntry.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint) then begin
|
||||||
InfoEntry := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
InfoEntry := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
||||||
InfoEntry.SearchScope;
|
InfoEntry.SearchScope;
|
||||||
DebugLn(['!!!! TYPE !!! ', dbgs(InfoEntry.FScope, FwdCompUint), DbgsDump(InfoEntry.FScope, FwdCompUint) ]);
|
//DebugLn(['!!!! TYPE !!! ', dbgs(InfoEntry.FScope, FwdCompUint), DbgsDump(InfoEntry.FScope, FwdCompUint) ]);
|
||||||
|
DebugLn(['!!!! TYPE !!! ', dbgs(InfoEntry.FScope, FwdCompUint) ]);
|
||||||
FTypeInfo := TDbgDwarfTypeIdentifier.Create('', InfoEntry);
|
FTypeInfo := TDbgDwarfTypeIdentifier.Create('', InfoEntry);
|
||||||
|
InfoEntry.ReleaseReference;
|
||||||
Result := FTypeInfo;
|
Result := FTypeInfo;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1372,13 +1376,14 @@ begin
|
|||||||
FIdentifierName := AName;
|
FIdentifierName := AName;
|
||||||
FCU := AnInformationEntry.CompUnit;
|
FCU := AnInformationEntry.CompUnit;
|
||||||
FInformationEntry := AnInformationEntry;
|
FInformationEntry := AnInformationEntry;
|
||||||
|
FInformationEntry.AddReference;
|
||||||
inherited Create('', skNone, 0);
|
inherited Create('', skNone, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TDbgDwarfIdentifier.Destroy;
|
destructor TDbgDwarfIdentifier.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
FreeAndNil(FInformationEntry);
|
ReleaseRefAndNil(FInformationEntry);
|
||||||
ReleaseRefAndNil(FTypeInfo);
|
ReleaseRefAndNil(FTypeInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2406,7 +2411,8 @@ begin
|
|||||||
if UpperCase(EntryName) = UpperCase(AName) then begin
|
if UpperCase(EntryName) = UpperCase(AName) then begin
|
||||||
// TODO: check DW_AT_start_scope;
|
// TODO: check DW_AT_start_scope;
|
||||||
Result := DbgSymbolClassForTag(InfoEntry.Abbrev.tag).Create(AName, InfoEntry);
|
Result := DbgSymbolClassForTag(InfoEntry.Abbrev.tag).Create(AName, InfoEntry);
|
||||||
DebugLn(['!!!! FOUND !!! ', dbgs(InfoEntry.FScope, CU), DbgsDump(InfoEntry.FScope, CU) ]);
|
//DebugLn(['!!!! FOUND !!! ', dbgs(InfoEntry.FScope, CU), DbgsDump(InfoEntry.FScope, CU) ]);
|
||||||
|
DebugLn(['!!!! FOUND !!! ', dbgs(InfoEntry.FScope, CU)]);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2422,17 +2428,16 @@ begin
|
|||||||
|
|
||||||
// unitname?
|
// unitname?
|
||||||
|
|
||||||
// debugln:
|
//// debugln:
|
||||||
if Result <> nil then begin
|
// if Result <> nil then begin
|
||||||
TDbgDwarfIdentifier(Result).TypeInfo; // debugln...
|
// TDbgDwarfIdentifier(Result).TypeInfo; // debugln...
|
||||||
if TDbgDwarfIdentifier(Result).TypeInfo <> nil then TDbgDwarfIdentifier(Result).TypeInfo.TypeInfo;
|
// if TDbgDwarfIdentifier(Result).TypeInfo <> nil then TDbgDwarfIdentifier(Result).TypeInfo.TypeInfo;
|
||||||
end;
|
// end;
|
||||||
// end debugln
|
//// end debugln
|
||||||
|
|
||||||
|
|
||||||
finally
|
finally
|
||||||
ReleaseRefAndNil(SubRoutine);
|
ReleaseRefAndNil(SubRoutine);
|
||||||
if Result = nil then
|
|
||||||
ReleaseRefAndNil(InfoEntry);
|
ReleaseRefAndNil(InfoEntry);
|
||||||
ReleaseRefAndNil(InfoEntry2);
|
ReleaseRefAndNil(InfoEntry2);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user