summaryrefslogtreecommitdiff
path: root/include/lldb/Symbol/Function.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Symbol/Function.h')
-rw-r--r--include/lldb/Symbol/Function.h251
1 files changed, 78 insertions, 173 deletions
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index 447abd2e6f78..f68a16705d93 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -1,9 +1,8 @@
//===-- Function.h ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -20,216 +19,182 @@
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class FunctionInfo Function.h "lldb/Symbol/Function.h"
+/// \class FunctionInfo Function.h "lldb/Symbol/Function.h"
/// A class that contains generic function information.
///
/// This provides generic function information that gets reused between inline
/// functions and function types.
-//----------------------------------------------------------------------
class FunctionInfo {
public:
- //------------------------------------------------------------------
/// Construct with the function method name and optional declaration
/// information.
///
- /// @param[in] name
+ /// \param[in] name
/// A C string name for the method name for this function. This
/// value should not be the mangled named, but the simple method
/// name.
///
- /// @param[in] decl_ptr
+ /// \param[in] decl_ptr
/// Optional declaration information that describes where the
/// function was declared. This can be NULL.
- //------------------------------------------------------------------
FunctionInfo(const char *name, const Declaration *decl_ptr);
- //------------------------------------------------------------------
/// Construct with the function method name and optional declaration
/// information.
///
- /// @param[in] name
+ /// \param[in] name
/// A name for the method name for this function. This value
/// should not be the mangled named, but the simple method name.
///
- /// @param[in] decl_ptr
+ /// \param[in] decl_ptr
/// Optional declaration information that describes where the
/// function was declared. This can be NULL.
- //------------------------------------------------------------------
- FunctionInfo(const ConstString &name, const Declaration *decl_ptr);
+ FunctionInfo(ConstString name, const Declaration *decl_ptr);
- //------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since classes inherit from this class.
- //------------------------------------------------------------------
virtual ~FunctionInfo();
- //------------------------------------------------------------------
/// Compare two function information objects.
///
/// First compares the method names, and if equal, then compares the
/// declaration information.
///
- /// @param[in] lhs
+ /// \param[in] lhs
/// The Left Hand Side const FunctionInfo object reference.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// The Right Hand Side const FunctionInfo object reference.
///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs);
- //------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
/// \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //------------------------------------------------------------------
void Dump(Stream *s, bool show_fullpaths) const;
- //------------------------------------------------------------------
/// Get accessor for the declaration information.
///
- /// @return
+ /// \return
/// A reference to the declaration object.
- //------------------------------------------------------------------
Declaration &GetDeclaration();
- //------------------------------------------------------------------
/// Get const accessor for the declaration information.
///
- /// @return
+ /// \return
/// A const reference to the declaration object.
- //------------------------------------------------------------------
const Declaration &GetDeclaration() const;
- //------------------------------------------------------------------
/// Get accessor for the method name.
///
- /// @return
+ /// \return
/// A const reference to the method name object.
- //------------------------------------------------------------------
ConstString GetName() const;
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
+ /// \see ConstString::StaticMemorySize ()
virtual size_t MemorySize() const;
protected:
- //------------------------------------------------------------------
// Member variables.
- //------------------------------------------------------------------
ConstString m_name; ///< Function method name (not a mangled name).
Declaration m_declaration; ///< Information describing where this function
///information was defined.
};
-//----------------------------------------------------------------------
-/// @class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
+/// \class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
/// A class that describes information for an inlined function.
-//----------------------------------------------------------------------
class InlineFunctionInfo : public FunctionInfo {
public:
- //------------------------------------------------------------------
/// Construct with the function method name, mangled name, and optional
/// declaration information.
///
- /// @param[in] name
+ /// \param[in] name
/// A C string name for the method name for this function. This
/// value should not be the mangled named, but the simple method
/// name.
///
- /// @param[in] mangled
+ /// \param[in] mangled
/// A C string name for the mangled name for this function. This
/// value can be NULL if there is no mangled information.
///
- /// @param[in] decl_ptr
+ /// \param[in] decl_ptr
/// Optional declaration information that describes where the
/// function was declared. This can be NULL.
///
- /// @param[in] call_decl_ptr
+ /// \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,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr);
- //------------------------------------------------------------------
/// Construct with the function method name, mangled name, and optional
/// declaration information.
///
- /// @param[in] name
+ /// \param[in] name
/// A name for the method name for this function. This value
/// should not be the mangled named, but the simple method name.
///
- /// @param[in] mangled
+ /// \param[in] mangled
/// A name for the mangled name for this function. This value
/// can be empty if there is no mangled information.
///
- /// @param[in] decl_ptr
+ /// \param[in] decl_ptr
/// Optional declaration information that describes where the
/// function was declared. This can be NULL.
///
- /// @param[in] call_decl_ptr
+ /// \param[in] call_decl_ptr
/// Optional calling location declaration information that
/// describes from where this inlined function was called.
- //------------------------------------------------------------------
- InlineFunctionInfo(const ConstString &name, const Mangled &mangled,
+ InlineFunctionInfo(ConstString name, const Mangled &mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr);
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~InlineFunctionInfo() override;
- //------------------------------------------------------------------
/// Compare two inlined function information objects.
///
/// First compares the FunctionInfo objects, and if equal, compares the
/// mangled names.
///
- /// @param[in] lhs
+ /// \param[in] lhs
/// The Left Hand Side const InlineFunctionInfo object
/// reference.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// The Right Hand Side const InlineFunctionInfo object
/// reference.
///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs);
- //------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
/// \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //------------------------------------------------------------------
void Dump(Stream *s, bool show_fullpaths) const;
void DumpStopContext(Stream *s, lldb::LanguageType language) const;
@@ -238,54 +203,42 @@ public:
ConstString GetDisplayName(lldb::LanguageType language) const;
- //------------------------------------------------------------------
/// Get accessor for the call site declaration information.
///
- /// @return
+ /// \return
/// A reference to the declaration object.
- //------------------------------------------------------------------
Declaration &GetCallSite();
- //------------------------------------------------------------------
/// Get const accessor for the call site declaration information.
///
- /// @return
+ /// \return
/// A const reference to the declaration object.
- //------------------------------------------------------------------
const Declaration &GetCallSite() const;
- //------------------------------------------------------------------
/// Get accessor for the mangled name object.
///
- /// @return
+ /// \return
/// A reference to the mangled name object.
- //------------------------------------------------------------------
Mangled &GetMangled();
- //------------------------------------------------------------------
/// Get const accessor for the mangled name object.
///
- /// @return
+ /// \return
/// A const reference to the mangled name object.
- //------------------------------------------------------------------
const Mangled &GetMangled() const;
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
+ /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const override;
private:
- //------------------------------------------------------------------
// Member variables.
- //------------------------------------------------------------------
Mangled m_mangled; ///< Mangled inlined function name (can be empty if there
///is no mangled information).
Declaration m_call_decl;
@@ -293,12 +246,10 @@ private:
class Function;
-//----------------------------------------------------------------------
-/// @class CallEdge Function.h "lldb/Symbol/Function.h"
+/// \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.
-//----------------------------------------------------------------------
class CallEdge {
public:
/// Construct a call edge using a symbol name to identify the calling
@@ -349,8 +300,7 @@ private:
DISALLOW_COPY_AND_ASSIGN(CallEdge);
};
-//----------------------------------------------------------------------
-/// @class Function Function.h "lldb/Symbol/Function.h"
+/// \class Function Function.h "lldb/Symbol/Function.h"
/// A class that describes a function.
///
/// Functions belong to CompileUnit objects (Function::m_comp_unit), have
@@ -362,61 +312,54 @@ private:
/// (Function::m_type), and contains lexical blocks (Function::m_blocks).
///
/// The function information is split into a few pieces:
-/// @li The concrete instance information
-/// @li The abstract information
+/// \li The concrete instance information
+/// \li The abstract information
///
/// The abstract information is found in the function type (Type) that
/// describes a function information, return type and parameter types.
///
/// The concrete information is the address range information and specific
/// locations for an instance of this function.
-//----------------------------------------------------------------------
class Function : public UserID, public SymbolContextScope {
public:
- //------------------------------------------------------------------
/// Construct with a compile unit, function UID, function type UID, optional
/// mangled name, function type, and a section offset based address range.
///
- /// @param[in] comp_unit
+ /// \param[in] comp_unit
/// The compile unit to which this function belongs.
///
- /// @param[in] func_uid
+ /// \param[in] func_uid
/// The UID for this function. This value is provided by the
/// SymbolFile plug-in and can be any value that allows
/// the plug-in to quickly find and parse more detailed
/// information when and if more information is needed.
///
- /// @param[in] func_type_uid
+ /// \param[in] func_type_uid
/// The type UID for the function Type to allow for lazy type
/// parsing from the debug information.
///
- /// @param[in] mangled
+ /// \param[in] mangled
/// The optional mangled name for this function. If empty, there
/// is no mangled information.
///
- /// @param[in] func_type
+ /// \param[in] func_type
/// The optional function type. If NULL, the function type will
/// be parsed on demand when accessed using the
/// Function::GetType() function by asking the SymbolFile
/// plug-in to get the type for \a func_type_uid.
///
- /// @param[in] range
+ /// \param[in] range
/// The section offset based address for this function.
- //------------------------------------------------------------------
Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
Type *func_type, const AddressRange &range);
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~Function() override;
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
+ /// \see SymbolContextScope
void CalculateSymbolContext(SymbolContext *sc) override;
lldb::ModuleSP CalculateSymbolContextModule() override;
@@ -428,89 +371,71 @@ public:
const AddressRange &GetAddressRange() { return m_range; }
lldb::LanguageType GetLanguage() const;
- //------------------------------------------------------------------
/// Find the file and line number of the source location of the start of the
/// function. This will use the declaration if present and fall back on the
/// line table if that fails. So there may NOT be a line table entry for
/// this source file/line combo.
///
- /// @param[out] source_file
+ /// \param[out] source_file
/// The source file.
///
- /// @param[out] line_no
+ /// \param[out] line_no
/// The line number.
- //------------------------------------------------------------------
void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
- //------------------------------------------------------------------
/// Find the file and line number of the source location of the end of the
/// function.
///
///
- /// @param[out] source_file
+ /// \param[out] source_file
/// The source file.
///
- /// @param[out] line_no
+ /// \param[out] line_no
/// The line number.
- //------------------------------------------------------------------
void GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
- //------------------------------------------------------------------
/// Get the outgoing call edges from this function, sorted by their return
/// PC addresses (in increasing order).
- //------------------------------------------------------------------
llvm::MutableArrayRef<CallEdge> GetCallEdges();
- //------------------------------------------------------------------
/// Get the outgoing tail-calling edges from this function. If none exist,
/// return None.
- //------------------------------------------------------------------
llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
- //------------------------------------------------------------------
/// Get accessor for the block list.
///
- /// @return
+ /// \return
/// The block list object that describes all lexical blocks
/// in the function.
///
- /// @see BlockList
- //------------------------------------------------------------------
+ /// \see BlockList
Block &GetBlock(bool can_create);
- //------------------------------------------------------------------
/// Get accessor for the compile unit that owns this function.
///
- /// @return
+ /// \return
/// A compile unit object pointer.
- //------------------------------------------------------------------
CompileUnit *GetCompileUnit();
- //------------------------------------------------------------------
/// Get const accessor for the compile unit that owns this function.
///
- /// @return
+ /// \return
/// A const compile unit object pointer.
- //------------------------------------------------------------------
const CompileUnit *GetCompileUnit() const;
void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
- //------------------------------------------------------------------
/// Get accessor for the frame base location.
///
- /// @return
+ /// \return
/// A location expression that describes the function frame
/// base.
- //------------------------------------------------------------------
DWARFExpression &GetFrameBaseExpression() { return m_frame_base; }
- //------------------------------------------------------------------
/// Get const accessor for the frame base location.
///
- /// @return
+ /// \return
/// A const compile unit object pointer.
- //------------------------------------------------------------------
const DWARFExpression &GetFrameBaseExpression() const { return m_frame_base; }
ConstString GetName() const;
@@ -521,79 +446,64 @@ public:
const Mangled &GetMangled() const { return m_mangled; }
- //------------------------------------------------------------------
/// Get the DeclContext for this function, if available.
///
- /// @return
+ /// \return
/// The DeclContext, or NULL if none exists.
- //------------------------------------------------------------------
CompilerDeclContext GetDeclContext();
- //------------------------------------------------------------------
/// Get accessor for the type that describes the function return value type,
/// and parameter types.
///
- /// @return
+ /// \return
/// A type object pointer.
- //------------------------------------------------------------------
Type *GetType();
- //------------------------------------------------------------------
/// Get const accessor for the type that describes the function return value
/// type, and parameter types.
///
- /// @return
+ /// \return
/// A const type object pointer.
- //------------------------------------------------------------------
const Type *GetType() const;
CompilerType GetCompilerType();
- //------------------------------------------------------------------
/// Get the size of the prologue instructions for this function. The
/// "prologue" instructions include any instructions given line number 0
/// immediately following the prologue end.
///
- /// @return
+ /// \return
/// The size of the prologue.
- //------------------------------------------------------------------
uint32_t GetPrologueByteSize();
- //------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
/// \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
///
- /// @param[in] show_context
+ /// \param[in] show_context
/// If \b true, variables will dump their symbol context
/// information.
- //------------------------------------------------------------------
void Dump(Stream *s, bool show_context) const;
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
+ /// \see SymbolContextScope
void DumpSymbolContext(Stream *s) override;
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
/// The returned value does not include the bytes for any
/// shared string values.
///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
+ /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
- //------------------------------------------------------------------
/// Get whether compiler optimizations were enabled for this function
///
/// The debug information may provide information about whether this
@@ -603,14 +513,12 @@ public:
/// would expect them, stepping through the source lines in the function may
/// appear strange, etc.
///
- /// @return
+ /// \return
/// Returns 'true' if this function was compiled with
/// optimization. 'false' indicates that either the optimization
/// is unknown, or this function was built without optimization.
- //------------------------------------------------------------------
bool GetIsOptimized();
- //------------------------------------------------------------------
/// Get whether this function represents a 'top-level' function
///
/// The concept of a top-level function is language-specific, mostly meant
@@ -621,10 +529,9 @@ public:
/// If stopped in a top-level function, LLDB will expose global variables
/// as-if locals in the 'frame variable' command
///
- /// @return
+ /// \return
/// Returns 'true' if this function is a top-level function,
/// 'false' otherwise.
- //------------------------------------------------------------------
bool IsTopLevelFunction();
lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx,
@@ -640,9 +547,7 @@ protected:
(1 << 0) ///< Have we already tried to calculate the prologue size?
};
- //------------------------------------------------------------------
// Member variables.
- //------------------------------------------------------------------
CompileUnit *m_comp_unit; ///< The compile unit that owns this function.
lldb::user_id_t
m_type_uid; ///< The user ID of for the prototype Type for this function.