summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/MachODebugMapParser.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-06-03 20:29:24 +0000
committerFrederic Riss <friss@apple.com>2015-06-03 20:29:24 +0000
commit90e0bd96ff732cfec9b5fdc10ad4279b1184a394 (patch)
tree26b10a8e8d3f951d035d2ded580b58258a5627a7 /llvm/tools/dsymutil/MachODebugMapParser.cpp
parent5e740dbca659eeeb1c86a8c8c1a3128c5bf66d45 (diff)
downloadbcm5719-llvm-90e0bd96ff732cfec9b5fdc10ad4279b1184a394.tar.gz
bcm5719-llvm-90e0bd96ff732cfec9b5fdc10ad4279b1184a394.zip
Reapply r238941 - [dsymutil] Accept a YAML debug map as input instead of a binary.
With a couple more constructors that GCC thinks are necessary. Original commit message: [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: 238959
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