Browse Source

* better detection of source file change while writing debug info
* set module index before replaying tokens of a generic

git-svn-id: trunk@9767 -

florian 17 năm trước cách đây
mục cha
commit
cd4b05f3de
3 tập tin đã thay đổi với 13 bổ sung9 xóa
  1. 8 7
      compiler/dbgdwarf.pas
  2. 3 2
      compiler/dbgstabs.pas
  3. 2 0
      compiler/psub.pas

+ 8 - 7
compiler/dbgdwarf.pas

@@ -1555,7 +1555,7 @@ implementation
               files for debugging and also that gdb only loads in the
               files for debugging and also that gdb only loads in the
               debug info of a particular object file once you step into
               debug info of a particular object file once you step into
               or over a procedure in it.
               or over a procedure in it.
-              
+
               To solve this, there is a tool called dsymutil which can
               To solve this, there is a tool called dsymutil which can
               extract all the dwarf info from a program's object files.
               extract all the dwarf info from a program's object files.
               This utility however performs "smart linking" on the dwarf
               This utility however performs "smart linking" on the dwarf
@@ -1563,7 +1563,7 @@ implementation
               variables' types always point to the dwarfino for a tdef
               variables' types always point to the dwarfino for a tdef
               and never to that for a typesym, this means all debug
               and never to that for a typesym, this means all debug
               entries generated for typesyms are thrown away.
               entries generated for typesyms are thrown away.
-              
+
               The problem with that is that we translate typesyms into
               The problem with that is that we translate typesyms into
               DW_TAG_typedef, and gdb's dwarf-2 reader only makes types
               DW_TAG_typedef, and gdb's dwarf-2 reader only makes types
               globally visibly if they are defined using a DW_TAG_typedef.
               globally visibly if they are defined using a DW_TAG_typedef.
@@ -1574,7 +1574,7 @@ implementation
               tdef dwarf info is still available, but you cannot typecast
               tdef dwarf info is still available, but you cannot typecast
               anything outside the declaring units because the type names
               anything outside the declaring units because the type names
               are not known there).
               are not known there).
-              
+
               The solution: if a tdef has an associated typesym, let the
               The solution: if a tdef has an associated typesym, let the
               debug label for the tdef point to a DW_TAG_typedef instead
               debug label for the tdef point to a DW_TAG_typedef instead
               of directly to the tdef itself. And don't write anything
               of directly to the tdef itself. And don't write anything
@@ -2347,7 +2347,7 @@ implementation
             if ditem.Name = '.' then
             if ditem.Name = '.' then
               Continue;
               Continue;
             { Write without trailing path delimiter and also don't prefix with ./ for current dir (already done while adding to dirlist }
             { Write without trailing path delimiter and also don't prefix with ./ for current dir (already done while adding to dirlist }
-            
+
             linelist.concat(tai_string.create(ditem.Name+#0));
             linelist.concat(tai_string.create(ditem.Name+#0));
           end;
           end;
         linelist.concat(tai_const.create_8bit(0));
         linelist.concat(tai_const.create_8bit(0));
@@ -2377,7 +2377,7 @@ implementation
 
 
         { end of debug line table }
         { end of debug line table }
         linelist.concat(tai_symbol.createname(target_asm.labelprefix+'edebug_line0',AT_DATA,0));
         linelist.concat(tai_symbol.createname(target_asm.labelprefix+'edebug_line0',AT_DATA,0));
-        
+
         flist.free;
         flist.free;
       end;
       end;
 
 
@@ -2611,9 +2611,10 @@ implementation
                 currfileinfo:=tailineinfo(hp).fileinfo;
                 currfileinfo:=tailineinfo(hp).fileinfo;
                 { file changed ? (must be before line info) }
                 { file changed ? (must be before line info) }
                 if (currfileinfo.fileindex<>0) and
                 if (currfileinfo.fileindex<>0) and
-                   (lastfileinfo.fileindex<>currfileinfo.fileindex) then
+                   ((lastfileinfo.fileindex<>currfileinfo.fileindex) or
+                    (lastfileinfo.moduleindex<>currfileinfo.moduleindex)) then
                   begin
                   begin
-                    infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
+                    infile:=get_module(currfileinfo.moduleindex).sourcefiles.get_file(currfileinfo.fileindex);
                     if assigned(infile) then
                     if assigned(infile) then
                       begin
                       begin
                         currfileidx := get_file_index(infile);
                         currfileidx := get_file_index(infile);

+ 3 - 2
compiler/dbgstabs.pas

@@ -1574,9 +1574,10 @@ implementation
                 currfileinfo:=tailineinfo(hp).fileinfo;
                 currfileinfo:=tailineinfo(hp).fileinfo;
                 { file changed ? (must be before line info) }
                 { file changed ? (must be before line info) }
                 if (currfileinfo.fileindex<>0) and
                 if (currfileinfo.fileindex<>0) and
-                   (lastfileinfo.fileindex<>currfileinfo.fileindex) then
+                   ((lastfileinfo.fileindex<>currfileinfo.fileindex) or
+                    (lastfileinfo.moduleindex<>currfileinfo.moduleindex)) then
                   begin
                   begin
-                    infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
+                    infile:=get_module(currfileinfo.moduleindex).sourcefiles.get_file(currfileinfo.fileindex);
                     if assigned(infile) then
                     if assigned(infile) then
                       begin
                       begin
                         current_asmdata.getlabel(hlabel,alt_dbgfile);
                         current_asmdata.getlabel(hlabel,alt_dbgfile);

+ 2 - 0
compiler/psub.pas

@@ -1822,6 +1822,8 @@ implementation
                  begin
                  begin
                    oldcurrent_filepos:=current_filepos;
                    oldcurrent_filepos:=current_filepos;
                    current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo;
                    current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo;
+                   { use the index the module got from the current compilation process }
+                   current_filepos.moduleindex:=hmodule.unit_index;
                    current_tokenpos:=current_filepos;
                    current_tokenpos:=current_filepos;
                    current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf);
                    current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf);
                    read_proc_body(nil,tprocdef(hp));
                    read_proc_body(nil,tprocdef(hp));