aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Symbol
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2013-11-06 16:48:53 +0000
committerEd Maste <emaste@FreeBSD.org>2013-11-06 16:48:53 +0000
commitf21a844f60ae6c74fcf1fddca32461acce3c1ee0 (patch)
tree56d79f94966870db1cecd65a7264510a25fd1cba /include/lldb/Symbol
parent37d22554be9f5a677dad2a95b7ef22fe59c66a8a (diff)
downloadsrc-f21a844f60ae6c74fcf1fddca32461acce3c1ee0.tar.gz
src-f21a844f60ae6c74fcf1fddca32461acce3c1ee0.zip
Import lldb as of SVN r194122vendor/lldb/lldb-r194122
Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=257752 svn path=/vendor/lldb/lldb-r194122/; revision=257753; tag=vendor/lldb/lldb-r194122
Diffstat (limited to 'include/lldb/Symbol')
-rw-r--r--include/lldb/Symbol/Block.h1
-rw-r--r--include/lldb/Symbol/ClangASTImporter.h2
-rw-r--r--include/lldb/Symbol/ClangASTType.h13
-rw-r--r--include/lldb/Symbol/ClangNamespaceDecl.h4
-rw-r--r--include/lldb/Symbol/ObjectFile.h96
-rw-r--r--include/lldb/Symbol/Symbol.h33
-rw-r--r--include/lldb/Symbol/SymbolContext.h1
-rw-r--r--include/lldb/Symbol/Symtab.h4
-rw-r--r--include/lldb/Symbol/Type.h356
-rw-r--r--include/lldb/Symbol/TypeList.h1
10 files changed, 396 insertions, 115 deletions
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h
index a2d703b9069c..4a305e3cbbec 100644
--- a/include/lldb/Symbol/Block.h
+++ b/include/lldb/Symbol/Block.h
@@ -17,6 +17,7 @@
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/ClangASTType.h"
namespace lldb_private {
diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h
index 10df7da893a8..dc6ce6b5b95b 100644
--- a/include/lldb/Symbol/ClangASTImporter.h
+++ b/include/lldb/Symbol/ClangASTImporter.h
@@ -278,6 +278,8 @@ private:
clang::Decl *Imported (clang::Decl *from, clang::Decl *to);
+ clang::Decl *GetOriginalDecl (clang::Decl *To);
+
std::set<clang::NamedDecl *> *m_decls_to_deport;
std::set<clang::NamedDecl *> *m_decls_already_deported;
ClangASTImporter &m_master;
diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h
index d9e754e8ceb9..19b5d6ec6727 100644
--- a/include/lldb/Symbol/ClangASTType.h
+++ b/include/lldb/Symbol/ClangASTType.h
@@ -98,7 +98,7 @@ public:
// Tests
//----------------------------------------------------------------------
- operator bool () const
+ explicit operator bool () const
{
return m_type != NULL && m_ast != NULL;
}
@@ -155,6 +155,12 @@ public:
bool
IsFunctionType (bool *is_variadic_ptr = NULL) const;
+ size_t
+ GetNumberOfFunctionArguments () const;
+
+ ClangASTType
+ GetFunctionArgumentAtIndex (const size_t index);
+
bool
IsVariadicFunctionType () const;
@@ -195,6 +201,9 @@ public:
IsPointerToScalarType () const;
bool
+ IsRuntimeGeneratedType () const;
+
+ bool
IsPointerType (ClangASTType *pointee_type = NULL) const;
bool
@@ -249,7 +258,7 @@ public:
ConstString
GetConstTypeName () const;
- std::string
+ ConstString
GetTypeName () const;
uint32_t
diff --git a/include/lldb/Symbol/ClangNamespaceDecl.h b/include/lldb/Symbol/ClangNamespaceDecl.h
index d10ab2a29665..13a4c0011aff 100644
--- a/include/lldb/Symbol/ClangNamespaceDecl.h
+++ b/include/lldb/Symbol/ClangNamespaceDecl.h
@@ -10,6 +10,8 @@
#ifndef liblldb_ClangNamespaceDecl_h_
#define liblldb_ClangNamespaceDecl_h_
+#include <string>
+
#include "lldb/lldb-public.h"
#include "lldb/Core/ClangForward.h"
@@ -60,7 +62,7 @@ public:
/// /b True this object contains a valid namespace decl, \b
/// false otherwise.
//------------------------------------------------------------------
- operator bool() const
+ explicit operator bool() const
{
return m_ast != NULL && m_namespace_decl != NULL;
}
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index 8934c31bb988..ad500f5413b8 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -368,6 +368,34 @@ public:
GetSymtab () = 0;
//------------------------------------------------------------------
+ /// Appends a Symbol for the specified so_addr to the symbol table.
+ ///
+ /// If verify_unique is false, the symbol table is not searched
+ /// to determine if a Symbol found at this address has already been
+ /// added to the symbol table. When verify_unique is true, this
+ /// method resolves the Symbol as the first match in the SymbolTable
+ /// and appends a Symbol only if required/found.
+ ///
+ /// @return
+ /// The resolved symbol or nullptr. Returns nullptr if a
+ /// a Symbol could not be found for the specified so_addr.
+ //------------------------------------------------------------------
+ virtual Symbol *
+ ResolveSymbolForAddress(const Address &so_addr, bool verify_unique)
+ {
+ // Typically overridden to lazily add stripped symbols recoverable from
+ // the exception handling unwind information (i.e. without parsing
+ // the entire eh_frame section.
+ //
+ // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO
+ // to efficiently add stripped symbols when the symbol table is
+ // first constructed. Poorer cousins are PECoff and ELF.
+ return nullptr;
+ }
+
+ //------------------------------------------------------------------
+ /// Detect if this object file has been stripped of local symbols.
+ //------------------------------------------------------------------
/// Detect if this object file has been stripped of local symbols.
///
/// @return
@@ -478,7 +506,7 @@ public:
/// The address of any auxiliary tables, or an invalid address if this
/// object file format does not support or contain such information.
virtual lldb_private::Address
- GetImageInfoAddress () { return Address(); }
+ GetImageInfoAddress (Target *target) { return Address(); }
//------------------------------------------------------------------
/// Returns the address of the Entry Point in this object file - if
@@ -612,6 +640,72 @@ public:
}
return 0;
}
+
+ //------------------------------------------------------------------
+ /// Get the minimum OS version this object file can run on.
+ ///
+ /// Some object files have information that specifies the minimum OS
+ /// version that they can be used on.
+ ///
+ /// If \a versions is NULL, or if \a num_versions is 0, the return
+ /// value will indicate how many version numbers are available in
+ /// this object file. Then a subsequent call can be made to this
+ /// function with a value of \a versions and \a num_versions that
+ /// has enough storage to store some or all version numbers.
+ ///
+ /// @param[out] versions
+ /// A pointer to an array of uint32_t types that is \a num_versions
+ /// long. If this value is NULL, the return value will indicate
+ /// how many version numbers are required for a subsequent call
+ /// to this function so that all versions can be retrieved. If
+ /// the value is non-NULL, then at most \a num_versions of the
+ /// existing versions numbers will be filled into \a versions.
+ /// If there is no version information available, \a versions
+ /// will be filled with \a num_versions UINT32_MAX values
+ /// and zero will be returned.
+ ///
+ /// @param[in] num_versions
+ /// The maximum number of entries to fill into \a versions. If
+ /// this value is zero, then the return value will indicate
+ /// how many version numbers there are in total so another call
+ /// to this function can be make with adequate storage in
+ /// \a versions to get all of the version numbers. If \a
+ /// num_versions is less than the actual number of version
+ /// numbers in this object file, only \a num_versions will be
+ /// filled into \a versions (if \a versions is non-NULL).
+ ///
+ /// @return
+ /// This function always returns the number of version numbers
+ /// that this object file has regardless of the number of
+ /// version numbers that were copied into \a versions.
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetMinimumOSVersion (uint32_t *versions, uint32_t num_versions)
+ {
+ if (versions && num_versions)
+ {
+ for (uint32_t i=0; i<num_versions; ++i)
+ versions[i] = UINT32_MAX;
+ }
+ return 0;
+ }
+
+ //------------------------------------------------------------------
+ /// Get the SDK OS version this object file was built with.
+ ///
+ /// The versions arguments and returns values are the same as the
+ /// GetMinimumOSVersion()
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetSDKVersion (uint32_t *versions, uint32_t num_versions)
+ {
+ if (versions && num_versions)
+ {
+ for (uint32_t i=0; i<num_versions; ++i)
+ versions[i] = UINT32_MAX;
+ }
+ return 0;
+ }
//------------------------------------------------------------------
// Member Functions
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index 11c1cc7af9ab..75e0900ab640 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -122,6 +122,21 @@ public:
return m_mangled;
}
+ ConstString
+ GetReExportedSymbolName() const;
+
+ FileSpec
+ GetReExportedSymbolSharedLibrary () const;
+
+ bool
+ SetReExportedSymbolName(const ConstString &name);
+
+ bool
+ SetReExportedSymbolSharedLibrary (const FileSpec &fspec);
+
+ Symbol *
+ ResolveReExportedSymbol (Target &target);
+
uint32_t
GetSiblingIndex () const;
@@ -238,24 +253,6 @@ public:
m_size_is_sibling = b;
}
-// void
-// SetValue (Address &value)
-// {
-// m_addr_range.GetBaseAddress() = value;
-// }
-//
-// void
-// SetValue (const AddressRange &range)
-// {
-// m_addr_range = range;
-// }
-//
-// void
-// SetValue (lldb::addr_t value);
-// {
-// m_addr_range.GetBaseAddress().SetRawAddress(value);
-// }
-
// If m_type is "Code" or "Function" then this will return the prologue size
// in bytes, else it will return zero.
uint32_t
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index 5b12adebf5f5..a0501440f18c 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -16,7 +16,6 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Mangled.h"
-#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/LineEntry.h"
namespace lldb_private {
diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h
index 666c3b5686b9..5dfb1c822d51 100644
--- a/include/lldb/Symbol/Symtab.h
+++ b/include/lldb/Symbol/Symtab.h
@@ -95,6 +95,10 @@ public:
bool add_mangled,
NameToIndexMap &name_to_index_map) const;
+ ObjectFile * GetObjectFile()
+ {
+ return m_objfile;
+ }
protected:
typedef std::vector<Symbol> collection;
typedef collection::iterator iterator;
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index 50b22fe96b9d..920f571fa1e9 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -304,147 +304,236 @@ protected:
ResolveClangType (ResolveState clang_type_resolve_state);
};
+// these classes are used to back the SBType* objects
-///
-/// Sometimes you can find the name of the type corresponding to an object, but we don't have debug
-/// information for it. If that is the case, you can return one of these objects, and then if it
-/// has a full type, you can use that, but if not at least you can print the name for informational
-/// purposes.
-///
-
-class TypeAndOrName
-{
-public:
- TypeAndOrName ();
- TypeAndOrName (lldb::TypeSP &type_sp);
- TypeAndOrName (const char *type_str);
- TypeAndOrName (const TypeAndOrName &rhs);
- TypeAndOrName (ConstString &type_const_string);
+class TypePair {
+private:
+ ClangASTType clang_type;
+ lldb::TypeSP type_sp;
- TypeAndOrName &
- operator= (const TypeAndOrName &rhs);
+public:
+ TypePair () : clang_type(), type_sp() {}
+ TypePair (ClangASTType type) :
+ clang_type(type),
+ type_sp()
+ {
+ }
- bool
- operator==(const TypeAndOrName &other) const;
+ TypePair (lldb::TypeSP type) :
+ clang_type(),
+ type_sp(type)
+ {
+ clang_type = type_sp->GetClangForwardType();
+ }
bool
- operator!=(const TypeAndOrName &other) const;
-
- ConstString GetName () const;
-
- lldb::TypeSP
- GetTypeSP () const
+ IsValid () const
{
- return m_type_sp;
+ return clang_type.IsValid() || (type_sp.get() != nullptr);
}
- void
- SetName (const ConstString &type_name);
-
- void
- SetName (const char *type_name_cstr);
-
- void
- SetTypeSP (lldb::TypeSP type_sp);
-
- bool
- IsEmpty ();
+ explicit operator bool () const
+ {
+ return IsValid();
+ }
bool
- HasName ();
+ operator == (const TypePair& rhs) const
+ {
+ return clang_type == rhs.clang_type &&
+ type_sp.get() == rhs.type_sp.get();
+ }
bool
- HasTypeSP ();
+ operator != (const TypePair& rhs) const
+ {
+ return clang_type != rhs.clang_type ||
+ type_sp.get() != rhs.type_sp.get();
+ }
void
- Clear ();
+ Clear ()
+ {
+ clang_type.Clear();
+ type_sp.reset();
+ }
- operator
- bool ()
+ ConstString
+ GetName () const
{
- return !IsEmpty();
+ if (type_sp)
+ return type_sp->GetName();
+ if (clang_type)
+ return clang_type.GetTypeName();
+ return ConstString ();
}
-private:
- lldb::TypeSP m_type_sp;
- ConstString m_type_name;
-};
-
-// the two classes here are used by the public API as a backend to
-// the SBType and SBTypeList classes
+ void
+ SetType (ClangASTType type)
+ {
+ type_sp.reset();
+ clang_type = type;
+ }
-class TypeImpl
-{
-public:
+ void
+ SetType (lldb::TypeSP type)
+ {
+ type_sp = type;
+ clang_type = type_sp->GetClangForwardType();
+ }
- TypeImpl() :
- m_clang_ast_type(),
- m_type_sp()
+ lldb::TypeSP
+ GetTypeSP () const
{
+ return type_sp;
}
- TypeImpl(const TypeImpl& rhs) :
- m_clang_ast_type(rhs.m_clang_ast_type),
- m_type_sp(rhs.m_type_sp)
+ ClangASTType
+ GetClangASTType () const
{
+ return clang_type;
}
- TypeImpl(const lldb_private::ClangASTType& type);
+ ClangASTType
+ GetPointerType () const
+ {
+ if (type_sp)
+ return type_sp->GetClangLayoutType().GetPointerType();
+ return clang_type.GetPointerType();
+ }
- TypeImpl(const lldb::TypeSP& type);
+ ClangASTType
+ GetPointeeType () const
+ {
+ if (type_sp)
+ return type_sp->GetClangFullType().GetPointeeType();
+ return clang_type.GetPointeeType();
+ }
- TypeImpl&
- operator = (const TypeImpl& rhs);
+ ClangASTType
+ GetReferenceType () const
+ {
+ if (type_sp)
+ return type_sp->GetClangLayoutType().GetLValueReferenceType();
+ return clang_type.GetLValueReferenceType();
+ }
- bool
- operator == (const TypeImpl& rhs)
+ ClangASTType
+ GetDereferencedType () const
{
- return m_clang_ast_type == rhs.m_clang_ast_type && m_type_sp.get() == rhs.m_type_sp.get();
+ if (type_sp)
+ return type_sp->GetClangFullType().GetNonReferenceType();
+ return clang_type.GetNonReferenceType();
}
-
- bool
- operator != (const TypeImpl& rhs)
+
+ ClangASTType
+ GetUnqualifiedType () const
{
- return m_clang_ast_type != rhs.m_clang_ast_type || m_type_sp.get() != rhs.m_type_sp.get();
+ if (type_sp)
+ return type_sp->GetClangLayoutType().GetFullyUnqualifiedType();
+ return clang_type.GetFullyUnqualifiedType();
}
- bool
- IsValid()
+ ClangASTType
+ GetCanonicalType () const
{
- return m_type_sp.get() != NULL || m_clang_ast_type.IsValid();
+ if (type_sp)
+ return type_sp->GetClangFullType().GetCanonicalType();
+ return clang_type.GetCanonicalType();
}
- const lldb_private::ClangASTType &
- GetClangASTType() const
+ clang::ASTContext *
+ GetClangASTContext () const
{
- return m_clang_ast_type;
+ return clang_type.GetASTContext();
}
+};
- clang::ASTContext*
- GetASTContext();
+class TypeImpl
+{
+public:
+
+ TypeImpl();
+
+ ~TypeImpl () {}
+
+ TypeImpl(const TypeImpl& rhs);
+
+ TypeImpl (lldb::TypeSP type_sp);
+
+ TypeImpl (ClangASTType clang_type);
- lldb::clang_type_t
- GetOpaqueQualType();
+ TypeImpl (lldb::TypeSP type_sp, ClangASTType dynamic);
+
+ TypeImpl (ClangASTType clang_type, ClangASTType dynamic);
+
+ TypeImpl (TypePair pair, ClangASTType dynamic);
- lldb::TypeSP
- GetTypeSP ()
- {
- return m_type_sp;
- }
+ void
+ SetType (lldb::TypeSP type_sp);
+
+ void
+ SetType (ClangASTType clang_type);
+
+ void
+ SetType (lldb::TypeSP type_sp, ClangASTType dynamic);
+
+ void
+ SetType (ClangASTType clang_type, ClangASTType dynamic);
+
+ void
+ SetType (TypePair pair, ClangASTType dynamic);
+
+ TypeImpl&
+ operator = (const TypeImpl& rhs);
+
+ bool
+ operator == (const TypeImpl& rhs) const;
+
+ bool
+ operator != (const TypeImpl& rhs) const;
+
+ bool
+ IsValid() const;
+
+ explicit operator bool () const;
+
+ void Clear();
ConstString
- GetName ();
-
+ GetName () const;
+
+ TypeImpl
+ GetPointerType () const;
+
+ TypeImpl
+ GetPointeeType () const;
+
+ TypeImpl
+ GetReferenceType () const;
+
+ TypeImpl
+ GetDereferencedType () const;
+
+ TypeImpl
+ GetUnqualifiedType() const;
+
+ TypeImpl
+ GetCanonicalType() const;
+
+ ClangASTType
+ GetClangASTType (bool prefer_dynamic);
+
+ clang::ASTContext *
+ GetClangASTContext (bool prefer_dynamic);
+
bool
GetDescription (lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
- void
- SetType (const lldb::TypeSP &type_sp);
-
private:
- ClangASTType m_clang_ast_type;
- lldb::TypeSP m_type_sp;
+ TypePair m_static_type;
+ ClangASTType m_dynamic_type;
};
class TypeListImpl
@@ -590,6 +679,89 @@ protected:
};
+///
+/// Sometimes you can find the name of the type corresponding to an object, but we don't have debug
+/// information for it. If that is the case, you can return one of these objects, and then if it
+/// has a full type, you can use that, but if not at least you can print the name for informational
+/// purposes.
+///
+
+class TypeAndOrName
+{
+public:
+ TypeAndOrName ();
+ TypeAndOrName (lldb::TypeSP &type_sp);
+ TypeAndOrName (const ClangASTType &clang_type);
+ TypeAndOrName (const char *type_str);
+ TypeAndOrName (const TypeAndOrName &rhs);
+ TypeAndOrName (ConstString &type_const_string);
+
+ TypeAndOrName &
+ operator= (const TypeAndOrName &rhs);
+
+ bool
+ operator==(const TypeAndOrName &other) const;
+
+ bool
+ operator!=(const TypeAndOrName &other) const;
+
+ ConstString GetName () const;
+
+ lldb::TypeSP
+ GetTypeSP () const
+ {
+ return m_type_pair.GetTypeSP();
+ }
+
+ ClangASTType
+ GetClangASTType () const
+ {
+ return m_type_pair.GetClangASTType();
+ }
+
+ void
+ SetName (const ConstString &type_name);
+
+ void
+ SetName (const char *type_name_cstr);
+
+ void
+ SetTypeSP (lldb::TypeSP type_sp);
+
+ void
+ SetClangASTType (ClangASTType clang_type);
+
+ bool
+ IsEmpty () const;
+
+ bool
+ HasName () const;
+
+ bool
+ HasTypeSP () const;
+
+ bool
+ HasClangASTType () const;
+
+ bool
+ HasType () const
+ {
+ return HasTypeSP() || HasClangASTType();
+ }
+
+ void
+ Clear ();
+
+ explicit operator bool ()
+ {
+ return !IsEmpty();
+ }
+
+private:
+ TypePair m_type_pair;
+ ConstString m_type_name;
+};
+
} // namespace lldb_private
#endif // liblldb_Type_h_
diff --git a/include/lldb/Symbol/TypeList.h b/include/lldb/Symbol/TypeList.h
index 9c74db6bf1f4..be7d35482da0 100644
--- a/include/lldb/Symbol/TypeList.h
+++ b/include/lldb/Symbol/TypeList.h
@@ -13,6 +13,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Symbol/Type.h"
#include <map>
+#include <functional>
namespace lldb_private {