summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/MachODebugMapParser.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-07-22 23:24:00 +0000
committerFrederic Riss <friss@apple.com>2015-07-22 23:24:00 +0000
commit9ccfddc39d4d27f9b16fcc72ab30d483151d6d08 (patch)
tree0bc0c785fec83f821ec39d7d54afc167183a835a /llvm/tools/dsymutil/MachODebugMapParser.cpp
parent78997f0bf356b17e6964cc1cf16312ba8c887731 (diff)
downloadbcm5719-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/MachODebugMapParser.cpp')
-rw-r--r--llvm/tools/dsymutil/MachODebugMapParser.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 6c9fa9b5132..8f3ca6ca004 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -55,7 +55,7 @@ private:
const char *CurrentFunctionName;
uint64_t CurrentFunctionAddress;
- void switchToNewDebugMapObject(StringRef Filename);
+ void switchToNewDebugMapObject(StringRef Filename, sys::TimeValue Timestamp);
void resetParserState();
uint64_t getMainBinarySymbolAddress(StringRef Name);
void loadMainBinarySymbols();
@@ -84,13 +84,15 @@ void MachODebugMapParser::resetParserState() {
/// Create a new DebugMapObject. This function resets the state of the
/// parser that was referring to the last object file and sets
/// everything up to add symbols to the new one.
-void MachODebugMapParser::switchToNewDebugMapObject(StringRef Filename) {
+void MachODebugMapParser::switchToNewDebugMapObject(StringRef Filename,
+ sys::TimeValue Timestamp) {
resetParserState();
SmallString<80> Path(PathPrefix);
sys::path::append(Path, Filename);
- auto MachOOrError = CurrentObjectHolder.GetFileAs<MachOObjectFile>(Path);
+ auto MachOOrError =
+ CurrentObjectHolder.GetFileAs<MachOObjectFile>(Path, Timestamp);
if (auto Error = MachOOrError.getError()) {
Warning(Twine("cannot open debug object \"") + Path.str() + "\": " +
Error.message() + "\n");
@@ -98,7 +100,7 @@ void MachODebugMapParser::switchToNewDebugMapObject(StringRef Filename) {
}
loadCurrentObjectFileSymbols();
- CurrentDebugMapObject = &Result->addDebugMapObject(Path);
+ CurrentDebugMapObject = &Result->addDebugMapObject(Path, Timestamp);
}
static Triple getTriple(const object::MachOObjectFile &Obj) {
@@ -144,8 +146,11 @@ void MachODebugMapParser::handleStabSymbolTableEntry(uint32_t StringIndex,
const char *Name = &MainBinaryStrings.data()[StringIndex];
// An N_OSO entry represents the start of a new object file description.
- if (Type == MachO::N_OSO)
- return switchToNewDebugMapObject(Name);
+ if (Type == MachO::N_OSO) {
+ sys::TimeValue Timestamp;
+ Timestamp.fromEpochTime(Value);
+ return switchToNewDebugMapObject(Name, Timestamp);
+ }
// If the last N_OSO object file wasn't found,
// CurrentDebugMapObject will be null. Do not update anything
OpenPOWER on IntegriCloud