Quellcode durchsuchen

Merged revisions 8918,8920,8927 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r8918 | peter | 2007-10-23 20:19:17 +0200 (Tue, 23 Oct 2007) | 2 lines

* debuginfo initialized per unit
........
r8920 | peter | 2007-10-23 23:50:10 +0200 (Tue, 23 Oct 2007) | 3 lines

* store defstates in ppu, this field keeps the info what
is generated for a def so it can be reused, e.g. dwarf debuginfo
........
r8927 | peter | 2007-10-25 20:13:03 +0200 (Thu, 25 Oct 2007) | 2 lines

* defstates doesn't affect any crc
........

git-svn-id: branches/fixes_2_2@10188 -

peter vor 17 Jahren
Ursprung
Commit
7a1298fab8

+ 0 - 12
compiler/assemble.pas

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

+ 0 - 4
compiler/compiler.pas

@@ -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;

+ 9 - 9
compiler/dbgbase.pas

@@ -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;
 

+ 8 - 1
compiler/fmodule.pas

@@ -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
       SysUtils,
       GlobType,
       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;

+ 4 - 4
compiler/pmodules.pas

@@ -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);
@@ -1126,7 +1126,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
@@ -1454,14 +1454,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;

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion=79;
+  CurrentPPUVersion=80;
 
 { buffer sizes }
   maxentrysize = 1024;

+ 1 - 1
compiler/psub.pas

@@ -1067,7 +1067,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]);

+ 5 - 3
compiler/symdef.pas

@@ -891,6 +891,7 @@ implementation
          { load }
          ppufile.getderef(typesymderef);
          ppufile.getsmallset(defoptions);
+         ppufile.getsmallset(defstates);
          if df_generic in defoptions then
            begin
              sizeleft:=ppufile.getlongint;
@@ -954,10 +955,11 @@ implementation
         ppufile.putlongint(DefId);
         ppufile.putderef(typesymderef);
         ppufile.putsmallset(defoptions);
+        oldintfcrc:=ppufile.do_crc;
+        ppufile.do_crc:=false;
+        ppufile.putsmallset(defstates);
         if df_generic in defoptions then
           begin
-            oldintfcrc:=ppufile.do_interface_crc;
-            ppufile.do_interface_crc:=false;
             if assigned(generictokenbuf) then
               begin
                 sizeleft:=generictokenbuf.size;
@@ -976,8 +978,8 @@ implementation
                 ppufile.putdata(buf,i);
                 dec(sizeleft,i);
               end;
-            ppufile.do_interface_crc:=oldintfcrc;
           end;
+        ppufile.do_crc:=oldintfcrc;
         if df_specialization in defoptions then
           ppufile.putderef(genericdefderef);
       end;

+ 23 - 4
compiler/utils/ppudump.pp

@@ -772,6 +772,7 @@ const
   );
 var
   defoptions : tdefoptions;
+  defstates  : tdefstates;
   i      : longint;
   first  : boolean;
   tokenbufsize : longint;
@@ -798,8 +799,22 @@ begin
     end;
   writeln;
 
-  if df_unique in defoptions then
-    writeln  (space,'      Unique type symbol');
+  write  (space,'        DefStates : ');
+  ppufile.getsmallset(defstates);
+  if defstates<>[] then
+    begin
+      first:=true;
+      for i:=1to defstateinfos do
+       if (defstate[i].mask in defstates) then
+        begin
+          if first then
+            first:=false
+          else
+            write(', ');
+          write(defstate[i].str);
+        end;
+    end;
+  writeln;
 
   if df_generic in defoptions then
     begin
@@ -1201,6 +1216,7 @@ begin
   readcommonsym(s);
   writeln(space,'         Spez : ',Varspez2Str(ppufile.getbyte));
   writeln(space,'      Regable : ',Varregable2Str(ppufile.getbyte));
+  writeln(space,'   Addr Taken : ',(ppufile.getbyte<>0));
   write  (space,'     Var Type : ');
   readderef;
   ppufile.getsmallset(varoptions);
@@ -1436,7 +1452,7 @@ begin
                  begin
                    write  (space,'  OrdinalType : ');
                    readderef;
-                   writeln(space,'        Value : ',getint64);
+                   writeln(space,'        Value : ',constexp.tostr(getexprint));
                  end;
                constpointer :
                  begin
@@ -1894,7 +1910,10 @@ begin
            end;
 
          ibformaldef :
-           readcommondef('Generic definition (void-typ)');
+           begin
+             readcommondef('Generic definition (void-typ)');
+             writeln(space,'         Is Typed : ',(getbyte<>0));
+           end;
 
          ibundefineddef :
            readcommondef('Undefined definition (generic parameter)');