diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-09-10 18:53:34 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-09-10 18:53:34 +0000 |
commit | 5bf671d658572f2de62bde5767e63873cb5fc708 (patch) | |
tree | fa9bace9652920533dec17d1e227c3fb3929fa8b /llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h | |
parent | e3fb157234c40dfa2746dbb08edd8730cc4b78c4 (diff) | |
download | src-5bf671d658572f2de62bde5767e63873cb5fc708.tar.gz src-5bf671d658572f2de62bde5767e63873cb5fc708.zip |
Vendor import of llvm-project branch release/15.x llvmorg-15.0.0-9-g1c73596d3454.vendor/llvm-project/llvmorg-15.0.0-9-g1c73596d3454
Diffstat (limited to 'llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h')
-rw-r--r-- | llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h b/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h index 26686143af95..a54f8f5d2db8 100644 --- a/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h @@ -26,11 +26,14 @@ namespace llvm { namespace symbolize { +class LLVMSymbolizer; + /// Filter to convert parsed log symbolizer markup elements into human-readable /// text. class MarkupFilter { public: - MarkupFilter(raw_ostream &OS, Optional<bool> ColorsEnabled = llvm::None); + MarkupFilter(raw_ostream &OS, LLVMSymbolizer &Symbolizer, + Optional<bool> ColorsEnabled = llvm::None); /// Filters a line containing symbolizer markup and writes the human-readable /// results to the output stream. @@ -57,6 +60,7 @@ private: uint64_t ModuleRelativeAddr; bool contains(uint64_t Addr) const; + uint64_t getModuleRelativeAddr(uint64_t Addr) const; }; // An informational module line currently being constructed. As many mmap @@ -67,6 +71,15 @@ private: SmallVector<const MMap *> MMaps = {}; }; + // The semantics of a possible program counter value. + enum class PCType { + // The address is a return address and must be adjusted to point to the call + // itself. + ReturnAddress, + // The address is the precise location in the code and needs no adjustment. + PreciseCode, + }; + bool tryContextualElement(const MarkupNode &Node, const SmallVector<MarkupNode> &DeferredNodes); bool tryMMap(const MarkupNode &Element, @@ -83,6 +96,9 @@ private: bool tryPresentation(const MarkupNode &Node); bool trySymbol(const MarkupNode &Node); + bool tryPC(const MarkupNode &Node); + bool tryBackTrace(const MarkupNode &Node); + bool tryData(const MarkupNode &Node); bool trySGR(const MarkupNode &Node); @@ -91,6 +107,9 @@ private: void restoreColor(); void resetColor(); + void printRawElement(const MarkupNode &Element); + void printValue(Twine Value); + Optional<Module> parseModule(const MarkupNode &Element) const; Optional<MMap> parseMMap(const MarkupNode &Element) const; @@ -99,19 +118,26 @@ private: Optional<uint64_t> parseSize(StringRef Str) const; Optional<SmallVector<uint8_t>> parseBuildID(StringRef Str) const; Optional<std::string> parseMode(StringRef Str) const; + Optional<PCType> parsePCType(StringRef Str) const; + Optional<uint64_t> parseFrameNumber(StringRef Str) const; bool checkTag(const MarkupNode &Node) const; bool checkNumFields(const MarkupNode &Element, size_t Size) const; bool checkNumFieldsAtLeast(const MarkupNode &Element, size_t Size) const; + bool checkNumFieldsAtMost(const MarkupNode &Element, size_t Size) const; void reportTypeError(StringRef Str, StringRef TypeName) const; void reportLocation(StringRef::iterator Loc) const; - const MMap *overlappingMMap(const MMap &Map) const; + const MMap *getOverlappingMMap(const MMap &Map) const; + const MMap *getContainingMMap(uint64_t Addr) const; + + uint64_t adjustAddr(uint64_t Addr, PCType Type) const; StringRef lineEnding() const; raw_ostream &OS; + LLVMSymbolizer &Symbolizer; const bool ColorsEnabled; MarkupParser Parser; |