浏览代码

* don't emit "include file search paths" for stabs since they don't exist
(and hence those directories were interpreted as source files themselves)
+ added -gostabsabsincludes option to make the compiler store absolute
paths to include files in Stabs debugging information (since no
search paths are used). This is not the default because it breaks
when only the base path of an entire source tree changes (relative
paths, which are the previous behaviour and the current default,
work fine, but the absolute paths don't anymore; this can happen
with shared network drives, and possibly with distros shipping
external .dbg files)

git-svn-id: trunk@12933 -

Jonas Maebe 16 年之前
父节点
当前提交
36668a6ec5
共有 2 个文件被更改,包括 16 次插入7 次删除
  1. 7 4
      compiler/dbgstabs.pas
  2. 9 3
      compiler/globtype.pas

+ 7 - 4
compiler/dbgstabs.pas

@@ -1512,10 +1512,13 @@ implementation
                       begin
                       begin
                         current_asmdata.getlabel(hlabel,alt_dbgfile);
                         current_asmdata.getlabel(hlabel,alt_dbgfile);
                         { emit stabs }
                         { emit stabs }
-                        list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(getcurrentdir,false))+'",'+tostr(n_includefile)+
-                                          ',0,0,'+hlabel.name),hp);
-                        list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+FixFileName(infile.name^)+'",'+tostr(n_includefile)+
-                                          ',0,0,'+hlabel.name),hp);
+                        if not(ds_stabs_abs_include_files in current_settings.debugswitches) or
+                           path_absolute(infile.path^) then
+                          list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+FixFileName(infile.name^)+'",'+tostr(n_includefile)+
+                                            ',0,0,'+hlabel.name),hp)
+                        else
+                          list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(getcurrentdir,false)+FixPath(infile.path^,false))+FixFileName(infile.name^)+'",'+tostr(n_includefile)+
+                                            ',0,0,'+hlabel.name),hp);
                         list.insertbefore(tai_label.create(hlabel),hp);
                         list.insertbefore(tai_label.create(hlabel),hp);
                         { force new line info }
                         { force new line info }
                         lastfileinfo.line:=-1;
                         lastfileinfo.line:=-1;

+ 9 - 3
compiler/globtype.pas

@@ -164,7 +164,13 @@ interface
           { enable set support in dwarf debug info, breaks gdb versions }
           { enable set support in dwarf debug info, breaks gdb versions }
           { without support for that tag (they refuse to parse the rest }
           { without support for that tag (they refuse to parse the rest }
           { of the debug information)                                   }
           { of the debug information)                                   }
-          ds_dwarf_sets
+          ds_dwarf_sets,
+          { use absolute paths for include files in stabs. Pro: gdb     }
+          { always knows full path to file. Con: doesn't work anymore   }
+          { if the include file is moved (otherwise, things still work  }
+          { if your source hierarchy is the same, but has a different   }
+          { base path)                                                  }
+          ds_stabs_abs_include_files
        );
        );
        tdebugswitches = set of tdebugswitch;
        tdebugswitches = set of tdebugswitch;
 
 
@@ -208,8 +214,8 @@ interface
          'DEVIRTCALLS','OPTVMTS','SYMBOLLIVENESS'
          'DEVIRTCALLS','OPTVMTS','SYMBOLLIVENESS'
        );
        );
 
 
-       DebugSwitchStr : array[tdebugswitch] of string[9] = ('',
-         'DWARFSETS');
+       DebugSwitchStr : array[tdebugswitch] of string[16] = ('',
+         'DWARFSETS','STABSABSINCLUDES');
 
 
        { switches being applied to all CPUs at the given level }
        { switches being applied to all CPUs at the given level }
        genericlevel1optimizerswitches = [cs_opt_level1];
        genericlevel1optimizerswitches = [cs_opt_level1];