<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For some reason in this test the backslash is doubled.  I think we may have an inconsistency somewhere in how we print filenames.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">To get the bots happy I've updated the regexes in the test in r336832, but we should take a closer look and try to straighten this out.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-commits [mailto:llvm-commits-bounces@lists.llvm.org]
<b>On Behalf Of </b>Galina Kistanova via llvm-commits<br>
<b>Sent:</b> Wednesday, July 11, 2018 2:14 PM<br>
<b>To:</b> Jonas Devlieghere<br>
<b>Cc:</b> Artur Pilipenko via llvm-commits<br>
<b>Subject:</b> Re: [llvm] r336793 - Use debug-prefix-map for AT_NAME<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hello Jonas,<br>
<br>
This commit broke one of our builders:<br>
<a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18383">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18383</a><br>
. . . <br>
Failing Tests (1):<br>
    LLVM :: MC/ELF/debug-prefix-map.s<br>
<br>
Please have a look?<br>
The builder was already red and did not send notifications.<br>
<br>
Also at least one more builder is affected:<br>
<a href="http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10902">http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10902</a><br>
<br>
Thanks<br>
<br>
Galina<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Jul 11, 2018 at 5:30 AM, Jonas Devlieghere via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Author: jdevlieghere<br>
Date: Wed Jul 11 05:30:35 2018<br>
New Revision: 336793<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=336793&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=336793&view=rev</a><br>
Log:<br>
Use debug-prefix-map for AT_NAME<br>
<br>
AT_NAME was being emitted before the directory paths were remapped. This<br>
ensures that all paths are remapped before anything is emitted.<br>
<br>
An additional test case has been added.<br>
<br>
Note that this only works if the replacement string is an absolute path.<br>
If not, then AT_decl_file believes the new path is a relative path, and<br>
joins that path with the compilation directory. I do not know of a good<br>
way to resolve this.<br>
<br>
Patch by: Siddhartha Bagaria (starsid)<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D49169" target="_blank">
https://reviews.llvm.org/D49169</a><br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/MC/MCContext.h<br>
    llvm/trunk/include/llvm/MC/MCDwarf.h<br>
    llvm/trunk/lib/MC/MCContext.cpp<br>
    llvm/trunk/lib/MC/MCDwarf.cpp<br>
    llvm/trunk/lib/MC/MCObjectStreamer.cpp<br>
    llvm/trunk/test/MC/ELF/debug-prefix-map.s<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCContext.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCContext.h Wed Jul 11 05:30:35 2018<br>
@@ -502,11 +502,8 @@ namespace llvm {<br>
     /// Add an entry to the debug prefix map.<br>
     void addDebugPrefixMapEntry(const std::string &From, const std::string &To);<br>
<br>
-    // Remaps the given path in-place as per the debug prefix map.<br>
-    void RemapDebugPath(std::string *Path);<br>
-<br>
-    // Remaps the compilation dir as per the debug prefix map.<br>
-    void RemapCompilationDir();<br>
+    // Remaps all debug directory paths in-place as per the debug prefix map.<br>
+    void RemapDebugPaths();<br>
<br>
     /// Get the main file name for use in error messages and debug<br>
     /// info. This can be set to ensure we've got the correct file name<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCDwarf.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCDwarf.h Wed Jul 11 05:30:35 2018<br>
@@ -301,8 +301,6 @@ public:<br>
                                FileNumber));<br>
   }<br>
