aboutsummaryrefslogtreecommitdiff
path: root/tools/dsymutil/DebugMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dsymutil/DebugMap.h')
-rw-r--r--tools/dsymutil/DebugMap.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/tools/dsymutil/DebugMap.h b/tools/dsymutil/DebugMap.h
index 54bff3272080..ee48b093d4fd 100644
--- a/tools/dsymutil/DebugMap.h
+++ b/tools/dsymutil/DebugMap.h
@@ -21,7 +21,9 @@
#ifndef LLVM_TOOLS_DSYMUTIL_DEBUGMAP_H
#define LLVM_TOOLS_DSYMUTIL_DEBUGMAP_H
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/ErrorOr.h"
@@ -60,10 +62,13 @@ class DebugMapObject;
/// }
/// }
class DebugMap {
+ Triple BinaryTriple;
typedef std::vector<std::unique_ptr<DebugMapObject>> ObjectContainer;
ObjectContainer Objects;
public:
+ DebugMap(const Triple &BinaryTriple) : BinaryTriple(BinaryTriple) {}
+
typedef ObjectContainer::const_iterator const_iterator;
iterator_range<const_iterator> objects() const {
@@ -78,6 +83,8 @@ public:
/// debug map.
DebugMapObject &addDebugMapObject(StringRef ObjectFilePath);
+ const Triple &getTriple() const { return BinaryTriple; }
+
void print(raw_ostream &OS) const;
#ifndef NDEBUG
@@ -94,22 +101,34 @@ public:
struct SymbolMapping {
uint64_t ObjectAddress;
uint64_t BinaryAddress;
- SymbolMapping(uint64_t ObjectAddress, uint64_t BinaryAddress)
- : ObjectAddress(ObjectAddress), BinaryAddress(BinaryAddress) {}
+ uint32_t Size;
+ SymbolMapping(uint64_t ObjectAddress, uint64_t BinaryAddress, uint32_t Size)
+ : ObjectAddress(ObjectAddress), BinaryAddress(BinaryAddress),
+ Size(Size) {}
};
+ typedef StringMapEntry<SymbolMapping> DebugMapEntry;
+
/// \brief Adds a symbol mapping to this DebugMapObject.
/// \returns false if the symbol was already registered. The request
/// is discarded in this case.
bool addSymbol(llvm::StringRef SymName, uint64_t ObjectAddress,
- uint64_t LinkedAddress);
+ uint64_t LinkedAddress, uint32_t Size);
/// \brief Lookup a symbol mapping.
/// \returns null if the symbol isn't found.
- const SymbolMapping *lookupSymbol(StringRef SymbolName) const;
+ const DebugMapEntry *lookupSymbol(StringRef SymbolName) const;
+
+ /// \brief Lookup an objectfile address.
+ /// \returns null if the address isn't found.
+ const DebugMapEntry *lookupObjectAddress(uint64_t Address) const;
llvm::StringRef getObjectFilename() const { return Filename; }
+ iterator_range<StringMap<SymbolMapping>::const_iterator> symbols() const {
+ return make_range(Symbols.begin(), Symbols.end());
+ }
+
void print(raw_ostream &OS) const;
#ifndef NDEBUG
void dump() const;
@@ -121,6 +140,7 @@ private:
std::string Filename;
StringMap<SymbolMapping> Symbols;
+ DenseMap<uint64_t, DebugMapEntry *> AddressToMapping;
};
}
}