mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user