[llvm] r239163 - [dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map

Frederic Riss friss at apple.com
Fri Jun 5 09:35:45 PDT 2015


Author: friss
Date: Fri Jun  5 11:35:44 2015
New Revision: 239163

URL: http://llvm.org/viewvc/llvm-project?rev=239163&view=rev
Log:
[dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map

All the tests using a YAML debug map will need this.

Modified:
    llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test
    llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test
    llvm/trunk/tools/dsymutil/DebugMap.h
    llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp

Modified: llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test?rev=239163&r1=239162&r2=239163&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test Fri Jun  5 11:35:44 2015
@@ -7,7 +7,7 @@ RUN: llvm-dwarfdump %t2 | FileCheck %s
 RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
 RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
 RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
-RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -o - -oso-prepend-path=%p/.. -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
+RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -o - -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
 
 CHECK: file format Mach-O 64-bit x86-64
 

Modified: llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test?rev=239163&r1=239162&r2=239163&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test Fri Jun  5 11:35:44 2015
@@ -1,6 +1,6 @@
 REQUIRES: shell
 RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
-RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -o - -oso-prepend-path=%p/.. -y - | llvm-dwarfdump - | FileCheck %s
+RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -o - -y - | llvm-dwarfdump - | FileCheck %s
 
 CHECK: file format Mach-O 64-bit x86-64
 

Modified: llvm/trunk/tools/dsymutil/DebugMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.h?rev=239163&r1=239162&r2=239163&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DebugMap.h (original)
+++ llvm/trunk/tools/dsymutil/DebugMap.h Fri Jun  5 11:35:44 2015
@@ -28,6 +28,7 @@
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <vector>
 
@@ -208,8 +209,12 @@ template <> struct MappingTraits<dsymuti
         Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue()));
     }
 
-    dsymutil::DebugMapObject denormalize(IO &) {
-      dsymutil::DebugMapObject Res(Filename);
+    dsymutil::DebugMapObject denormalize(IO &IO) {
+      void *Ctxt = IO.getContext();
+      StringRef PrependPath = *reinterpret_cast<StringRef*>(Ctxt);
+      SmallString<80> Path(PrependPath);
+      sys::path::append(Path, Filename);
+      dsymutil::DebugMapObject Res(Path);
       for (auto &Entry : Entries) {
         auto &Mapping = Entry.second;
         Res.addSymbol(Entry.first, Mapping.ObjectAddress, Mapping.BinaryAddress,

Modified: llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp?rev=239163&r1=239162&r2=239163&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp (original)
+++ llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp Fri Jun  5 11:35:44 2015
@@ -243,13 +243,13 @@ void MachODebugMapParser::loadMainBinary
 }
 
 ErrorOr<std::unique_ptr<DebugMap>>
-parseYAMLDebugMap(StringRef InputFile, bool Verbose) {
+parseYAMLDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose) {
   auto ErrOrFile = MemoryBuffer::getFileOrSTDIN(InputFile);
   if (auto Err =ErrOrFile.getError())
     return Err;
 
   std::unique_ptr<DebugMap> Res;
-  yaml::Input yin((*ErrOrFile)->getBuffer());
+  yaml::Input yin((*ErrOrFile)->getBuffer(), &PrependPath);
   yin >> Res;
 
   if (auto EC = yin.error())
@@ -266,7 +266,7 @@ parseDebugMap(StringRef InputFile, Strin
     MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
     return Parser.parse();
   } else {
-    return parseYAMLDebugMap(InputFile, Verbose);
+    return parseYAMLDebugMap(InputFile, PrependPath, Verbose);
   }
 }
 }





More information about the llvm-commits mailing list