Explorar o código

* fix relative path writing

git-svn-id: trunk@8915 -
peter %!s(int64=18) %!d(string=hai) anos
pai
achega
e10c75ee6e
Modificáronse 1 ficheiros con 7 adicións e 8 borrados
  1. 7 8
      compiler/dbgdwarf.pas

+ 7 - 8
compiler/dbgdwarf.pas

@@ -224,7 +224,7 @@ interface
         function def_dwarf_class_struct_lab(def:tobjectdef) : tasmsymbol;
         function get_file_index(afile: tinputfile): Integer;
         procedure write_symtable_syms(st:TSymtable);
-	function clean_dwarf_path(const s:tcmdstr):tcmdstr;
+	function relative_dwarf_path(const s:tcmdstr):tcmdstr;
       protected
         // set if we should use 64bit headers (dwarf3 and up)
         _use_64bit_headers: Boolean;
@@ -626,11 +626,11 @@ implementation
                               TDebugInfoDwarf
 ****************************************************************************}
 
-    function TDebugInfoDwarf.clean_dwarf_path(const s:tcmdstr):tcmdstr;
+    function TDebugInfoDwarf.relative_dwarf_path(const s:tcmdstr):tcmdstr;
       begin
         { Make a clean path for gdb. Remove trailing / and ./ prefixes and
-	  use always a / }
-        result:=BsToSlash(ExcludeTrailingPathDelimiter(ExtractRelativePath('.',s)));
+	      use always a / }
+         result:=BsToSlash(ExcludeTrailingPathDelimiter(ExtractRelativePath(GetCurrentDir,FixFileName(ExpandFileName(s)))));
       end;
 
 
@@ -781,7 +781,6 @@ implementation
           dirname := '.'
         else
           dirname := afile.path^;
-
         diritem := TDirIndexItem(dirlist.Find(dirname));
         if diritem = nil then
           diritem := TDirIndexItem.Create(dirlist,dirname, dirlist.Count);
@@ -2281,7 +2280,7 @@ implementation
             if ditem.Name = '.' then
               Continue;
             { Write without trailing path delimiter and also don't prefix with ./ for current dir }
-            linelist.concat(tai_string.create(clean_dwarf_path(ditem.Name)+#0));
+            linelist.concat(tai_string.create(relative_dwarf_path(ditem.Name)+#0));
           end;
         linelist.concat(tai_const.create_8bit(0));
 
@@ -2404,9 +2403,9 @@ implementation
 
         { first manadatory compilation unit TAG }
         append_entry(DW_TAG_compile_unit,true,[
-          DW_AT_name,DW_FORM_string,clean_dwarf_path(FixFileName(current_module.sourcefiles.get_file(1).path^+current_module.sourcefiles.get_file(1).name^))+#0,
+          DW_AT_name,DW_FORM_string,relative_dwarf_path(current_module.sourcefiles.get_file(1).path^+current_module.sourcefiles.get_file(1).name^)+#0,
           DW_AT_producer,DW_FORM_string,'Free Pascal '+full_version_string+' '+date_string+#0,
-          DW_AT_comp_dir,DW_FORM_string,clean_dwarf_path(FixPath(GetCurrentDir,false))+#0,
+          DW_AT_comp_dir,DW_FORM_string,BSToSlash(FixPath(GetCurrentDir,false))+#0,
           DW_AT_language,DW_FORM_data1,DW_LANG_Pascal83,
           DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);