<div dir="ltr">Hello Jonas,<br><br>This commit broke tests at least on couple of our builders:<br><br><a href="http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/8803">http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/8803</a><br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast</a><br><br>. . .<br>Failing Tests (1):<br>    LLVM :: tools/dsymutil/X86/papertrail-warnings.test<br><br>Please have a look?<br><br>Thanks<br><br>Galina<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 2, 2018 at 3:40 AM, Jonas Devlieghere via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jdevlieghere<br>
Date: Mon Apr  2 03:40:43 2018<br>
New Revision: 328965<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=328965&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=328965&view=rev</a><br>
Log:<br>
[dsymutil] Upstream emitting of papertrail warnings.<br>
<br>
When running dsymutil as part of your build system, it can be desirable<br>
for warnings to be part of the end product, rather than just being<br>
emitted to the output stream. This patch upstreams that functionality.<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D44639" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D44639</a><br>
<br>
Added:<br>
    llvm/trunk/test/tools/<wbr>dsymutil/X86/papertrail-<wbr>warnings.test<br>
Modified:<br>
    llvm/trunk/docs/CommandGuide/<wbr>dsymutil.rst<br>
    llvm/trunk/lib/CodeGen/<wbr>AsmPrinter/DIE.cpp<br>
    llvm/trunk/test/tools/<wbr>dsymutil/cmdline.test<br>
    llvm/trunk/test/tools/<wbr>dsymutil/debug-map-parsing.<wbr>test<br>
    llvm/trunk/tools/dsymutil/<wbr>DebugMap.h<br>
    llvm/trunk/tools/dsymutil/<wbr>DwarfLinker.cpp<br>
    llvm/trunk/tools/dsymutil/<wbr>MachODebugMapParser.cpp<br>
    llvm/trunk/tools/dsymutil/<wbr>dsymutil.cpp<br>
    llvm/trunk/tools/dsymutil/<wbr>dsymutil.h<br>
<br>
Modified: llvm/trunk/docs/CommandGuide/<wbr>dsymutil.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/dsymutil.rst?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/docs/<wbr>CommandGuide/dsymutil.rst?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/docs/CommandGuide/<wbr>dsymutil.rst (original)<br>
+++ llvm/trunk/docs/CommandGuide/<wbr>dsymutil.rst Mon Apr  2 03:40:43 2018<br>
@@ -70,6 +70,13 @@ OPTIONS<br>
<br>
  Specifies a ``path`` to prepend to all debug symbol object file paths.<br>
<br>
+.. option:: --papertrail<br>
+<br>
+ When running dsymutil as part of your build system, it can be desirable for<br>
+ warnings to be part of the end product, rather than just being emitted to the<br>
+ output stream. When enabled warnings are embedded in the linked DWARF debug<br>
+ information.<br>
+<br>
 .. option:: -s, --symtab<br>
<br>
  Dumps the symbol table found in *executable* or object file(s) and exits.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>AsmPrinter/DIE.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/AsmPrinter/DIE.cpp?<wbr>rev=328965&r1=328964&r2=<wbr>328965&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>AsmPrinter/DIE.cpp Mon Apr  2 03:40:43 2018<br>
@@ -746,6 +746,7 @@ void DIEBlock::EmitValue(const AsmPrinte<br>
   case dwarf::DW_FORM_block2: Asm->emitInt16(Size);   break;<br>
   case dwarf::DW_FORM_block4: Asm->emitInt32(Size);   break;<br>
   case dwarf::DW_FORM_block:  Asm->EmitULEB128(Size); break;<br>
+  case dwarf::DW_FORM_string: break;<br>
   case dwarf::DW_FORM_data16: break;<br>
   }<br>
