| 82 | }; |
| 83 | |
| 84 | class AbstractUnwinder |
| 85 | { |
| 86 | public: |
| 87 | // Methods |
| 88 | virtual remote_addr_t |
| 89 | getAddressforSymbol(const std::string& symbol, const std::string& modulename) const; |
| 90 | virtual std::vector<NativeFrame> unwindThread(pid_t tid) const = 0; |
| 91 | |
| 92 | // Static methods |
| 93 | static std::string demangleSymbol(const std::string&); |
| 94 | |
| 95 | virtual ~AbstractUnwinder() = default; |
| 96 | |
| 97 | protected: |
| 98 | // Methods |
| 99 | virtual struct Dwfl* Dwfl() const = 0; |
| 100 | std::vector<NativeFrame> gatherFrames(const std::vector<Frame>& frames) const; |
| 101 | |
| 102 | private: |
| 103 | // Enums |
| 104 | enum class StatusCode { |
| 105 | SUCCESS, |
| 106 | ERROR, |
| 107 | }; |
| 108 | // Aliases |
| 109 | using Scopes = std::shared_ptr<Dwarf_Die>; |
| 110 | using ScopesInfo = std::pair<int, Scopes>; |
| 111 | |
| 112 | // Methods |
| 113 | Dwarf_Die* dwarfModuleAddrDie(Dwarf_Addr pc_adjusted, Dwfl_Module* mod, Dwarf_Addr* bias) const; |
| 114 | |
| 115 | std::pair<int, Scopes> dwarfGetScopes(Dwarf_Die* cudie, Dwarf_Addr pc_adjusted) const; |
| 116 | std::pair<int, Scopes> dwarfGetScopesDie(Dwarf_Die* die) const; |
| 117 | |
| 118 | const char* getNonInlineSymbolName(Dwfl_Module* mod, Dwarf_Addr pc) const; |
| 119 | |
| 120 | StatusCode gatherInlineFrames( |
| 121 | std::vector<NativeFrame>& native_frames, |
| 122 | const std::string& noninline_symname, |
| 123 | Dwarf_Addr pc, |
| 124 | Dwarf_Addr pc_corrected, |
| 125 | Dwarf_Die* cudie, |
| 126 | const char* mod_name) const; |
| 127 | |
| 128 | // Data members |
| 129 | mutable ModuleCuDieRanges d_range_maps_cache; |
| 130 | mutable std::unordered_map<Dwarf_Addr, ScopesInfo> d_dwarf_getscopes_cache; |
| 131 | mutable std::unordered_map<void*, ScopesInfo> d_dwarf_getscopes_die_cache; |
| 132 | mutable std::unordered_map<Dwarf_Addr, const char*> d_symbol_by_pc_cache; |
| 133 | }; |
| 134 | |
| 135 | class Unwinder : public AbstractUnwinder |
| 136 | { |
nothing calls this directly
no outgoing calls
no test coverage detected