<br>
-  void RemapDwarfDirs(MCContext &Context);<br>
-<br>
   void setRootFile(StringRef Directory, StringRef FileName,<br>
                    MD5::MD5Result *Checksum, Optional<StringRef> Source) {<br>
     Header.CompilationDir = Directory;<br>
<br>
Modified: llvm/trunk/lib/MC/MCContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCContext.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCContext.cpp Wed Jul 11 05:30:35 2018<br>
@@ -540,19 +540,26 @@ void MCContext::addDebugPrefixMapEntry(c<br>
   DebugPrefixMap.insert(std::make_pair(From, To));<br>
 }<br>
<br>
-void MCContext::RemapDebugPath(std::string *Path) {<br>
-  for (const auto &Entry : DebugPrefixMap)<br>
-    if (StringRef(*Path).startswith(Entry.first)) {<br>
-      std::string RemappedPath =<br>
-          (Twine(Entry.second) + Path->substr(Entry.first.size())).str();<br>
-      Path->swap(RemappedPath);<br>
-    }<br>
-}<br>
+void MCContext::RemapDebugPaths() {<br>
+  const auto &DebugPrefixMap = this->DebugPrefixMap;<br>
+  const auto RemapDebugPath = [&DebugPrefixMap](std::string &Path) {<br>
+    for (const auto &Entry : DebugPrefixMap)<br>
+      if (StringRef(Path).startswith(Entry.first)) {<br>
+        std::string RemappedPath =<br>
+            (Twine(Entry.second) + Path.substr(Entry.first.size())).str();<br>
+        Path.swap(RemappedPath);<br>
+      }<br>
+  };<br>
<br>
-void MCContext::RemapCompilationDir() {<br>
+  // Remap compilation directory.<br>
   std::string CompDir = CompilationDir.str();<br>
-  RemapDebugPath(&CompDir);<br>
+  RemapDebugPath(CompDir);<br>
   CompilationDir = CompDir;<br>
+<br>
+  // Remap MCDwarfDirs in all compilation units.<br>
+  for (auto &CUIDTablePair : MCDwarfLineTablesCUMap)<br>
+    for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs())<br>
+      RemapDebugPath(Dir);<br>
 }<br>
<br>
 //===----------------------------------------------------------------------===//<br>
<br>
Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Jul 11 05:30:35 2018<br>
@@ -251,9 +251,7 @@ void MCDwarfLineTable::Emit(MCObjectStre<br>
<br>
   // Handle the rest of the Compile Units.<br>
   for (const auto &CUIDTablePair : LineTables) {<br>
-    auto &LineTable = context.getMCDwarfLineTable(CUIDTablePair.first);<br>
-    LineTable.RemapDwarfDirs(MCOS->getContext());<br>
-    LineTable.EmitCU(MCOS, Params, LineStr);<br>
+    CUIDTablePair.second.EmitCU(MCOS, Params, LineStr);<br>
   }<br>
<br>
   if (LineStr)<br>
@@ -634,11 +632,6 @@ MCDwarfLineTableHeader::tryGetFile(Strin<br>
   return FileNumber;<br>
 }<br>
<br>
-void MCDwarfLineTable::RemapDwarfDirs(MCContext &Context) {<br>
-  for (auto &Dir : Header.MCDwarfDirs)<br>
-    Context.RemapDebugPath(&Dir);<br>
-}<br>
-<br>
 /// Utility function to emit the encoding to a streamer.<br>
 void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,<br>
                            int64_t LineDelta, uint64_t AddrDelta) {<br>
<br>
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed Jul 11 05:30:35 2018<br>
@@ -661,8 +661,7 @@ void MCObjectStreamer::EmitFileDirective<br>
 }<br>
<br>
 void MCObjectStreamer::FinishImpl() {<br>
-  // Remap the compilation directory before emitting.<br>
-  getContext().RemapCompilationDir();<br>
+  getContext().RemapDebugPaths();<br>
<br>
   // If we are generating dwarf for assembly source files dump out the sections.<br>
   if (getContext().getGenDwarfForAssembly())<br>
<br>
Modified: llvm/trunk/test/MC/ELF/debug-prefix-map.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/debug-prefix-map.s?rev=336793&r1=336792&r2=336793&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/debug-prefix-map.s?rev=336793&r1=336792&r2=336793&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ELF/debug-prefix-map.s (original)<br>
+++ llvm/trunk/test/MC/ELF/debug-prefix-map.s Wed Jul 11 05:30:35 2018<br>
@@ -4,9 +4,13 @@<br>
<br>
 // RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o out.o<br>
 // RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=NO_MAP %s<br>
+<br>
 // RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o out.o -fdebug-prefix-map=%t.foo=src_root<br>
 // RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=MAP --implicit-check-not ".foo" %s<br>
<br>
+// RUN: llvm-mc -triple=x86_64-linux-unknown -g %t.foo/src.s -filetype=obj -o out.o -fdebug-prefix-map=%t.foo=/src_root<br>
+// RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=MAP_ABS --implicit-check-not ".foo" %s<br>
+<br>
 f:<br>
   nop<br>
<br>
@@ -15,3 +19,7 @@ f:<br>
 // MAP: DW_AT_name [DW_FORM_string] ("src.s")<br>
 // MAP: DW_AT_comp_dir [DW_FORM_string] ("src_root")<br>
 // MAP: DW_AT_decl_file [DW_FORM_data4] ("src_root{{(/|\\)}}src.s")<br>
+<br>
+// MAP_ABS: DW_AT_name [DW_FORM_string] ("{{/|\\}}src_root{{(/|\\)}}src.s")<br>
+// MAP_ABS: DW_AT_comp_dir [DW_FORM_string] ("{{/|\\}}src_root")<br>
+// MAP_ABS: DW_AT_decl_file [DW_FORM_data4] ("{{/|\\}}src_root{{(/|\\)}}src.s")<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>