diff options
author | Frederic Riss <friss@apple.com> | 2015-07-22 23:24:00 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2015-07-22 23:24:00 +0000 |
commit | 9ccfddc39d4d27f9b16fcc72ab30d483151d6d08 (patch) | |
tree | 0bc0c785fec83f821ec39d7d54afc167183a835a /llvm/tools/dsymutil/DebugMap.cpp | |
parent | 78997f0bf356b17e6964cc1cf16312ba8c887731 (diff) | |
download | bcm5719-llvm-9ccfddc39d4d27f9b16fcc72ab30d483151d6d08.tar.gz bcm5719-llvm-9ccfddc39d4d27f9b16fcc72ab30d483151d6d08.zip |
[dsymutil] Check archive members timestamps.
The debug map contains the timestamp of the object files in references.
We do not check these in the general case, but it's really useful if
you have archives where different versions of an object file have been
appended. This allows llvm-dsymutil to find the right one.
llvm-svn: 242965
Diffstat (limited to 'llvm/tools/dsymutil/DebugMap.cpp')
-rw-r--r-- | llvm/tools/dsymutil/DebugMap.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp index e5cc87b3f31..24dedfcb673 100644 --- a/llvm/tools/dsymutil/DebugMap.cpp +++ b/llvm/tools/dsymutil/DebugMap.cpp @@ -20,8 +20,9 @@ namespace dsymutil { using namespace llvm::object; -DebugMapObject::DebugMapObject(StringRef ObjectFilename) - : Filename(ObjectFilename) {} +DebugMapObject::DebugMapObject(StringRef ObjectFilename, + sys::TimeValue Timestamp) + : Filename(ObjectFilename), Timestamp(Timestamp) {} bool DebugMapObject::addSymbol(StringRef Name, uint64_t ObjectAddress, uint64_t LinkedAddress, uint32_t Size) { @@ -58,8 +59,9 @@ void DebugMapObject::print(raw_ostream &OS) const { void DebugMapObject::dump() const { print(errs()); } #endif -DebugMapObject &DebugMap::addDebugMapObject(StringRef ObjectFilePath) { - Objects.emplace_back(new DebugMapObject(ObjectFilePath)); +DebugMapObject &DebugMap::addDebugMapObject(StringRef ObjectFilePath, + sys::TimeValue Timestamp) { + Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp)); return *Objects.back(); } @@ -121,11 +123,12 @@ namespace yaml { // Normalize/Denormalize between YAML and a DebugMapObject. struct MappingTraits<dsymutil::DebugMapObject>::YamlDMO { - YamlDMO(IO &io) {} + YamlDMO(IO &io) { Timestamp = 0; } YamlDMO(IO &io, dsymutil::DebugMapObject &Obj); dsymutil::DebugMapObject denormalize(IO &IO); std::string Filename; + sys::TimeValue::SecondsType Timestamp; std::vector<dsymutil::DebugMapObject::YAMLSymbolMapping> Entries; }; @@ -141,6 +144,7 @@ void MappingTraits<dsymutil::DebugMapObject>::mapping( IO &io, dsymutil::DebugMapObject &DMO) { MappingNormalization<YamlDMO, dsymutil::DebugMapObject> Norm(io, DMO); io.mapRequired("filename", Norm->Filename); + io.mapOptional("timestamp", Norm->Timestamp); io.mapRequired("symbols", Norm->Entries); } @@ -192,6 +196,7 @@ void MappingTraits<std::unique_ptr<dsymutil::DebugMap>>::mapping( MappingTraits<dsymutil::DebugMapObject>::YamlDMO::YamlDMO( IO &io, dsymutil::DebugMapObject &Obj) { Filename = Obj.Filename; + Timestamp = Obj.getTimestamp().toEpochTime(); Entries.reserve(Obj.Symbols.size()); for (auto &Entry : Obj.Symbols) Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue())); @@ -224,7 +229,9 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::denormalize(IO &IO) { } } - dsymutil::DebugMapObject Res(Path); + sys::TimeValue TV; + TV.fromEpochTime(Timestamp); + dsymutil::DebugMapObject Res(Path, TV); for (auto &Entry : Entries) { auto &Mapping = Entry.second; uint64_t ObjAddress = Mapping.ObjectAddress; |