<br>
<br>
Added: llvm/trunk/test/tools/<wbr>dsymutil/X86/papertrail-<wbr>warnings.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/papertrail-warnings.test?rev=328965&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/tools/<wbr>dsymutil/X86/papertrail-<wbr>warnings.test?rev=328965&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/tools/<wbr>dsymutil/X86/papertrail-<wbr>warnings.test (added)<br>
+++ llvm/trunk/test/tools/<wbr>dsymutil/X86/papertrail-<wbr>warnings.test Mon Apr  2 03:40:43 2018<br>
@@ -0,0 +1,30 @@<br>
+RUN: RC_DEBUG_OPTIONS=1 dsymutil -f %p/../Inputs/basic.macho.x86_<wbr>64 -o - | llvm-dwarfdump -v - | FileCheck %s<br>
+<br>
+CHECK: .debug_info contents:<br>
+CHECK:  Compile Unit:<br>
+CHECK:  DW_TAG_compile_unit [1] *<br>
+CHECK:    DW_AT_producer {{.*}}"dsymutil<br>
+CHECK:    DW_AT_name {{.*}}"/Inputs/basic1.macho.<wbr>x86_64.o"<br>
+CHECK:    DW_TAG_constant [2]<br>
+CHECK:      DW_AT_name {{.*}}"dsymutil_warning"<br>
+CHECK:      DW_AT_artificial [DW_FORM_flag]    (0x01)<br>
+CHECK:      DW_AT_const_value {{.*}}"unable to open object file: No such file or directory"<br>
+CHECK:    NULL<br>
+CHECK:  Compile Unit:<br>
+CHECK:  DW_TAG_compile_unit [1] *<br>
+CHECK:    DW_AT_producer {{.*}}"dsymutil<br>
+CHECK:    DW_AT_name {{.*}}"/Inputs/basic2.macho.<wbr>x86_64.o"<br>
+CHECK:    DW_TAG_constant [2]<br>
+CHECK:      DW_AT_name {{.*}}"dsymutil_warning"<br>
+CHECK:      DW_AT_artificial [DW_FORM_flag]    (0x01)<br>
+CHECK:      DW_AT_const_value {{.*}}"unable to open object file: No such file or directory"<br>
+CHECK:    NULL<br>
+CHECK:  Compile Unit:<br>
+CHECK:  DW_TAG_compile_unit [1] *<br>
+CHECK:    DW_AT_producer {{.*}}"dsymutil<br>
+CHECK:    DW_AT_name {{.*}}"/Inputs/basic3.macho.<wbr>x86_64.o"<br>
+CHECK:    DW_TAG_constant [2]<br>
+CHECK:      DW_AT_name {{.*}}"dsymutil_warning"<br>
+CHECK:      DW_AT_artificial [DW_FORM_flag]    (0x01)<br>
+CHECK:      DW_AT_const_value {{.*}}"unable to open object file: No such file or directory"<br>
+CHECK:    NULL<br>
\ No newline at end of file<br>
<br>
Modified: llvm/trunk/test/tools/<wbr>dsymutil/cmdline.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/cmdline.test?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/tools/<wbr>dsymutil/cmdline.test?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/tools/<wbr>dsymutil/cmdline.test (original)<br>
+++ llvm/trunk/test/tools/<wbr>dsymutil/cmdline.test Mon Apr  2 03:40:43 2018<br>
@@ -13,6 +13,7 @@ HELP: -no-swiftmodule-timestamp<br>
 HELP: -num-threads=<n><br>
 HELP: -o=<filename><br>
 HELP: -oso-prepend-path=<path><br>
+HELP: -papertrail<br>
 HELP: -symtab<br>
 HELP: -toolchain<br>
 HELP: -update<br>
<br>
Modified: llvm/trunk/test/tools/<wbr>dsymutil/debug-map-parsing.<wbr>test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/debug-map-parsing.test?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/tools/<wbr>dsymutil/debug-map-parsing.<wbr>test?rev=328965&r1=328964&r2=<wbr>328965&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/tools/<wbr>dsymutil/debug-map-parsing.<wbr>test (original)<br>
+++ llvm/trunk/test/tools/<wbr>dsymutil/debug-map-parsing.<wbr>test Mon Apr  2 03:40:43 2018<br>
@@ -80,7 +80,7 @@ NOT-FOUND-NEXT: triple: 'x86_64-apple-da<br>
 NOT-FOUND-NEXT: binary-path:{{.*}}/Inputs/<wbr>basic.macho.x86_64<br>
 NOT-FOUND-NEXT: ...<br>
<br>
-Check that we correctly error out on invalid executatble.<br>
+Check that we correctly error out on invalid executable.<br>
<br>
 NO-EXECUTABLE: cannot parse{{.*}}/inexistant': {{[Nn]o}} such file<br>
 NO-EXECUTABLE-NOT: ---<br>
<br>
Modified: llvm/trunk/tools/dsymutil/<wbr>DebugMap.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.h?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/<wbr>dsymutil/DebugMap.h?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/tools/dsymutil/<wbr>DebugMap.h (original)<br>
+++ llvm/trunk/tools/dsymutil/<wbr>DebugMap.h Mon Apr  2 03:40:43 2018<br>
@@ -176,6 +176,11 @@ public:<br>
     return make_range(Symbols.begin(), Symbols.end());<br>
   }<br>
