diff options
Diffstat (limited to 'llvm/tools/llvm-profgen/ProfiledBinary.h')
-rw-r--r-- | llvm/tools/llvm-profgen/ProfiledBinary.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h index 0588cb4..02df762 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.h +++ b/llvm/tools/llvm-profgen/ProfiledBinary.h @@ -185,6 +185,16 @@ private: using AddressRange = std::pair<uint64_t, uint64_t>; +// The parsed MMap event +struct MMapEvent { + int64_t PID = 0; + uint64_t Address = 0; + uint64_t Size = 0; + uint64_t Offset = 0; + StringRef MemProtectionFlag; + StringRef BinaryPath; +}; + class ProfiledBinary { // Absolute path of the executable binary. std::string Path; @@ -276,6 +286,19 @@ class ProfiledBinary { // String table owning function name strings created from the symbolizer. std::unordered_set<std::string> NameStrings; + // MMap events for PT_LOAD segments without 'x' memory protection flag. + SmallVector<MMapEvent> MMapNonTextEvents; + + // Records the file offset, file size and virtual address of program headers. + struct PhdrInfo { + uint64_t FileOffset; + uint64_t FileSz; + uint64_t vAddr; + }; + + // Program header information for non-text PT_LOAD segments. + SmallVector<PhdrInfo> NonTextPhdrInfo; + // A collection of functions to print disassembly for. StringSet<> DisassembleFunctionSet; @@ -363,6 +386,10 @@ public: ProfiledBinary(const StringRef ExeBinPath, const StringRef DebugBinPath); ~ProfiledBinary(); + /// Symbolize an address and return the symbol name. The returned StringRef is + /// owned by this ProfiledBinary object. + StringRef symbolizeDataAddress(uint64_t Address); + void decodePseudoProbe(); StringRef getPath() const { return Path; } @@ -603,6 +630,14 @@ public: return ProbeDecoder.getInlinerDescForProbe(Probe); } + void addMMapNonTextEvent(MMapEvent MMap) { + MMapNonTextEvents.push_back(MMap); + } + + // Given a runtime address, canonicalize it to the virtual address in the + // binary. + uint64_t CanonicalizeNonTextAddress(uint64_t Address); + bool getTrackFuncContextSize() { return TrackFuncContextSize; } bool getIsLoadedByMMap() { return IsLoadedByMMap; } |