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
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
#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>
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,
}
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())
MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
return Parser.parse();
} else {
- return parseYAMLDebugMap(InputFile, Verbose);
+ return parseYAMLDebugMap(InputFile, PrependPath, Verbose);
}
}
}