<br>
+  bool empty() const { return Symbols.empty(); }<br>
+<br>
+  void addWarning(StringRef Warning) { Warnings.push_back(Warning); }<br>
+  const std::vector<std::string> &getWarnings() const { return Warnings; }<br>
+<br>
   void print(raw_ostream &OS) const;<br>
 #ifndef NDEBUG<br>
   void dump() const;<br>
@@ -194,6 +199,8 @@ private:<br>
   DenseMap<uint64_t, DebugMapEntry *> AddressToMapping;<br>
   uint8_t Type;<br>
<br>
+  std::vector<std::string> Warnings;<br>
+<br>
   /// For YAMLIO support.<br>
   ///@{<br>
   friend yaml::MappingTraits<dsymutil::<wbr>DebugMapObject>;<br>
<br>
Modified: llvm/trunk/tools/dsymutil/<wbr>DwarfLinker.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/<wbr>dsymutil/DwarfLinker.cpp?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/tools/dsymutil/<wbr>DwarfLinker.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/<wbr>DwarfLinker.cpp Mon Apr  2 03:40:43 2018<br>
@@ -1481,6 +1481,10 @@ private:<br>
       MaxDwarfVersion = Version;<br>
   }<br>
<br>
+  /// Emit warnings as Dwarf compile units to leave a trail after linking.<br>
+  bool emitPaperTrailWarnings(const DebugMapObject &DMO, const DebugMap &Map,<br>
+                              OffsetsStringPool &StringPool);<br>
+<br>
   /// Keeps track of relocations.<br>
   class RelocationManager {<br>
     struct ValidReloc {<br>
@@ -4118,6 +4122,64 @@ void DwarfLinker::DIECloner::<wbr>cloneAllCom<br>
   }<br>
 }<br>
<br>
+bool DwarfLinker::<wbr>emitPaperTrailWarnings(const DebugMapObject &DMO,<br>
+                                         const DebugMap &Map,<br>
+                                         OffsetsStringPool &StringPool) {<br>
+  if (DMO.getWarnings().empty() || !DMO.empty())<br>
+    return false;<br>
+<br>
+  Streamer-><wbr>switchToDebugInfoSection(/* Version */ 2);<br>
+  DIE *CUDie = DIE::get(DIEAlloc, dwarf::DW_TAG_compile_unit);<br>
+  CUDie->setOffset(11);<br>
+  StringRef Producer = StringPool.internString("<wbr>dsymutil");<br>
+  StringRef File = StringPool.internString(DMO.<wbr>getObjectFilename());<br>
+  CUDie->addValue(DIEAlloc, dwarf::DW_AT_producer, dwarf::DW_FORM_strp,<br>
+                  DIEInteger(StringPool.<wbr>getStringOffset(Producer)));<br>
+  DIEBlock *String = new (DIEAlloc) DIEBlock();<br>
+  DIEBlocks.push_back(String);<br>
+  for (auto &C : File)<br>
+    String->addValue(DIEAlloc, dwarf::Attribute(0), dwarf::DW_FORM_data1,<br>
+                     DIEInteger(C));<br>
+  String->addValue(DIEAlloc, dwarf::Attribute(0), dwarf::DW_FORM_data1,<br>
+                   DIEInteger(0));<br>
+<br>
+  CUDie->addValue(DIEAlloc, dwarf::DW_AT_name, dwarf::DW_FORM_string, String);<br>
+  for (const auto &Warning : DMO.getWarnings()) {<br>
+    DIE &ConstDie = CUDie->addChild(DIE::get(<wbr>DIEAlloc, dwarf::DW_TAG_constant));<br>
+    ConstDie.addValue(<br>
+        DIEAlloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp,<br>
+        DIEInteger(StringPool.<wbr>getStringOffset("dsymutil_<wbr>warning")));<br>
+    ConstDie.addValue(DIEAlloc, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag,<br>
+                      DIEInteger(1));<br>
+    ConstDie.addValue(DIEAlloc, dwarf::DW_AT_const_value, dwarf::DW_FORM_strp,<br>
+                      DIEInteger(StringPool.<wbr>getStringOffset(Warning)));<br>
+  }<br>
+  unsigned Size = 4 /* FORM_strp */ + File.size() + 1 +<br>
+                  DMO.getWarnings().size() * (4 + 1 + 4) +<br>
+                  1 /* End of children */;<br>
+  DIEAbbrev Abbrev = CUDie->generateAbbrev();<br>
+  AssignAbbrev(Abbrev);<br>
+  CUDie->setAbbrevNumber(Abbrev.<wbr>getNumber());<br>
+  Size += getULEB128Size(Abbrev.<wbr>getNumber());<br>
+  // Abbreviation ordering needed for classic compatibility.<br>
+  for (auto &Child : CUDie->children()) {<br>
+    Abbrev = Child.generateAbbrev();<br>
+    AssignAbbrev(Abbrev);<br>
+    Child.setAbbrevNumber(Abbrev.<wbr>getNumber());<br>
+    Size += getULEB128Size(Abbrev.<wbr>getNumber());<br>
+  }<br>
+  CUDie->setSize(Size);<br>
+  auto &Asm = Streamer->getAsmPrinter();<br>
+  Asm.emitInt32(11 + CUDie->getSize() - 4);<br>
+  Asm.emitInt16(2);<br>
+  Asm.emitInt32(0);<br>
+  Asm.emitInt8(Map.getTriple().<wbr>isArch64Bit() ? 8 : 4);<br>
+  Streamer->emitDIE(*CUDie);<br>
+  OutputDebugInfoSize += 11 /* Header */ + Size;<br>
+<br>
+  return true;<br>
+}<br>
+<br>
 bool DwarfLinker::link(const DebugMap &Map) {<br>
   if (!createStreamer(Map.<wbr>getTriple(), OutFile))<br>
     return false;<br>
@@ -4184,8 +4246,10 @@ bool DwarfLinker::link(const DebugMap &M<br>
       continue;<br>
     }<br>
<br>
-    if (!LinkContext.ObjectFile)<br>
+    if (emitPaperTrailWarnings(<wbr>LinkContext.DMO, Map, OffsetsStringPool))<br>
+      continue;<br>
<br>
+    if (!LinkContext.ObjectFile)<br>
       continue;<br>
<br>
     // Look for relocations that correspond to debug map entries.<br>
@@ -4232,6 +4296,11 @@ bool DwarfLinker::link(const DebugMap &M<br>
     }<br>
   }<br>
