* debuginfo initialized per unit

git-svn-id: trunk@8918 -
This commit is contained in:
peter 2007-10-23 18:19:17 +00:00
parent 17a5249bac
commit a724d80e81
6 changed files with 22 additions and 31 deletions

View File

@ -157,8 +157,6 @@ interface
Procedure OnlyAsm;
procedure RegisterAssembler(const r:tasminfo;c:TAssemblerClass);
procedure InitAssembler;
procedure DoneAssembler;
Implementation
@ -1468,14 +1466,4 @@ Implementation
CAssembler[t]:=c;
end;
procedure InitAssembler;
begin
end;
procedure DoneAssembler;
begin
end;
end.

View File

@ -144,9 +144,7 @@ begin
DoneParser;
DoneImport;
DoneExport;
DoneDebuginfo;
DoneLinker;
DoneAssembler;
DoneAsm;
end;
{ Free memory for the others }
@ -186,8 +184,6 @@ begin
InitImport;
InitExport;
InitLinker;
InitAssembler;
InitDebugInfo;
InitAsm;
CompilerInitedAfterArgs:=true;
end;

View File

@ -53,10 +53,10 @@ interface
var
CDebugInfo : array[tdbg] of TDebugInfoClass;
DebugInfo : TDebugInfo;
current_debuginfo : tdebuginfo;
procedure InitDebugInfo;
procedure DoneDebugInfo;
procedure InitDebugInfo(hp:tmodule);
procedure DoneDebugInfo(hp:tmodule);
procedure RegisterDebugInfo(const r:tdbginfo;c:TDebugInfoClass);
@ -156,23 +156,23 @@ implementation
end;
procedure InitDebugInfo;
procedure InitDebugInfo(hp:tmodule);
begin
if not assigned(CDebugInfo[target_dbg.id]) then
begin
Comment(V_Fatal,'cg_f_debuginfo_output_not_supported');
exit;
end;
DebugInfo:=CDebugInfo[target_dbg.id].Create;
hp.DebugInfo:=CDebugInfo[target_dbg.id].Create;
end;
procedure DoneDebugInfo;
procedure DoneDebugInfo(hp:tmodule);
begin
if assigned(DebugInfo) then
if assigned(hp.DebugInfo) then
begin
DebugInfo.Free;
DebugInfo:=nil;
hp.DebugInfo.Free;
hp.DebugInfo:=nil;
end;
end;

View File

@ -133,6 +133,7 @@ interface
procinfo : TObject; { current procedure being compiled }
asmdata : TObject; { Assembler data }
asmprefix : pshortstring; { prefix for the smartlink asmfiles }
debuginfo : TObject;
loaded_from : tmodule;
_exports : tlinkedlist;
dllscannerinputlist : TFPHashList;
@ -210,7 +211,7 @@ implementation
uses
SysUtils,globals,
verbose,systems,
scanner,ppu,
scanner,ppu,dbgbase,
procinfo;
{$ifdef MEMDEBUG}
@ -252,6 +253,7 @@ implementation
if assigned(current_module) then
begin
current_asmdata:=tasmdata(current_module.asmdata);
current_debuginfo:=tdebuginfo(current_module.debuginfo);
{ restore scanner and file positions }
current_scanner:=tscannerfile(current_module.scanner);
if assigned(current_scanner) then
@ -270,6 +272,7 @@ implementation
begin
current_asmdata:=nil;
current_scanner:=nil;
current_debuginfo:=nil;
end;
end;
@ -501,6 +504,7 @@ implementation
_exports:=TLinkedList.Create;
dllscannerinputlist:=TFPHashList.Create;
asmdata:=TAsmData.create(realmodulename^);
InitDebugInfo(self);
end;
@ -630,6 +634,7 @@ implementation
asmdata.free;
asmdata:=nil;
end;
DoneDebugInfo(self);
if assigned(globalsymtable) then
begin
globalsymtable.free;
@ -675,6 +680,8 @@ implementation
sourcefiles.free;
sourcefiles:=tinputfilemanager.create;
asmdata:=TAsmData.create(realmodulename^);
DoneDebugInfo(self);
InitDebugInfo(self);
_exports.free;
_exports:=tlinkedlist.create;
dllscannerinputlist.free;

View File

@ -92,7 +92,7 @@ implementation
to insert n_sourcefile lines }
if (cs_debuginfo in current_settings.moduleswitches) or
(cs_use_lineinfo in current_settings.globalswitches) then
debuginfo.insertmoduleinfo;
current_debuginfo.insertmoduleinfo;
{ create the .s file and assemble it }
GenerateAsm(false);
@ -1123,7 +1123,7 @@ implementation
{ generate debuginfo }
if (cs_debuginfo in current_settings.moduleswitches) then
debuginfo.inserttypeinfo;
current_debuginfo.inserttypeinfo;
{ generate imports }
if current_module.ImportLibraryList.Count>0 then
@ -1451,14 +1451,14 @@ implementation
{ generate debuginfo }
if (cs_debuginfo in current_settings.moduleswitches) then
debuginfo.inserttypeinfo;
current_debuginfo.inserttypeinfo;
if islibrary or (target_info.system in system_unit_program_exports) then
exportlib.generatelib;
{ Reference all DEBUGINFO sections from the main .fpc section }
if (cs_debuginfo in current_settings.moduleswitches) then
debuginfo.referencesections(current_asmdata.asmlists[al_procedures]);
current_debuginfo.referencesections(current_asmdata.asmlists[al_procedures]);
{ Resource strings }
GenerateResourceStrings;

View File

@ -1112,7 +1112,7 @@ implementation
{ insert line debuginfo }
if (cs_debuginfo in current_settings.moduleswitches) or
(cs_use_lineinfo in current_settings.globalswitches) then
debuginfo.insertlineinfo(aktproccode);
current_debuginfo.insertlineinfo(aktproccode);
{ add the procedure to the al_procedures }
maybe_new_object_file(current_asmdata.asmlists[al_procedures]);