浏览代码

* always include lineno after fileswitch. valgrind requires this

peter 23 年之前
父节点
当前提交
477bc04c6a
共有 2 个文件被更改,包括 42 次插入27 次删除
  1. 9 4
      compiler/aggas.pas
  2. 33 23
      compiler/assemble.pas

+ 9 - 4
compiler/aggas.pas

@@ -254,6 +254,8 @@ var
                   tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                   tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                 AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
                 AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
                 inc(includecount);
                 inc(includecount);
+                { force new line info }
+                stabslastfileinfo.line:=-1;
               end;
               end;
            end;
            end;
         { line changed ? }
         { line changed ? }
@@ -496,7 +498,7 @@ var
                 AsmWriteLn(target_asm.comment+target_asm.comment+double2str(tai_real_64bit(hp).value));
                 AsmWriteLn(target_asm.comment+target_asm.comment+double2str(tai_real_64bit(hp).value));
                d:=tai_real_64bit(hp).value;
                d:=tai_real_64bit(hp).value;
                { swap the values to correct endian if required }
                { swap the values to correct endian if required }
-{$ifdef fpc}               
+{$ifdef fpc}
                if source_info.endian <> target_info.endian then
                if source_info.endian <> target_info.endian then
                  swap64bitarray(t64bitarray(d));
                  swap64bitarray(t64bitarray(d));
 {$endif}
 {$endif}
@@ -519,7 +521,7 @@ var
                { swap the values to correct endian if required }
                { swap the values to correct endian if required }
                if source_info.endian <> target_info.endian then
                if source_info.endian <> target_info.endian then
                  swap32bitarray(t32bitarray(sin));
                  swap32bitarray(t32bitarray(sin));
-{$endif}                 
+{$endif}
                AsmWrite(#9'.byte'#9);
                AsmWrite(#9'.byte'#9);
                for i:=0 to 3 do
                for i:=0 to 3 do
                 begin
                 begin
@@ -544,7 +546,7 @@ var
                { swap the values to correct endian if required }
                { swap the values to correct endian if required }
                if source_info.endian <> target_info.endian then
                if source_info.endian <> target_info.endian then
                  swap64bitarray(t64bitarray(co));
                  swap64bitarray(t64bitarray(co));
-{$endif}                 
+{$endif}
                for i:=0 to 7 do
                for i:=0 to 7 do
                 begin
                 begin
                   if i<>0 then
                   if i<>0 then
@@ -809,7 +811,10 @@ var
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2002-10-05 12:43:23  carl
+  Revision 1.14  2002-10-30 21:01:14  peter
+    * always include lineno after fileswitch. valgrind requires this
+
+  Revision 1.13  2002/10/05 12:43:23  carl
     * fixes for Delphi 6 compilation
     * fixes for Delphi 6 compilation
      (warning : Some features do not work under Delphi)
      (warning : Some features do not work under Delphi)
 
 

+ 33 - 23
compiler/assemble.pas

@@ -801,33 +801,40 @@ Implementation
         if not ((cs_debuginfo in aktmoduleswitches) or
         if not ((cs_debuginfo in aktmoduleswitches) or
            (cs_gdb_lineinfo in aktglobalswitches)) then
            (cs_gdb_lineinfo in aktglobalswitches)) then
          exit;
          exit;
-      { file changed ? (must be before line info) }
+
+        { file changed ? (must be before line info) }
         if (fileinfo.fileindex<>0) and
         if (fileinfo.fileindex<>0) and
            (stabslastfileinfo.fileindex<>fileinfo.fileindex) then
            (stabslastfileinfo.fileindex<>fileinfo.fileindex) then
          begin
          begin
            infile:=current_module.sourcefiles.get_file(fileinfo.fileindex);
            infile:=current_module.sourcefiles.get_file(fileinfo.fileindex);
-           if includecount=0 then
-            curr_n:=n_sourcefile
-           else
-            curr_n:=n_includefile;
-           { get symbol for this includefile }
-           hp:=objectlibrary.newasmsymboltype('Ltext'+ToStr(IncludeCount),AB_LOCAL,AT_FUNCTION);
-           if currpass=1 then
-             begin
-                hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
-                objectlibrary.UsedAsmSymbolListInsert(hp);
-             end
-           else
-             objectdata.writesymbol(hp);
-           { emit stabs }
-           if (infile.path^<>'') then
-             EmitStabs('"'+lower(BsToSlash(FixPath(infile.path^,false)))+'",'+tostr(curr_n)+
-               ',0,0,Ltext'+ToStr(IncludeCount));
-           EmitStabs('"'+lower(FixFileName(infile.name^))+'",'+tostr(curr_n)+
-             ',0,0,Ltext'+ToStr(IncludeCount));
-           inc(includecount);
+           if assigned(infile) then
+            begin
+              if includecount=0 then
+               curr_n:=n_sourcefile
+              else
+               curr_n:=n_includefile;
+              { get symbol for this includefile }
+              hp:=objectlibrary.newasmsymboltype('Ltext'+ToStr(IncludeCount),AB_LOCAL,AT_FUNCTION);
+              if currpass=1 then
+                begin
+                  hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
+                  objectlibrary.UsedAsmSymbolListInsert(hp);
+                end
+              else
+                objectdata.writesymbol(hp);
+              { emit stabs }
+              if (infile.path^<>'') then
+                EmitStabs('"'+lower(BsToSlash(FixPath(infile.path^,false)))+'",'+tostr(curr_n)+
+                          ',0,0,Ltext'+ToStr(IncludeCount));
+              EmitStabs('"'+lower(FixFileName(infile.name^))+'",'+tostr(curr_n)+
+                        ',0,0,Ltext'+ToStr(IncludeCount));
+              inc(includecount);
+              { force new line info }
+              stabslastfileinfo.line:=-1;
+            end;
          end;
          end;
-      { line changed ? }
+
+        { line changed ? }
         if (stabslastfileinfo.line<>fileinfo.line) and (fileinfo.line<>0) then
         if (stabslastfileinfo.line<>fileinfo.line) and (fileinfo.line<>0) then
           emitlineinfostabs(n_line,fileinfo.line);
           emitlineinfostabs(n_line,fileinfo.line);
         stabslastfileinfo:=fileinfo;
         stabslastfileinfo:=fileinfo;
@@ -1608,7 +1615,10 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.44  2002-09-05 19:29:42  peter
+  Revision 1.45  2002-10-30 21:01:14  peter
+    * always include lineno after fileswitch. valgrind requires this
+
+  Revision 1.44  2002/09/05 19:29:42  peter
     * memdebug enhancements
     * memdebug enhancements
 
 
   Revision 1.43  2002/08/20 16:55:38  peter
   Revision 1.43  2002/08/20 16:55:38  peter