diff options
author | Frederic Riss <friss@apple.com> | 2015-06-03 17:08:42 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2015-06-03 17:08:42 +0000 |
commit | 28dbc5ab8b58e6b4ca43d7a34cbbc8d02a37793f (patch) | |
tree | 605d3450125d8afb1e3d0a7d75340bc616fe8f75 /llvm/tools | |
parent | 3c306e895e5e7f53950b4102e92fcf2266492b5c (diff) | |
download | bcm5719-llvm-28dbc5ab8b58e6b4ca43d7a34cbbc8d02a37793f.tar.gz bcm5719-llvm-28dbc5ab8b58e6b4ca43d7a34cbbc8d02a37793f.zip |
Revert "[dsymutil] Accept a YAML debug map as input instead of a binary."
This reverts commit r238941 while I figure out the bot issues.
llvm-svn: 238943
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/dsymutil/DebugMap.h | 50 | ||||
-rw-r--r-- | llvm/tools/dsymutil/MachODebugMapParser.cpp | 26 | ||||
-rw-r--r-- | llvm/tools/dsymutil/dsymutil.cpp | 8 | ||||
-rw-r--r-- | llvm/tools/dsymutil/dsymutil.h | 4 |
4 files changed, 25 insertions, 63 deletions
diff --git a/llvm/tools/dsymutil/DebugMap.h b/llvm/tools/dsymutil/DebugMap.h index c2917db981e..8d76f113e91 100644 --- a/llvm/tools/dsymutil/DebugMap.h +++ b/llvm/tools/dsymutil/DebugMap.h @@ -69,7 +69,6 @@ class DebugMap { /// For YAML IO support. ///@{ - friend yaml::MappingTraits<std::unique_ptr<DebugMap>>; friend yaml::MappingTraits<DebugMap>; DebugMap() = default; ///@} @@ -185,35 +184,33 @@ struct MappingTraits<std::pair<std::string, DebugMapObject::SymbolMapping>> { }; template <> struct MappingTraits<dsymutil::DebugMapObject> { - // Normalize/Denormalize between YAML and a DebugMapObject. - struct YamlDMO { - YamlDMO(IO &io) {} - - YamlDMO(IO &io, dsymutil::DebugMapObject &Obj) { - Filename = Obj.Filename; - Entries.reserve(Obj.Symbols.size()); - for (auto &Entry : Obj.Symbols) + typedef StringMap<dsymutil::DebugMapObject::SymbolMapping> SymbolMap; + + struct SequencedStringMap { + SequencedStringMap(IO &io) {} + + SequencedStringMap(IO &io, SymbolMap &Map) { + Entries.reserve(Map.size()); + for (auto &Entry : Map) Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue())); } - dsymutil::DebugMapObject denormalize(IO &) { - dsymutil::DebugMapObject Res(Filename); - for (auto &Entry : Entries) { - auto &Mapping = Entry.second; - Res.addSymbol(Entry.first, Mapping.ObjectAddress, Mapping.BinaryAddress, - Mapping.Size); - } + SymbolMap denormalize(IO &) { + SymbolMap Res; + + for (auto &Entry : Entries) + Res[Entry.first] = Entry.second; + return Res; } - std::string Filename; std::vector<dsymutil::DebugMapObject::YAMLSymbolMapping> Entries; }; - static void mapping(IO &io, dsymutil::DebugMapObject &DMO) { - MappingNormalization<YamlDMO, dsymutil::DebugMapObject> Norm(io, DMO); - io.mapRequired("filename", Norm->Filename); - io.mapRequired("symbols", Norm->Entries); + static void mapping(IO &io, dsymutil::DebugMapObject &s) { + MappingNormalization<SequencedStringMap, SymbolMap> seq(io, s.Symbols); + io.mapRequired("filename", s.Filename); + io.mapRequired("symbols", seq->Entries); } }; @@ -225,7 +222,7 @@ template <> struct ScalarTraits<Triple> { static StringRef input(StringRef scalar, void *, Triple &value) { value = Triple(scalar); - return StringRef(); + return value.str(); } static bool mustQuote(StringRef) { return true; } @@ -256,15 +253,6 @@ template <> struct MappingTraits<dsymutil::DebugMap> { io.mapOptional("objects", DM.Objects); } }; - - template <> struct MappingTraits<std::unique_ptr<dsymutil::DebugMap>> { - static void mapping(IO &io, std::unique_ptr<dsymutil::DebugMap> &DM) { - if (!DM) - DM.reset(new DebugMap()); - io.mapRequired("triple", DM->BinaryTriple); - io.mapOptional("objects", DM->Objects); - } -}; } } diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp index c8b48823f98..bf64303b9ea 100644 --- a/llvm/tools/dsymutil/MachODebugMapParser.cpp +++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp @@ -242,32 +242,12 @@ 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, bool InputIsYAML) { - if (!InputIsYAML) { - MachODebugMapParser Parser(InputFile, PrependPath, Verbose); - return Parser.parse(); - } else { - return parseYAMLDebugMap(InputFile, Verbose); - } +parseDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose) { + MachODebugMapParser Parser(InputFile, PrependPath, Verbose); + return Parser.parse(); } } } diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index 50091935a44..b4a480d7012 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -52,10 +52,6 @@ static opt<bool> DumpDebugMap( desc("Parse and dump the debug map to standard output. Not DWARF link " "will take place."), init(false)); - -static opt<bool> InputIsYAMLDebugMap( - "y", desc("Treat the input file is a YAML debug map rather than a binary."), - init(false)); } int main(int argc, char **argv) { @@ -65,9 +61,7 @@ int main(int argc, char **argv) { LinkOptions Options; llvm::cl::ParseCommandLineOptions(argc, argv, "llvm dsymutil\n"); - - auto DebugMapPtrOrErr = - parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap); + auto DebugMapPtrOrErr = parseDebugMap(InputFile, OsoPrependPath, Verbose); Options.Verbose = Verbose; Options.NoOutput = NoOutput; diff --git a/llvm/tools/dsymutil/dsymutil.h b/llvm/tools/dsymutil/dsymutil.h index 0cbdaf5503a..e9f7cd95187 100644 --- a/llvm/tools/dsymutil/dsymutil.h +++ b/llvm/tools/dsymutil/dsymutil.h @@ -34,8 +34,8 @@ struct LinkOptions { /// \brief Extract the DebugMap from the given file. /// The file has to be a MachO object file. llvm::ErrorOr<std::unique_ptr<DebugMap>> -parseDebugMap(StringRef InputFile, StringRef PrependPath, - bool Verbose, bool InputIsYAML); +parseDebugMap(StringRef InputFile, StringRef PrependPath = "", + bool Verbose = false); /// \brief Link the Dwarf debuginfo as directed by the passed DebugMap /// \p DM into a DwarfFile named \p OutputFilename. |