<br>
+  // If we haven't seen any CUs, pick an arbitrary valid Dwarf version anyway,<br>
+  // to be able to emit papertrail warnings.<br>
+  if (MaxDwarfVersion == 0)<br>
+    MaxDwarfVersion = 3;<br>
+<br>
   ThreadPool pool(2);<br>
<br>
   // These variables manage the list of processed object files.<br>
<br>
Modified: llvm/trunk/tools/dsymutil/<wbr>MachODebugMapParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/<wbr>dsymutil/MachODebugMapParser.<wbr>cpp?rev=328965&r1=328964&r2=<wbr>328965&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/tools/dsymutil/<wbr>MachODebugMapParser.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/<wbr>MachODebugMapParser.cpp Mon Apr  2 03:40:43 2018<br>
@@ -24,10 +24,12 @@ using namespace llvm::object;<br>
 class MachODebugMapParser {<br>
 public:<br>
   MachODebugMapParser(StringRef BinaryPath, ArrayRef<std::string> Archs,<br>
-                      StringRef PathPrefix = "", bool Verbose = false)<br>
+                      StringRef PathPrefix = "",<br>
+                      bool PaperTrailWarnings = false, bool Verbose = false)<br>
       : BinaryPath(BinaryPath), Archs(Archs.begin(), Archs.end()),<br>
-        PathPrefix(PathPrefix), MainBinaryHolder(Verbose),<br>
-        CurrentObjectHolder(Verbose), CurrentDebugMapObject(nullptr) {}<br>
+        PathPrefix(PathPrefix), PaperTrailWarnings(<wbr>PaperTrailWarnings),<br>
+        MainBinaryHolder(Verbose), CurrentObjectHolder(Verbose),<br>
+        CurrentDebugMapObject(nullptr) {}<br>
<br>
   /// Parses and returns the DebugMaps of the input binary. The binary contains<br>
   /// multiple maps in case it is a universal binary.<br>
@@ -42,6 +44,7 @@ private:<br>
   std::string BinaryPath;<br>
   SmallVector<StringRef, 1> Archs;<br>
   std::string PathPrefix;<br>
+  bool PaperTrailWarnings;<br>
<br>
   /// Owns the MemoryBuffer for the main binary.<br>
   BinaryHolder MainBinaryHolder;<br>
@@ -102,6 +105,13 @@ private:<br>
     warn_ostream() << "("<br>
                    << MachOUtils::getArchName(<wbr>Result->getTriple().<wbr>getArchName())<br>
                    << ") " << File << " " << Msg << "\n";<br>
