summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/MachODebugMapParser.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-06-03 16:57:16 +0000
committerFrederic Riss <friss@apple.com>2015-06-03 16:57:16 +0000
commit063d674c2112e2134f667f9a9dc3e0482de85dfe (patch)
treed4c4a99bcf550451ddddaa169d14a7f175d9f379 /llvm/tools/dsymutil/MachODebugMapParser.cpp
parent34238cfa24395e0a0642f5b45cfe139fe925c051 (diff)
downloadbcm5719-llvm-063d674c2112e2134f667f9a9dc3e0482de85dfe.tar.gz
bcm5719-llvm-063d674c2112e2134f667f9a9dc3e0482de85dfe.zip
[dsymutil] Accept a YAML debug map as input instead of a binary.
To do this, the user needs to pass the new -y flag. As it wasn't tested before, the debug map YAML deserialization was completely buggy (mainly because the DebugMapObject has a dual mapping that allows to search by name and by address, but only the StringMap got populated). It's fixed and tested in this commit by augmenting some test with a 2 stage dwarf link: a frist llvm-dsymutil reads the debug map and pipes it in a second instance that does the actual link without touching the initial binary. llvm-svn: 238941
Diffstat (limited to 'llvm/tools/dsymutil/MachODebugMapParser.cpp')
-rw-r--r--llvm/tools/dsymutil/MachODebugMapParser.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index bf64303b9ea..c8b48823f98 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -242,12 +242,32 @@ void MachODebugMapParser::loadMainBinarySymbols() {
}
}
+ErrorOr<std::unique_ptr<DebugMap>>
+parseYAMLDebugMap(StringRef InputFile, bool Verbose) {
+ auto ErrOrFile = MemoryBuffer::getFileOrSTDIN(InputFile);
+ if (auto Err =ErrOrFile.getError())
+ return Err;
+
+ std::unique_ptr<DebugMap> Res;
+ yaml::Input yin((*ErrOrFile)->getBuffer());
+ yin >> Res;
+
+ if (auto EC = yin.error())
+ return EC;
+
+ return std::move(Res);
+}
+
namespace llvm {
namespace dsymutil {
llvm::ErrorOr<std::unique_ptr<DebugMap>>
-parseDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose) {
- MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
- return Parser.parse();
+parseDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose, bool InputIsYAML) {
+ if (!InputIsYAML) {
+ MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
+ return Parser.parse();
+ } else {
+ return parseYAMLDebugMap(InputFile, Verbose);
+ }
}
}
}
OpenPOWER on IntegriCloud