Browse Source

* debuginfo initialized per unit

git-svn-id: trunk@8918 -
peter 18 years ago
parent
commit
a724d80e81
6 changed files with 22 additions and 31 deletions
  1. 0 12
      compiler/assemble.pas
  2. 0 4
      compiler/compiler.pas
  3. 9 9
      compiler/dbgbase.pas
  4. 8 1
      compiler/fmodule.pas
  5. 4 4
      compiler/pmodules.pas
  6. 1 1
      compiler/psub.pas

+ 0 - 12
compiler/assemble.pas

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

+ 0 - 4
compiler/compiler.pas

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

+ 9 - 9
compiler/dbgbase.pas

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

+ 8 - 1
compiler/fmodule.pas

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

+ 4 - 4
compiler/pmodules.pas

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

+ 1 - 1
compiler/psub.pas

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