+<br>
+    if (PaperTrailWarnings) {<br>
+      if (!File.empty())<br>
+        Result->addDebugMapObject(<wbr>File, sys::TimePoint<std::chrono::<wbr>seconds>());<br>
+      if (Result->end() != Result->begin())<br>
+        (*--Result->end())-><wbr>addWarning(Msg.str());<br>
+    }<br>
   }<br>
 };<br>
<br>
@@ -522,13 +532,14 @@ namespace llvm {<br>
 namespace dsymutil {<br>
 llvm::ErrorOr<std::vector<std:<wbr>:unique_ptr<DebugMap>>><br>
 parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,<br>
-              StringRef PrependPath, bool Verbose, bool InputIsYAML) {<br>
-  if (!InputIsYAML) {<br>
-    MachODebugMapParser Parser(InputFile, Archs, PrependPath, Verbose);<br>
-    return Parser.parse();<br>
-  } else {<br>
+              StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,<br>
+              bool InputIsYAML) {<br>
+  if (InputIsYAML)<br>
     return DebugMap::parseYAMLDebugMap(<wbr>InputFile, PrependPath, Verbose);<br>
-  }<br>
+<br>
+  MachODebugMapParser Parser(InputFile, Archs, PrependPath, PaperTrailWarnings,<br>
+                             Verbose);<br>
+  return Parser.parse();<br>
 }<br>
<br>
 bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,<br>
<br>
Modified: llvm/trunk/tools/dsymutil/<wbr>dsymutil.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/<wbr>dsymutil/dsymutil.cpp?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/tools/dsymutil/<wbr>dsymutil.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/<wbr>dsymutil.cpp Mon Apr  2 03:40:43 2018<br>
@@ -147,6 +147,11 @@ static opt<std::string><br>
     Toolchain("toolchain", desc("Embed toolchain information in dSYM bundle."),<br>
               cat(DsymCategory));<br>
<br>
+static opt<bool><br>
+    PaperTrailWarnings("<wbr>papertrail",<br>
+                       desc("Embed warnings in the linked DWARF debug info."),<br>
+                       cat(DsymCategory));<br>
+<br>
 static bool createPlistFile(llvm::<wbr>StringRef Bin, llvm::StringRef BundleRoot) {<br>
   if (NoOutput)<br>
     return true;<br>
@@ -430,6 +435,12 @@ int main(int argc, char **argv) {<br>
     return 1;<br>
   }<br>
<br>
+  if (getenv("RC_DEBUG_OPTIONS"))<br>
+    PaperTrailWarnings = true;<br>
+<br>
+  if (PaperTrailWarnings && InputIsYAMLDebugMap)<br>
+    warn_ostream() << "Paper trail warnings are not supported for YAML input";<br>
+<br>
   for (const auto &Arch : ArchFlags)<br>
     if (Arch != "*" && Arch != "all" &&<br>
         !llvm::object::<wbr>MachOObjectFile::isValidArch(<wbr>Arch)) {<br>
@@ -445,8 +456,9 @@ int main(int argc, char **argv) {<br>
       continue;<br>
     }<br>
<br>
-    auto DebugMapPtrsOrErr = parseDebugMap(InputFile, ArchFlags, OsoPrependPath,<br>
-                                           Verbose, InputIsYAMLDebugMap);<br>
+    auto DebugMapPtrsOrErr =<br>
+        parseDebugMap(InputFile, ArchFlags, OsoPrependPath, PaperTrailWarnings,<br>
+                      Verbose, InputIsYAMLDebugMap);<br>
<br>
     if (auto EC = DebugMapPtrsOrErr.getError()) {<br>
       error_ostream() << "cannot parse the debug map for '" << InputFile<br>
<br>
Modified: llvm/trunk/tools/dsymutil/<wbr>dsymutil.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.h?rev=328965&r1=328964&r2=328965&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/<wbr>dsymutil/dsymutil.h?rev=<wbr>328965&r1=328964&r2=328965&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/tools/dsymutil/<wbr>dsymutil.h (original)<br>
+++ llvm/trunk/tools/dsymutil/<wbr>dsymutil.h Mon Apr  2 03:40:43 2018<br>
@@ -59,7 +59,8 @@ struct LinkOptions {<br>
 /// returned when the file is universal (aka fat) binary.<br>
 ErrorOr<std::vector<std::<wbr>unique_ptr<DebugMap>>><br>
 parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,<br>
-              StringRef PrependPath, bool Verbose, bool InputIsYAML);<br>
+              StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,<br>
+              bool InputIsYAML);<br>
<br>
 /// Dump the symbol table<br>
 bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,<br>
<br>
<br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>