[dsymutil] Embed toolchain in dSYM bundle
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 8 Mar 2018 10:39:12 +0000 (10:39 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 8 Mar 2018 10:39:12 +0000 (10:39 +0000)
Allow us to embed the (Xcode) toolchain in the dSYM bundle's property
list.

Differential revision: https://reviews.llvm.org/D44151

llvm-svn: 326994

llvm/docs/CommandGuide/dsymutil.rst
llvm/test/tools/dsymutil/X86/darwin-bundle.test
llvm/test/tools/dsymutil/cmdline.test
llvm/tools/dsymutil/dsymutil.cpp

index 2782da3..a89ee18 100644 (file)
@@ -74,6 +74,10 @@ OPTIONS
 
  Dumps the symbol table found in *executable* or object file(s) and exits.
 
+.. option:: --toolchain
+
+ Embed the toolchain in the dSYM bundle's property list.
+
 .. option:: -u, --update
 
  Update an existing dSYM file to contain the latest accelerator tables and
index b49cdea..59434c5 100644 (file)
@@ -8,6 +8,9 @@ RUN: cat %p/../Inputs/Info.plist > %t/Info.plist
 RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64 -o %t/dsymdest/basic.macho.x86_64.dSYM
 RUN: FileCheck %s --input-file %t/dsymdest/basic.macho.x86_64.dSYM/Contents/Info.plist
 
+RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64 -toolchain "toolchain" -o %t/dsymdest/basic.macho.x86_64.dSYM
+RUN: FileCheck %s --input-file %t/dsymdest/basic.macho.x86_64.dSYM/Contents/Info.plist --check-prefix=CHECK --check-prefix=TOOLCHAIN
+
 CHECK: <?xml version="1.0" encoding="UTF-8"?>
 CHECK-NEXT: <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 CHECK-NEXT: <plist version="1.0">
@@ -26,5 +29,7 @@ CHECK-NEXT:                 <key>CFBundleShortVersionString</key>
 CHECK-NEXT:                 <string>2.0</string>
 CHECK-NEXT:                 <key>CFBundleVersion</key>
 CHECK-NEXT:                 <string>2</string>
-CHECK-NEXT:         </dict>
+TOOLCHAIN:                  <key>Toolchain</key>
+TOOLCHAIN-NEXT:             <string>toolchain</string>
+CHECK:              </dict>
 CHECK-NEXT: </plist>
index d246a14..c45aa67 100644 (file)
@@ -14,6 +14,7 @@ HELP: -num-threads=<n>
 HELP: -o=<filename>
 HELP: -oso-prepend-path=<path>
 HELP: -symtab
+HELP: -toolchain
 HELP: -update
 HELP: -verbose
 HELP: -verify
index adc2e85..bbde209 100644 (file)
@@ -142,6 +142,10 @@ static opt<bool> InputIsYAMLDebugMap(
 static opt<bool> Verify("verify", desc("Verify the linked DWARF debug info."),
                         cat(DsymCategory));
 
+static opt<std::string>
+    Toolchain("toolchain", desc("Embed toolchain information in dSYM bundle."),
+              cat(DsymCategory));
+
 static bool createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) {
   if (NoOutput)
     return true;
@@ -189,8 +193,13 @@ static bool createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) {
        << "\t\t<string>" << BI.ShortVersionStr << "</string>\n";
 
   PL << "\t\t<key>CFBundleVersion</key>\n"
-     << "\t\t<string>" << BI.VersionStr << "</string>\n"
-     << "\t</dict>\n"
+     << "\t\t<string>" << BI.VersionStr << "</string>\n";
+
+  if (!Toolchain.empty())
+    PL << "\t\t<key>Toolchain</key>\n"
+       << "\t\t<string>" << Toolchain << "</string>\n";
+
+  PL << "\t</dict>\n"
      << "</plist>\n";
 
   PL.close();