mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 21:09:24 +02:00
* Avoid having current_debuginfo pointing to freed memory
git-svn-id: trunk@20549 -
This commit is contained in:
parent
040e67772a
commit
813ebf08e3
@ -94,8 +94,8 @@ interface
|
||||
CDebugInfo : array[tdbg] of TDebugInfoClass;
|
||||
current_debuginfo : tdebuginfo;
|
||||
|
||||
procedure InitDebugInfo(hp:tmodule);
|
||||
procedure DoneDebugInfo(hp:tmodule);
|
||||
procedure InitDebugInfo(hp:tmodule; restore_current_debuginfo : boolean);
|
||||
procedure DoneDebugInfo(hp:tmodule;var current_debuginfo_reset : boolean);
|
||||
procedure RegisterDebugInfo(const r:tdbginfo;c:TDebugInfoClass);
|
||||
|
||||
|
||||
@ -579,7 +579,7 @@ implementation
|
||||
Init / Done
|
||||
****************************************************************************}
|
||||
|
||||
procedure InitDebugInfo(hp:tmodule);
|
||||
procedure InitDebugInfo(hp:tmodule; restore_current_debuginfo : boolean);
|
||||
begin
|
||||
if not assigned(CDebugInfo[target_dbg.id]) then
|
||||
begin
|
||||
@ -587,13 +587,26 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
hp.DebugInfo:=CDebugInfo[target_dbg.id].Create;
|
||||
if restore_current_debuginfo then
|
||||
begin
|
||||
if current_debuginfo=nil then
|
||||
current_debuginfo:=tdebuginfo(hp.DebugInfo)
|
||||
else
|
||||
internalerror(2012032101);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure DoneDebugInfo(hp:tmodule);
|
||||
procedure DoneDebugInfo(hp:tmodule;var current_debuginfo_reset : boolean);
|
||||
begin
|
||||
current_debuginfo_reset:=false;
|
||||
if assigned(hp.DebugInfo) then
|
||||
begin
|
||||
if hp.DebugInfo=current_debuginfo then
|
||||
begin
|
||||
current_debuginfo:=nil;
|
||||
current_debuginfo_reset:=true;
|
||||
end;
|
||||
hp.DebugInfo.Free;
|
||||
hp.DebugInfo:=nil;
|
||||
end;
|
||||
|
@ -552,13 +552,14 @@ implementation
|
||||
_exports:=TLinkedList.Create;
|
||||
dllscannerinputlist:=TFPHashList.Create;
|
||||
asmdata:=TAsmData.create(realmodulename^);
|
||||
InitDebugInfo(self);
|
||||
InitDebugInfo(self,false);
|
||||
end;
|
||||
|
||||
|
||||
destructor tmodule.Destroy;
|
||||
var
|
||||
i : longint;
|
||||
current_debuginfo_reset : boolean;
|
||||
begin
|
||||
if assigned(unitmap) then
|
||||
freemem(unitmap);
|
||||
@ -598,7 +599,7 @@ implementation
|
||||
{ release procinfo tree }
|
||||
tprocinfo(procinfo).destroy_tree;
|
||||
end;
|
||||
DoneDebugInfo(self);
|
||||
DoneDebugInfo(self,current_debuginfo_reset);
|
||||
used_units.free;
|
||||
dependent_units.free;
|
||||
resourcefiles.Free;
|
||||
@ -654,6 +655,7 @@ implementation
|
||||
procedure tmodule.reset;
|
||||
var
|
||||
i : longint;
|
||||
current_debuginfo_reset : boolean;
|
||||
begin
|
||||
if assigned(scanner) then
|
||||
begin
|
||||
@ -683,7 +685,7 @@ implementation
|
||||
asmdata.free;
|
||||
asmdata:=nil;
|
||||
end;
|
||||
DoneDebugInfo(self);
|
||||
DoneDebugInfo(self,current_debuginfo_reset);
|
||||
globalsymtable.free;
|
||||
globalsymtable:=nil;
|
||||
localsymtable.free;
|
||||
@ -721,7 +723,7 @@ implementation
|
||||
sourcefiles.free;
|
||||
sourcefiles:=tinputfilemanager.create;
|
||||
asmdata:=TAsmData.create(realmodulename^);
|
||||
InitDebugInfo(self);
|
||||
InitDebugInfo(self,current_debuginfo_reset);
|
||||
_exports.free;
|
||||
_exports:=tlinkedlist.create;
|
||||
dllscannerinputlist.free;
|
||||
|
Loading…
Reference in New Issue
Block a user