diff options
Diffstat (limited to 'include/lldb/Symbol/Function.h')
-rw-r--r-- | include/lldb/Symbol/Function.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h index f68a16705d935..1b23a99373ca4 100644 --- a/include/lldb/Symbol/Function.h +++ b/include/lldb/Symbol/Function.h @@ -140,7 +140,7 @@ public: /// \param[in] call_decl_ptr /// Optional calling location declaration information that /// describes from where this inlined function was called. - InlineFunctionInfo(const char *name, const char *mangled, + InlineFunctionInfo(const char *name, llvm::StringRef mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr); @@ -246,10 +246,22 @@ private: class Function; +/// \class CallSiteParameter Function.h "lldb/Symbol/Function.h" +/// +/// Represent the locations of a parameter at a call site, both in the caller +/// and in the callee. +struct CallSiteParameter { + DWARFExpression LocationInCallee; + DWARFExpression LocationInCaller; +}; + +/// A vector of \c CallSiteParameter. +using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>; + /// \class CallEdge Function.h "lldb/Symbol/Function.h" /// /// Represent a call made within a Function. This can be used to find a path -/// in the call graph between two functions. +/// in the call graph between two functions, or to evaluate DW_OP_entry_value. class CallEdge { public: /// Construct a call edge using a symbol name to identify the calling @@ -259,7 +271,8 @@ public: /// TODO: A symbol name may not be globally unique. To disambiguate ODR /// conflicts, it's necessary to determine the \c Target a call edge is /// associated with before resolving it. - CallEdge(const char *symbol_name, lldb::addr_t return_pc); + CallEdge(const char *symbol_name, lldb::addr_t return_pc, + CallSiteParameterArray parameters); CallEdge(CallEdge &&) = default; CallEdge &operator=(CallEdge &&) = default; @@ -279,6 +292,9 @@ public: /// offset. lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; } + /// Get the call site parameters available at this call edge. + llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const; + private: void ParseSymbolFileAndResolve(ModuleList &images); @@ -294,6 +310,8 @@ private: /// gives the return PC for the call. lldb::addr_t return_pc; + CallSiteParameterArray parameters; + /// Whether or not an attempt was made to find the callee's definition. bool resolved; @@ -402,6 +420,11 @@ public: /// return None. llvm::MutableArrayRef<CallEdge> GetTailCallingEdges(); + /// Get the outgoing call edge from this function which has the given return + /// address \p return_pc, or return nullptr. Note that this will not return a + /// tail-calling edge. + CallEdge *GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target); + /// Get accessor for the block list. /// /// \return @@ -564,6 +587,8 @@ protected: uint32_t m_prologue_byte_size; ///< Compute the prologue size once and cache it + // TODO: Use a layer of indirection to point to call edges, to save space + // when call info hasn't been parsed. bool m_call_edges_resolved = false; ///< Whether call site info has been /// parsed. std::vector<CallEdge> m_call_edges; ///< Outgoing call edges. |