A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info. When we run across a class/struct/union definition in the DWARF, we will only parse the full definition if we need to. This works fine for top level types that are assigned directly to variables and arguments, but when we have a variable with a class, lets say "A" for this example, that has a member: "B *m_b". Initially we don't need to hunt down a definition for this class unless we are ever asked to do something with it ("expr m_b->getDecl()" for example). With my previous approach to lazy type completion, we would be able to take a "A *a" and get a complete type for it, but we wouldn't be able to then do an "a->m_b->getDecl()" unless we always expanded all types within a class prior to handing out the type. Expanding everything is very costly and it would be great if there were a better way. A few months ago I worked with the llvm/clang folks to have the ExternalASTSource class be able to complete classes if there weren't completed yet: class ExternalASTSource { .... virtual void CompleteType (clang::TagDecl *Tag); virtual void CompleteType (clang::ObjCInterfaceDecl *Class); }; This was great, because we can now have the class that is producing the AST (SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources and the object that creates the forward declaration types can now also complete them anywhere within the clang type system. This patch makes a few major changes: - lldb_private::Module classes now own the AST context. Previously the TypeList objects did. - The DWARF parsers now sign up as an external AST sources so they can complete types. - All of the pure clang type system wrapper code we have in LLDB (ClangASTContext, ClangASTType, and more) can now be iterating through children of any type, and if a class/union/struct type (clang::RecordType or ObjC interface) is found that is incomplete, we can ask the AST to get the definition. - The SymbolFileDWARFDebugMap class now will create and use a single AST that all child SymbolFileDWARF classes will share (much like what happens when we have a complete linked DWARF for an executable). We will need to modify some of the ClangUserExpression code to take more advantage of this completion ability in the near future. Meanwhile we should be better off now that we can be accessing any children of variables through pointers and always be able to resolve the clang type if needed. llvm-svn: 123613
This commit is contained in:
parent
0acd4cfc33
commit
6beaaa680a
|
@ -107,6 +107,9 @@ public:
|
|||
bool
|
||||
GetExpressionPath (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
|
||||
|
||||
protected:
|
||||
friend class SBValueList;
|
||||
friend class SBFrame;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/TimeValue.h"
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/CompileUnit.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
#include "lldb/Symbol/Symtab.h"
|
||||
|
@ -561,6 +562,9 @@ public:
|
|||
m_is_dynamic_loader_module = b;
|
||||
}
|
||||
|
||||
ClangASTContext &
|
||||
GetClangASTContext ();
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member Variables
|
||||
|
@ -573,9 +577,11 @@ protected:
|
|||
ConstString m_object_name; ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file.
|
||||
std::auto_ptr<ObjectFile> m_objfile_ap; ///< A pointer to the object file parser for this module.
|
||||
std::auto_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
|
||||
ClangASTContext m_ast; ///< The AST context for this module.
|
||||
bool m_did_load_objfile:1,
|
||||
m_did_load_symbol_vendor:1,
|
||||
m_did_parse_uuid:1,
|
||||
m_did_init_ast:1,
|
||||
m_is_dynamic_loader_module:1;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST () = 0;
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType () = 0;
|
||||
|
||||
virtual lldb::ValueType
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void
|
||||
GetExpressionPath (Stream &s);
|
||||
GetExpressionPath (Stream &s, bool qualify_cxx_base_classes);
|
||||
|
||||
virtual bool
|
||||
IsInScope (StackFrame *frame)
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
return m_clang_ast;
|
||||
}
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ()
|
||||
{
|
||||
return m_clang_type;
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST ();
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ();
|
||||
|
||||
virtual lldb::ValueType
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST ();
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ();
|
||||
|
||||
virtual lldb::ValueType
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST ();
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ();
|
||||
|
||||
virtual lldb::ValueType
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST ();
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ();
|
||||
|
||||
virtual lldb::ValueType
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
virtual clang::ASTContext *
|
||||
GetClangAST ();
|
||||
|
||||
virtual void *
|
||||
virtual lldb::clang_type_t
|
||||
GetClangType ();
|
||||
|
||||
virtual ConstString
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <set>
|
||||
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "clang/Sema/ExternalSemaSource.h"
|
||||
#include "clang/AST/ExternalASTSource.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -30,7 +30,7 @@ class ClangExpressionDeclMap;
|
|||
/// to Clang for these names, consulting the ClangExpressionDeclMap to do
|
||||
/// the actual lookups.
|
||||
//----------------------------------------------------------------------
|
||||
class ClangASTSource : public clang::ExternalSemaSource
|
||||
class ClangASTSource : public clang::ExternalASTSource
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
/// @param[in] declMap
|
||||
/// A reference to the LLDB object that handles entity lookup.
|
||||
//------------------------------------------------------------------
|
||||
ClangASTSource(clang::ASTContext &context,
|
||||
ClangExpressionDeclMap &decl_map) :
|
||||
ClangASTSource (clang::ASTContext &context,
|
||||
ClangExpressionDeclMap &decl_map) :
|
||||
m_ast_context (context),
|
||||
m_decl_map (decl_map),
|
||||
m_active_lookups ()
|
||||
|
@ -60,27 +60,59 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns NULL.
|
||||
//------------------------------------------------------------------
|
||||
clang::Decl *GetExternalDecl(uint32_t);
|
||||
virtual clang::Decl *
|
||||
GetExternalDecl(uint32_t)
|
||||
{
|
||||
// These are only required for AST source that want to lazily load
|
||||
// the declarations (or parts thereof) that they return.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns NULL.
|
||||
//------------------------------------------------------------------
|
||||
clang::Stmt *GetExternalDeclStmt(uint64_t);
|
||||
virtual clang::Stmt *
|
||||
GetExternalDeclStmt(uint64_t)
|
||||
{
|
||||
// These are only required for AST source that want to lazily load
|
||||
// the declarations (or parts thereof) that they return.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns an undifferentiated Selector.
|
||||
//------------------------------------------------------------------
|
||||
clang::Selector GetExternalSelector(uint32_t);
|
||||
virtual clang::Selector
|
||||
GetExternalSelector(uint32_t)
|
||||
{
|
||||
// These are also optional, although it might help with ObjC
|
||||
// debugging if we have respectable signatures. But a more
|
||||
// efficient interface (that didn't require scanning all files
|
||||
// for method signatures!) might help.
|
||||
return clang::Selector();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns 0.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t GetNumExternalSelectors();
|
||||
virtual uint32_t
|
||||
GetNumExternalSelectors()
|
||||
{
|
||||
// These are also optional, although it might help with ObjC
|
||||
// debugging if we have respectable signatures. But a more
|
||||
// efficient interface (that didn't require scanning all files
|
||||
// for method signatures!) might help.
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns NULL.
|
||||
//------------------------------------------------------------------
|
||||
clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset);
|
||||
virtual clang::CXXBaseSpecifier *
|
||||
GetExternalCXXBaseSpecifiers(uint64_t Offset)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Look up all Decls that match a particular name. Only handles
|
||||
|
@ -96,21 +128,30 @@ public:
|
|||
/// @return
|
||||
/// Whatever SetExternalVisibleDeclsForName returns.
|
||||
//------------------------------------------------------------------
|
||||
clang::DeclContextLookupResult
|
||||
virtual clang::DeclContextLookupResult
|
||||
FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
|
||||
clang::DeclarationName Name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub.
|
||||
//------------------------------------------------------------------
|
||||
void MaterializeVisibleDecls (const clang::DeclContext *DC);
|
||||
virtual void
|
||||
MaterializeVisibleDecls (const clang::DeclContext *DC);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface stub that returns true.
|
||||
//------------------------------------------------------------------
|
||||
bool FindExternalLexicalDecls (const clang::DeclContext *DC,
|
||||
bool (*isKindWeWant)(clang::Decl::Kind),
|
||||
llvm::SmallVectorImpl<clang::Decl*> &Decls);
|
||||
virtual bool
|
||||
FindExternalLexicalDecls (const clang::DeclContext *DC,
|
||||
bool (*isKindWeWant)(clang::Decl::Kind),
|
||||
llvm::SmallVectorImpl<clang::Decl*> &Decls);
|
||||
|
||||
|
||||
virtual void
|
||||
CompleteType (clang::TagDecl *Tag);
|
||||
|
||||
virtual void
|
||||
CompleteType (clang::ObjCInterfaceDecl *Class);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Called on entering a translation unit. Tells Clang by calling
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "lldb/lldb-include.h"
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/Core/Value.h"
|
||||
#include "lldb/Expression/ClangExpressionVariable.h"
|
||||
|
@ -27,20 +28,8 @@
|
|||
#include "lldb/Symbol/SymbolContext.h"
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
|
||||
namespace llvm {
|
||||
class Type;
|
||||
class Value;
|
||||
}
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class ClangExpressionVariables;
|
||||
class ClangPersistentVariables;
|
||||
class Error;
|
||||
class Function;
|
||||
class NameSearchContext;
|
||||
class Variable;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class ClangExpressionDeclMap ClangExpressionDeclMap.h "lldb/Expression/ClangExpressionDeclMap.h"
|
||||
/// @brief Manages named entities that are defined in LLDB's debug information.
|
||||
|
@ -430,12 +419,20 @@ public:
|
|||
/// True if a $__lldb variable has been found.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
GetLookupsEnabled ()
|
||||
GetLookupsEnabled () const
|
||||
{
|
||||
assert(m_parser_vars.get());
|
||||
return m_parser_vars->m_enable_lookups;
|
||||
}
|
||||
|
||||
bool
|
||||
GetImportInProgress () const
|
||||
{
|
||||
if (m_parser_vars.get())
|
||||
return m_parser_vars->m_ignore_lookups;
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// [Used by ClangASTSource] Indicate that a $__lldb variable has
|
||||
/// been found.
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
|
@ -50,10 +52,13 @@ public:
|
|||
eTypeIsVector = (1u << 16)
|
||||
};
|
||||
|
||||
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
|
||||
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
ClangASTContext(const char *target_triple);
|
||||
ClangASTContext (const char *triple = NULL);
|
||||
|
||||
~ClangASTContext();
|
||||
|
||||
|
@ -99,6 +104,22 @@ public:
|
|||
void
|
||||
SetTargetTriple (const char *target_triple);
|
||||
|
||||
bool
|
||||
HasExternalSource ();
|
||||
|
||||
void
|
||||
SetExternalSource (llvm::OwningPtr<clang::ExternalASTSource> &ast_source_ap);
|
||||
|
||||
void
|
||||
RemoveExternalSource ();
|
||||
|
||||
bool
|
||||
GetCompleteType (lldb::clang_type_t clang_type);
|
||||
|
||||
static bool
|
||||
GetCompleteType (clang::ASTContext *ast,
|
||||
lldb::clang_type_t clang_type);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Basic Types
|
||||
//------------------------------------------------------------------
|
||||
|
@ -108,7 +129,7 @@ public:
|
|||
uint32_t bit_size);
|
||||
|
||||
static lldb::clang_type_t
|
||||
GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast_context,
|
||||
GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast,
|
||||
lldb::Encoding encoding,
|
||||
uint32_t bit_size);
|
||||
|
||||
|
@ -119,7 +140,7 @@ public:
|
|||
uint32_t bit_size);
|
||||
|
||||
static lldb::clang_type_t
|
||||
GetBuiltInType_void(clang::ASTContext *ast_context);
|
||||
GetBuiltInType_void(clang::ASTContext *ast);
|
||||
|
||||
lldb::clang_type_t
|
||||
GetBuiltInType_void()
|
||||
|
@ -146,7 +167,7 @@ public:
|
|||
GetVoidPtrType(bool is_const);
|
||||
|
||||
static lldb::clang_type_t
|
||||
GetVoidPtrType(clang::ASTContext *ast_context, bool is_const);
|
||||
GetVoidPtrType(clang::ASTContext *ast, bool is_const);
|
||||
|
||||
static lldb::clang_type_t
|
||||
CopyType(clang::ASTContext *dest_context,
|
||||
|
@ -159,7 +180,7 @@ public:
|
|||
clang::Decl *source_decl);
|
||||
|
||||
static bool
|
||||
AreTypesSame(clang::ASTContext *ast_context,
|
||||
AreTypesSame(clang::ASTContext *ast,
|
||||
lldb::clang_type_t type1,
|
||||
lldb::clang_type_t type2);
|
||||
|
||||
|
@ -170,6 +191,13 @@ public:
|
|||
return ClangASTContext::AreTypesSame(getASTContext(), type1, type2);
|
||||
}
|
||||
|
||||
|
||||
lldb::clang_type_t
|
||||
GetTypeForDecl (clang::TagDecl *decl);
|
||||
|
||||
lldb::clang_type_t
|
||||
GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// CVR modifiers
|
||||
//------------------------------------------------------------------
|
||||
|
@ -194,7 +222,7 @@ public:
|
|||
lldb::LanguageType language);
|
||||
|
||||
static bool
|
||||
AddFieldToRecordType (clang::ASTContext *ast_context,
|
||||
AddFieldToRecordType (clang::ASTContext *ast,
|
||||
lldb::clang_type_t record_qual_type,
|
||||
const char *name,
|
||||
lldb::clang_type_t field_type,
|
||||
|
@ -217,7 +245,7 @@ public:
|
|||
}
|
||||
|
||||
static clang::CXXMethodDecl *
|
||||
AddMethodToCXXRecordType (clang::ASTContext *ast_context,
|
||||
AddMethodToCXXRecordType (clang::ASTContext *ast,
|
||||
lldb::clang_type_t record_opaque_type,
|
||||
const char *name,
|
||||
lldb::clang_type_t method_type,
|
||||
|
@ -254,7 +282,7 @@ public:
|
|||
uint32_t& bitfield_bit_size);
|
||||
|
||||
static bool
|
||||
FieldIsBitfield (clang::ASTContext *ast_context,
|
||||
FieldIsBitfield (clang::ASTContext *ast,
|
||||
clang::FieldDecl* field,
|
||||
uint32_t& bitfield_bit_size);
|
||||
|
||||
|
@ -274,7 +302,7 @@ public:
|
|||
bool isInternal);
|
||||
|
||||
static bool
|
||||
AddObjCClassIVar (clang::ASTContext *ast_context,
|
||||
AddObjCClassIVar (clang::ASTContext *ast,
|
||||
lldb::clang_type_t class_opaque_type,
|
||||
const char *name,
|
||||
lldb::clang_type_t ivar_opaque_type,
|
||||
|
@ -312,7 +340,7 @@ public:
|
|||
|
||||
|
||||
static clang::ObjCMethodDecl *
|
||||
AddMethodToObjCObjectType (clang::ASTContext *ast_context,
|
||||
AddMethodToObjCObjectType (clang::ASTContext *ast,
|
||||
lldb::clang_type_t class_opaque_type,
|
||||
const char *name, // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
|
||||
lldb::clang_type_t method_opaque_type,
|
||||
|
@ -331,6 +359,8 @@ public:
|
|||
access);
|
||||
}
|
||||
|
||||
static bool
|
||||
SetHasExternalStorage (lldb::clang_type_t clang_type, bool has_extern);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Aggregate Types
|
||||
|
@ -341,11 +371,12 @@ public:
|
|||
// Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
|
||||
static uint32_t
|
||||
GetTypeInfo (lldb::clang_type_t clang_type,
|
||||
clang::ASTContext *ast_context, // The AST for clang_type (can be NULL)
|
||||
clang::ASTContext *ast, // The AST for clang_type (can be NULL)
|
||||
lldb::clang_type_t *pointee_or_element_type); // (can be NULL)
|
||||
|
||||
static uint32_t
|
||||
GetNumChildren (lldb::clang_type_t clang_type,
|
||||
GetNumChildren (clang::ASTContext *ast,
|
||||
lldb::clang_type_t clang_type,
|
||||
bool omit_empty_base_classes);
|
||||
|
||||
static uint32_t
|
||||
|
@ -365,7 +396,7 @@ public:
|
|||
bool &child_is_base_class);
|
||||
|
||||
static lldb::clang_type_t
|
||||
GetChildClangTypeAtIndex (clang::ASTContext *ast_context,
|
||||
GetChildClangTypeAtIndex (clang::ASTContext *ast,
|
||||
const char *parent_name,
|
||||
lldb::clang_type_t parent_clang_type,
|
||||
uint32_t idx,
|
||||
|
@ -381,7 +412,7 @@ public:
|
|||
// Lookup a child given a name. This function will match base class names
|
||||
// and member member names in "clang_type" only, not descendants.
|
||||
static uint32_t
|
||||
GetIndexOfChildWithName (clang::ASTContext *ast_context,
|
||||
GetIndexOfChildWithName (clang::ASTContext *ast,
|
||||
lldb::clang_type_t clang_type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes);
|
||||
|
@ -392,7 +423,7 @@ public:
|
|||
// TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
|
||||
// so we catch all names that match a given child name, not just the first.
|
||||
static size_t
|
||||
GetIndexOfChildMemberWithName (clang::ASTContext *ast_context,
|
||||
GetIndexOfChildMemberWithName (clang::ASTContext *ast,
|
||||
lldb::clang_type_t clang_type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes,
|
||||
|
@ -452,7 +483,7 @@ public:
|
|||
bool is_inline);
|
||||
|
||||
static lldb::clang_type_t
|
||||
CreateFunctionType (clang::ASTContext *ast_context,
|
||||
CreateFunctionType (clang::ASTContext *ast,
|
||||
lldb::clang_type_t result_type,
|
||||
lldb::clang_type_t *args,
|
||||
unsigned num_args,
|
||||
|
@ -611,7 +642,7 @@ public:
|
|||
GetArraySize (lldb::clang_type_t clang_type);
|
||||
|
||||
//static bool
|
||||
//ConvertFloatValueToString (clang::ASTContext *ast_context,
|
||||
//ConvertFloatValueToString (clang::ASTContext *ast,
|
||||
// lldb::clang_type_t clang_type,
|
||||
// const uint8_t* bytes,
|
||||
// size_t byte_size,
|
||||
|
@ -619,7 +650,7 @@ public:
|
|||
// std::string &float_str);
|
||||
|
||||
static size_t
|
||||
ConvertStringToFloatValue (clang::ASTContext *ast_context,
|
||||
ConvertStringToFloatValue (clang::ASTContext *ast,
|
||||
lldb::clang_type_t clang_type,
|
||||
const char *s,
|
||||
uint8_t *dst,
|
||||
|
@ -635,7 +666,7 @@ protected:
|
|||
// Classes that inherit from ClangASTContext can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
std::string m_target_triple;
|
||||
std::auto_ptr<clang::ASTContext> m_ast_context_ap;
|
||||
std::auto_ptr<clang::ASTContext> m_ast_ap;
|
||||
std::auto_ptr<clang::LangOptions> m_language_options_ap;
|
||||
std::auto_ptr<clang::FileManager> m_file_manager_ap;
|
||||
std::auto_ptr<clang::FileSystemOptions> m_file_system_options_ap;
|
||||
|
@ -647,7 +678,9 @@ protected:
|
|||
std::auto_ptr<clang::IdentifierTable> m_identifier_table_ap;
|
||||
std::auto_ptr<clang::SelectorTable> m_selector_table_ap;
|
||||
std::auto_ptr<clang::Builtin::Context> m_builtins_ap;
|
||||
|
||||
CompleteTagDeclCallback m_callback_tag_decl;
|
||||
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
|
||||
void * m_callback_baton;
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For ClangASTContext only
|
||||
|
|
|
@ -56,8 +56,48 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a mask of what this symbol file supports for the object file
|
||||
/// that it was constructed with.
|
||||
///
|
||||
/// Each symbol file gets to respond with a mask of abilities that
|
||||
/// it supports for each object file. This happens when we are
|
||||
/// trying to figure out which symbol file plug-in will get used
|
||||
/// for a given object file. The plug-in that resoonds with the
|
||||
/// best mix of "SymbolFile::Abilities" bits set, will get chosen to
|
||||
/// be the symbol file parser. This allows each plug-in to check for
|
||||
/// sections that contain data a symbol file plug-in would need. For
|
||||
/// example the DWARF plug-in requires DWARF sections in a file that
|
||||
/// contain debug information. If the DWARF plug-in doesn't find
|
||||
/// these sections, it won't respond with many ability bits set, and
|
||||
/// we will probably fall back to the symbol table SymbolFile plug-in
|
||||
/// which uses any information in the symbol table. Also, plug-ins
|
||||
/// might check for some specific symbols in a symbol table in the
|
||||
/// case where the symbol table contains debug information (STABS
|
||||
/// and COFF). Not a lot of work should happen in these functions
|
||||
/// as the plug-in might not get selected due to another plug-in
|
||||
/// having more abilities. Any initialization work should be saved
|
||||
/// for "void SymbolFile::InitializeObject()" which will get called
|
||||
/// on the SymbolFile object with the best set of abilities.
|
||||
///
|
||||
/// @return
|
||||
/// A uint32_t mask containing bits from the SymbolFile::Abilities
|
||||
/// enumeration. Any bits that are set represent an ability that
|
||||
/// this symbol plug-in can parse from the object file.
|
||||
///------------------------------------------------------------------
|
||||
virtual uint32_t GetAbilities () = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Initialize the SymbolFile object.
|
||||
///
|
||||
/// The SymbolFile object with the best set of abilities (detected
|
||||
/// in "uint32_t SymbolFile::GetAbilities()) will have this function
|
||||
/// called if it is chosen to parse an object file. More complete
|
||||
/// initialization can happen in this function which will get called
|
||||
/// prior to any other functions in the SymbolFile protocol.
|
||||
//------------------------------------------------------------------
|
||||
virtual void InitializeObject() {}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Compile Unit function calls
|
||||
//------------------------------------------------------------------
|
||||
|
@ -83,6 +123,8 @@ public:
|
|||
virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) = 0;
|
||||
// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0;
|
||||
virtual TypeList * GetTypeList ();
|
||||
virtual ClangASTContext &
|
||||
GetClangASTContext ();
|
||||
virtual ClangNamespaceDecl
|
||||
FindNamespace (const SymbolContext& sc,
|
||||
const ConstString &name) = 0;
|
||||
|
@ -90,7 +132,7 @@ public:
|
|||
ObjectFile* GetObjectFile() { return m_obj_file; }
|
||||
const ObjectFile* GetObjectFile() const { return m_obj_file; }
|
||||
protected:
|
||||
ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
|
||||
ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (SymbolFile);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace lldb_private
|
|||
template <unsigned int C> class TaggedASTType : public ClangASTType
|
||||
{
|
||||
public:
|
||||
TaggedASTType (void *type, clang::ASTContext *ast_context) :
|
||||
TaggedASTType (lldb::clang_type_t type, clang::ASTContext *ast_context) :
|
||||
ClangASTType(type, ast_context) { }
|
||||
|
||||
TaggedASTType (const TaggedASTType<C> &tw) :
|
||||
|
|
|
@ -226,6 +226,21 @@ public:
|
|||
uint32_t
|
||||
GetEncodingMask ();
|
||||
|
||||
void *
|
||||
CreateClangPointerType (Type *type);
|
||||
|
||||
void *
|
||||
CreateClangTypedefType (Type *typedef_type, Type *base_type);
|
||||
|
||||
// For C++98 references (&)
|
||||
void *
|
||||
CreateClangLValueReferenceType (Type *type);
|
||||
|
||||
// For C++0x references (&&)
|
||||
void *
|
||||
CreateClangRValueReferenceType (Type *type);
|
||||
|
||||
|
||||
protected:
|
||||
ConstString m_name;
|
||||
SymbolFile *m_symbol_file;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define liblldb_TypeList_h_
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/Type.h"
|
||||
#include <map>
|
||||
|
||||
|
@ -23,7 +22,7 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
TypeList(const char *target_triple = NULL);
|
||||
TypeList();
|
||||
|
||||
virtual
|
||||
~TypeList();
|
||||
|
@ -52,31 +51,10 @@ public:
|
|||
lldb::TypeSP
|
||||
GetTypeAtIndex(uint32_t idx);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from TypeList can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
ClangASTContext &
|
||||
GetClangASTContext ();
|
||||
|
||||
void *
|
||||
CreateClangPointerType (Type *type);
|
||||
|
||||
void *
|
||||
CreateClangTypedefType (Type *typedef_type, Type *base_type);
|
||||
|
||||
// For C++98 references (&)
|
||||
void *
|
||||
CreateClangLValueReferenceType (Type *type);
|
||||
|
||||
// For C++0x references (&&)
|
||||
void *
|
||||
CreateClangRValueReferenceType (Type *type);
|
||||
|
||||
private:
|
||||
typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
|
||||
typedef collection::iterator iterator;
|
||||
typedef collection::const_iterator const_iterator;
|
||||
ClangASTContext m_ast; ///< The type abtract syntax tree.
|
||||
|
||||
collection m_types;
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ class ClangExpressionDeclMap;
|
|||
class ClangExpressionVariable;
|
||||
class ClangExpressionVariableList;
|
||||
class ClangExpressionVariableList;
|
||||
class ClangExpressionVariables;
|
||||
class ClangPersistentVariables;
|
||||
class CommandInterpreter;
|
||||
class CommandObject;
|
||||
class CommandReturnObject;
|
||||
|
@ -90,6 +92,7 @@ class Mangled;
|
|||
class Module;
|
||||
class ModuleList;
|
||||
class Mutex;
|
||||
class NameSearchContext;
|
||||
class ObjCLanguageRuntime;
|
||||
class ObjectContainer;
|
||||
class ObjectFile;
|
||||
|
|
|
@ -305,6 +305,8 @@
|
|||
26DE20611161902700A093E2 /* SBBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DE20601161902600A093E2 /* SBBlock.cpp */; };
|
||||
26DE20631161904200A093E2 /* SBLineEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DE20621161904200A093E2 /* SBLineEntry.cpp */; };
|
||||
26DE20651161904E00A093E2 /* SBSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DE20641161904E00A093E2 /* SBSymbol.cpp */; };
|
||||
26E6902F129C6BD500DDECD9 /* ClangExternalASTSourceCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6902E129C6BD500DDECD9 /* ClangExternalASTSourceCallbacks.h */; };
|
||||
26E69031129C6BEF00DDECD9 /* ClangExternalASTSourceCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E69030129C6BEF00DDECD9 /* ClangExternalASTSourceCallbacks.cpp */; };
|
||||
26F5C27710F3D9E4009D5894 /* Driver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27310F3D9E4009D5894 /* Driver.cpp */; };
|
||||
26F5C27810F3D9E4009D5894 /* IOChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27510F3D9E4009D5894 /* IOChannel.cpp */; };
|
||||
26F5C32510F3DF23009D5894 /* libpython.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython.dylib */; };
|
||||
|
@ -896,6 +898,8 @@
|
|||
26E3EEE411A9901300FBADB6 /* UnwindMacOSXFrameBackchain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindMacOSXFrameBackchain.h; path = Utility/UnwindMacOSXFrameBackchain.h; sourceTree = "<group>"; };
|
||||
26E3EEF711A994E800FBADB6 /* RegisterContextMacOSXFrameBackchain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextMacOSXFrameBackchain.cpp; path = Utility/RegisterContextMacOSXFrameBackchain.cpp; sourceTree = "<group>"; };
|
||||
26E3EEF811A994E800FBADB6 /* RegisterContextMacOSXFrameBackchain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextMacOSXFrameBackchain.h; path = Utility/RegisterContextMacOSXFrameBackchain.h; sourceTree = "<group>"; };
|
||||
26E6902E129C6BD500DDECD9 /* ClangExternalASTSourceCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExternalASTSourceCallbacks.h; path = include/lldb/Symbol/ClangExternalASTSourceCallbacks.h; sourceTree = "<group>"; };
|
||||
26E69030129C6BEF00DDECD9 /* ClangExternalASTSourceCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangExternalASTSourceCallbacks.cpp; path = source/Symbol/ClangExternalASTSourceCallbacks.cpp; sourceTree = "<group>"; };
|
||||
26F5C26A10F3D9A4009D5894 /* lldb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lldb; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
26F5C27210F3D9E4009D5894 /* lldb-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "lldb-Info.plist"; path = "tools/driver/lldb-Info.plist"; sourceTree = "<group>"; };
|
||||
26F5C27310F3D9E4009D5894 /* Driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Driver.cpp; path = tools/driver/Driver.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1750,6 +1754,8 @@
|
|||
26BC7F1410F1B8EC00F91463 /* ClangASTContext.cpp */,
|
||||
49E45FA911F660DC008F7B28 /* ClangASTType.h */,
|
||||
49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */,
|
||||
26E6902E129C6BD500DDECD9 /* ClangExternalASTSourceCallbacks.h */,
|
||||
26E69030129C6BEF00DDECD9 /* ClangExternalASTSourceCallbacks.cpp */,
|
||||
266A42D7128E40040090CF7C /* ClangNamespaceDecl.h */,
|
||||
266A42D5128E3FFB0090CF7C /* ClangNamespaceDecl.cpp */,
|
||||
26BC7C5710F1B6E900F91463 /* CompileUnit.h */,
|
||||
|
@ -2291,6 +2297,7 @@
|
|||
4C61978F12823D4300FAFFCC /* AppleObjCRuntimeV1.h in Headers */,
|
||||
4CC2A14D128C7409001531C4 /* ThreadPlanTracer.h in Headers */,
|
||||
266A42D8128E40040090CF7C /* ClangNamespaceDecl.h in Headers */,
|
||||
26E6902F129C6BD500DDECD9 /* ClangExternalASTSourceCallbacks.h in Headers */,
|
||||
4C7CF7E41295E10E00B4FBB5 /* ThreadPlanCallUserExpression.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -2790,6 +2797,7 @@
|
|||
4C61978E12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp in Sources */,
|
||||
4CC2A149128C73ED001531C4 /* ThreadPlanTracer.cpp in Sources */,
|
||||
266A42D6128E3FFB0090CF7C /* ClangNamespaceDecl.cpp in Sources */,
|
||||
26E69031129C6BEF00DDECD9 /* ClangExternalASTSourceCallbacks.cpp in Sources */,
|
||||
4C7CF7E61295E12B00B4FBB5 /* ThreadPlanCallUserExpression.cpp in Sources */,
|
||||
B296983712C2FB98002D92C3 /* CommandObjectVersion.cpp in Sources */,
|
||||
);
|
||||
|
@ -2939,6 +2947,11 @@
|
|||
GCC_ENABLE_OBJC_GC = supported;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
__STDC_CONSTANT_MACROS,
|
||||
__STDC_LIMIT_MACROS,
|
||||
LLDB_CONFIGURATION_DEBUG,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = "resources/LLDB-Info.plist";
|
||||
INSTALL_PATH = /Developer/Library/PrivateFrameworks;
|
||||
|
@ -2948,7 +2961,7 @@
|
|||
"$(LLVM_BUILD_DIR)",
|
||||
);
|
||||
LLVM_BUILD_DIR = "$(SRCROOT)/llvm";
|
||||
LLVM_CONFIGURATION = "Debug+Asserts";
|
||||
LLVM_CONFIGURATION = Release;
|
||||
OTHER_CFLAGS = (
|
||||
"-DFOR_DYLD=0",
|
||||
"-DSUPPORT_REMOTE_UNWINDING",
|
||||
|
@ -2991,6 +3004,11 @@
|
|||
FRAMEWORK_VERSION = A;
|
||||
GCC_ENABLE_OBJC_GC = supported;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
__STDC_CONSTANT_MACROS,
|
||||
__STDC_LIMIT_MACROS,
|
||||
LLDB_CONFIGURATION_RELEASE,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = "resources/LLDB-Info.plist";
|
||||
INSTALL_PATH = /Developer/Library/PrivateFrameworks;
|
||||
|
@ -3100,6 +3118,11 @@
|
|||
FRAMEWORK_VERSION = A;
|
||||
GCC_ENABLE_OBJC_GC = supported;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
__STDC_CONSTANT_MACROS,
|
||||
__STDC_LIMIT_MACROS,
|
||||
LLDB_CONFIGURATION_BUILD_AND_INTEGRATION,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = "resources/LLDB-Info.plist";
|
||||
INSTALL_PATH = /Developer/Library/PrivateFrameworks;
|
||||
|
|
|
@ -96,7 +96,9 @@ uint64_t
|
|||
SBType::GetNumberChildren (bool omit_empty_base_classes)
|
||||
{
|
||||
if (IsValid ())
|
||||
return ClangASTContext::GetNumChildren(m_type, omit_empty_base_classes);
|
||||
return ClangASTContext::GetNumChildren (static_cast<clang::ASTContext *>(m_ast),
|
||||
m_type,
|
||||
omit_empty_base_classes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -457,7 +457,18 @@ SBValue::GetExpressionPath (SBStream &description)
|
|||
{
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
m_opaque_sp->GetExpressionPath (description.ref());
|
||||
m_opaque_sp->GetExpressionPath (description.ref(), false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
m_opaque_sp->GetExpressionPath (description.ref(), qualify_cxx_base_classes);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -156,15 +156,7 @@ CommandObjectArgs::Execute
|
|||
return false;
|
||||
}
|
||||
|
||||
TypeList *thread_type_list = thread_module->GetTypeList ();
|
||||
if (!thread_type_list)
|
||||
{
|
||||
result.AppendError ("The module has no type list.");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
ClangASTContext &ast_context = thread_type_list->GetClangASTContext();
|
||||
ClangASTContext &ast_context = thread_module->GetClangASTContext();
|
||||
|
||||
ValueList value_list;
|
||||
|
||||
|
|
|
@ -29,9 +29,11 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
|
|||
m_object_name (),
|
||||
m_objfile_ap (),
|
||||
m_symfile_ap (),
|
||||
m_ast (),
|
||||
m_did_load_objfile (false),
|
||||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_did_init_ast (false),
|
||||
m_is_dynamic_loader_module (false)
|
||||
{
|
||||
if (object_name)
|
||||
|
@ -60,6 +62,13 @@ Module::~Module()
|
|||
m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
|
||||
m_object_name.IsEmpty() ? "" : ")");
|
||||
// Release any auto pointers before we start tearing down our member
|
||||
// variables since the object file and symbol files might need to make
|
||||
// function calls back into this module object. The ordering is important
|
||||
// here because symbol files can require the module object file. So we tear
|
||||
// down the symbol file first, then the object file.
|
||||
m_symfile_ap.reset();
|
||||
m_objfile_ap.reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,6 +95,23 @@ Module::GetUUID()
|
|||
return m_uuid;
|
||||
}
|
||||
|
||||
ClangASTContext &
|
||||
Module::GetClangASTContext ()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
if (m_did_init_ast == false)
|
||||
{
|
||||
ObjectFile * objfile = GetObjectFile();
|
||||
ConstString target_triple;
|
||||
if (objfile && objfile->GetTargetTriple(target_triple))
|
||||
{
|
||||
m_did_init_ast = true;
|
||||
m_ast.SetTargetTriple (target_triple.AsCString());
|
||||
}
|
||||
}
|
||||
return m_ast;
|
||||
}
|
||||
|
||||
void
|
||||
Module::ParseAllDebugSymbols()
|
||||
{
|
||||
|
|
|
@ -944,11 +944,11 @@ ValueObject::SetDynamicValue ()
|
|||
|
||||
|
||||
void
|
||||
ValueObject::GetExpressionPath (Stream &s)
|
||||
ValueObject::GetExpressionPath (Stream &s, bool qualify_cxx_base_classes)
|
||||
{
|
||||
if (m_parent)
|
||||
{
|
||||
m_parent->GetExpressionPath (s);
|
||||
m_parent->GetExpressionPath (s, qualify_cxx_base_classes);
|
||||
clang_type_t parent_clang_type = m_parent->GetClangType();
|
||||
if (parent_clang_type)
|
||||
{
|
||||
|
@ -967,11 +967,14 @@ ValueObject::GetExpressionPath (Stream &s)
|
|||
|
||||
if (IsBaseClass())
|
||||
{
|
||||
clang_type_t clang_type = GetClangType();
|
||||
std::string cxx_class_name;
|
||||
if (ClangASTContext::GetCXXClassName (clang_type, cxx_class_name))
|
||||
if (qualify_cxx_base_classes)
|
||||
{
|
||||
s << cxx_class_name.c_str() << "::";
|
||||
clang_type_t clang_type = GetClangType();
|
||||
std::string cxx_class_name;
|
||||
if (ClangASTContext::GetCXXClassName (clang_type, cxx_class_name))
|
||||
{
|
||||
s << cxx_class_name.c_str() << "::";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1026,7 +1029,9 @@ ValueObject::DumpValueObject
|
|||
|
||||
if (flat_output)
|
||||
{
|
||||
valobj->GetExpressionPath(s);
|
||||
// If we are showing types, also qualify the C++ base classes
|
||||
const bool qualify_cxx_base_classes = show_types;
|
||||
valobj->GetExpressionPath(s, qualify_cxx_base_classes);
|
||||
s.PutCString(" =");
|
||||
}
|
||||
else
|
||||
|
@ -1270,7 +1275,7 @@ ValueObject::Dereference (Error &error)
|
|||
else
|
||||
{
|
||||
StreamString strm;
|
||||
GetExpressionPath(strm);
|
||||
GetExpressionPath(strm, true);
|
||||
|
||||
if (is_pointer_type)
|
||||
error.SetErrorStringWithFormat("dereference failed: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
|
||||
|
@ -1297,7 +1302,7 @@ ValueObject::AddressOf (Error &error)
|
|||
case eAddressTypeInvalid:
|
||||
{
|
||||
StreamString expr_path_strm;
|
||||
GetExpressionPath(expr_path_strm);
|
||||
GetExpressionPath(expr_path_strm, true);
|
||||
error.SetErrorStringWithFormat("'%s' is not in memory", expr_path_strm.GetString().c_str());
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -61,7 +61,7 @@ ValueObjectChild::GetValueType() const
|
|||
uint32_t
|
||||
ValueObjectChild::CalculateNumChildren()
|
||||
{
|
||||
return ClangASTContext::GetNumChildren (m_clang_type, true);
|
||||
return ClangASTContext::GetNumChildren (GetClangAST (), m_clang_type, true);
|
||||
}
|
||||
|
||||
ConstString
|
||||
|
|
|
@ -139,7 +139,7 @@ ValueObjectConstResult::~ValueObjectConstResult()
|
|||
{
|
||||
}
|
||||
|
||||
void *
|
||||
lldb::clang_type_t
|
||||
ValueObjectConstResult::GetClangType()
|
||||
{
|
||||
return m_value.GetClangType();
|
||||
|
@ -171,7 +171,7 @@ ValueObjectConstResult::SetByteSize (size_t size)
|
|||
uint32_t
|
||||
ValueObjectConstResult::CalculateNumChildren()
|
||||
{
|
||||
return ClangASTContext::GetNumChildren (GetClangType(), true);
|
||||
return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
|
||||
}
|
||||
|
||||
clang::ASTContext *
|
||||
|
|
|
@ -42,7 +42,7 @@ ValueObjectRegisterContext::~ValueObjectRegisterContext()
|
|||
{
|
||||
}
|
||||
|
||||
void *
|
||||
lldb::clang_type_t
|
||||
ValueObjectRegisterContext::GetClangType ()
|
||||
{
|
||||
return NULL;
|
||||
|
@ -119,7 +119,7 @@ ValueObjectRegisterSet::~ValueObjectRegisterSet()
|
|||
{
|
||||
}
|
||||
|
||||
void *
|
||||
lldb::clang_type_t
|
||||
ValueObjectRegisterSet::GetClangType ()
|
||||
{
|
||||
return NULL;
|
||||
|
@ -227,7 +227,7 @@ ValueObjectRegister::~ValueObjectRegister()
|
|||
{
|
||||
}
|
||||
|
||||
void *
|
||||
lldb::clang_type_t
|
||||
ValueObjectRegister::GetClangType ()
|
||||
{
|
||||
if (m_clang_type == NULL && m_reg_info)
|
||||
|
@ -238,9 +238,7 @@ ValueObjectRegister::GetClangType ()
|
|||
Module *exe_module = process->GetTarget().GetExecutableModule ().get();
|
||||
if (exe_module)
|
||||
{
|
||||
TypeList *type_list = exe_module->GetTypeList();
|
||||
if (type_list)
|
||||
m_clang_type = type_list->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize (m_reg_info->encoding, m_reg_info->byte_size * 8);
|
||||
m_clang_type = exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize (m_reg_info->encoding, m_reg_info->byte_size * 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,11 +267,7 @@ ValueObjectRegister::GetClangAST ()
|
|||
{
|
||||
Module *exe_module = process->GetTarget().GetExecutableModule ().get();
|
||||
if (exe_module)
|
||||
{
|
||||
TypeList *type_list = exe_module->GetTypeList();
|
||||
if (type_list)
|
||||
return type_list->GetClangASTContext().getASTContext();
|
||||
}
|
||||
return exe_module->GetClangASTContext().getASTContext();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ ValueObjectVariable::~ValueObjectVariable()
|
|||
{
|
||||
}
|
||||
|
||||
void *
|
||||
lldb::clang_type_t
|
||||
ValueObjectVariable::GetClangType ()
|
||||
{
|
||||
Type *var_type = m_variable_sp->GetType();
|
||||
if (var_type)
|
||||
return var_type->GetClangType();
|
||||
return var_type->GetClangForwardType();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,34 +17,34 @@
|
|||
using namespace clang;
|
||||
using namespace lldb_private;
|
||||
|
||||
ClangASTSource::~ClangASTSource() {}
|
||||
ClangASTSource::~ClangASTSource()
|
||||
{
|
||||
}
|
||||
|
||||
void ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer) {
|
||||
void
|
||||
ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer)
|
||||
{
|
||||
// Tell Sema to ask us when looking into the translation unit's decl.
|
||||
m_ast_context.getTranslationUnitDecl()->setHasExternalVisibleStorage();
|
||||
m_ast_context.getTranslationUnitDecl()->setHasExternalLexicalStorage();
|
||||
}
|
||||
|
||||
// These are only required for AST source that want to lazily load
|
||||
// the declarations (or parts thereof) that they return.
|
||||
Decl *ClangASTSource::GetExternalDecl(uint32_t) { return 0; }
|
||||
Stmt *ClangASTSource::GetExternalDeclStmt(uint64_t) { return 0; }
|
||||
|
||||
// These are also optional, although it might help with ObjC
|
||||
// debugging if we have respectable signatures. But a more
|
||||
// efficient interface (that didn't require scanning all files
|
||||
// for method signatures!) might help.
|
||||
Selector ClangASTSource::GetExternalSelector(uint32_t) { return Selector(); }
|
||||
uint32_t ClangASTSource::GetNumExternalSelectors() { return 0; }
|
||||
CXXBaseSpecifier *ClangASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { return NULL; }
|
||||
|
||||
// The core lookup interface.
|
||||
DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
|
||||
DeclContext::lookup_result
|
||||
ClangASTSource::FindExternalVisibleDeclsByName
|
||||
(
|
||||
const DeclContext *decl_ctx,
|
||||
DeclarationName clang_decl_name
|
||||
)
|
||||
{
|
||||
if (m_decl_map.GetImportInProgress())
|
||||
return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
|
||||
|
||||
std::string decl_name (clang_decl_name.getAsString());
|
||||
|
||||
// if (m_decl_map.DoingASTImport ())
|
||||
// return DeclContext::lookup_result();
|
||||
//
|
||||
switch (clang_decl_name.getNameKind()) {
|
||||
// Normal identifiers.
|
||||
case DeclarationName::Identifier:
|
||||
|
@ -75,7 +75,6 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
|
|||
return DeclContext::lookup_result();
|
||||
}
|
||||
|
||||
std::string decl_name (clang_decl_name.getAsString());
|
||||
|
||||
if (!m_decl_map.GetLookupsEnabled())
|
||||
{
|
||||
|
@ -112,25 +111,47 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
|
|||
return result;
|
||||
}
|
||||
|
||||
void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
|
||||
void
|
||||
ClangASTSource::CompleteType (TagDecl *tag_decl)
|
||||
{
|
||||
puts(__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
ClangASTSource::CompleteType (ObjCInterfaceDecl *objc_decl)
|
||||
{
|
||||
puts(__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This is used to support iterating through an entire lexical context,
|
||||
// which isn't something the debugger should ever need to do.
|
||||
bool ClangASTSource::FindExternalLexicalDecls(const DeclContext *DC,
|
||||
bool (*isKindWeWant)(Decl::Kind),
|
||||
llvm::SmallVectorImpl<Decl*> &Decls) {
|
||||
bool
|
||||
ClangASTSource::FindExternalLexicalDecls
|
||||
(
|
||||
const DeclContext *DC,
|
||||
bool (*isKindWeWant)(Decl::Kind),
|
||||
llvm::SmallVectorImpl<Decl*> &Decls
|
||||
)
|
||||
{
|
||||
// true is for error, that's good enough for me
|
||||
return true;
|
||||
}
|
||||
|
||||
clang::ASTContext *NameSearchContext::GetASTContext() {
|
||||
clang::ASTContext *
|
||||
NameSearchContext::GetASTContext()
|
||||
{
|
||||
return &m_ast_source.m_ast_context;
|
||||
}
|
||||
|
||||
clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
|
||||
clang::NamedDecl *
|
||||
NameSearchContext::AddVarDecl(void *type)
|
||||
{
|
||||
IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();
|
||||
|
||||
assert (type && "Type for variable must be non-NULL!");
|
||||
|
@ -148,7 +169,9 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
|
|||
return Decl;
|
||||
}
|
||||
|
||||
clang::NamedDecl *NameSearchContext::AddFunDecl (void *type) {
|
||||
clang::NamedDecl *
|
||||
NameSearchContext::AddFunDecl (void *type)
|
||||
{
|
||||
clang::FunctionDecl *func_decl = FunctionDecl::Create (m_ast_source.m_ast_context,
|
||||
const_cast<DeclContext*>(m_decl_context),
|
||||
SourceLocation(),
|
||||
|
@ -199,7 +222,8 @@ clang::NamedDecl *NameSearchContext::AddFunDecl (void *type) {
|
|||
return func_decl;
|
||||
}
|
||||
|
||||
clang::NamedDecl *NameSearchContext::AddGenericFunDecl()
|
||||
clang::NamedDecl *
|
||||
NameSearchContext::AddGenericFunDecl()
|
||||
{
|
||||
QualType generic_function_type(m_ast_source.m_ast_context.getFunctionType (m_ast_source.m_ast_context.getSizeType(), // result
|
||||
NULL, // argument types
|
||||
|
@ -215,7 +239,8 @@ clang::NamedDecl *NameSearchContext::AddGenericFunDecl()
|
|||
return AddFunDecl(generic_function_type.getAsOpaquePtr());
|
||||
}
|
||||
|
||||
clang::NamedDecl *NameSearchContext::AddTypeDecl(void *type)
|
||||
clang::NamedDecl *
|
||||
NameSearchContext::AddTypeDecl(void *type)
|
||||
{
|
||||
QualType qual_type = QualType::getFromOpaquePtr(type);
|
||||
|
||||
|
|
|
@ -1711,8 +1711,8 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
|
|||
log->PutCString (strm.GetData());
|
||||
}
|
||||
|
||||
TypeFromUser user_type(type_sp->GetClangType(),
|
||||
type_sp->GetClangAST());
|
||||
TypeFromUser user_type (type_sp->GetClangType(),
|
||||
type_sp->GetClangAST());
|
||||
|
||||
AddOneType(context, user_type, false);
|
||||
}
|
||||
|
@ -1748,18 +1748,9 @@ ClangExpressionDeclMap::GetVariableValue
|
|||
return NULL;
|
||||
}
|
||||
|
||||
TypeList *type_list = var_type->GetTypeList();
|
||||
clang::ASTContext *ast = var_type->GetClangASTContext().getASTContext();
|
||||
|
||||
if (!type_list)
|
||||
{
|
||||
if (log)
|
||||
log->PutCString("Skipped a definition because the type has no associated type list");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
clang::ASTContext *exe_ast_ctx = type_list->GetClangASTContext().getASTContext();
|
||||
|
||||
if (!exe_ast_ctx)
|
||||
if (!ast)
|
||||
{
|
||||
if (log)
|
||||
log->PutCString("There is no AST context for the current execution context");
|
||||
|
@ -1780,20 +1771,18 @@ ClangExpressionDeclMap::GetVariableValue
|
|||
}
|
||||
Error err;
|
||||
|
||||
if (!var_location_expr.Evaluate(&exe_ctx, exe_ast_ctx, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err))
|
||||
if (!var_location_expr.Evaluate(&exe_ctx, ast, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("Error evaluating location: %s", err.AsCString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
clang::ASTContext *var_ast_context = type_list->GetClangASTContext().getASTContext();
|
||||
|
||||
void *type_to_use;
|
||||
|
||||
if (parser_ast_context)
|
||||
{
|
||||
type_to_use = GuardedCopyType(parser_ast_context, var_ast_context, var_opaque_type);
|
||||
type_to_use = GuardedCopyType(parser_ast_context, ast, var_opaque_type);
|
||||
|
||||
if (!type_to_use)
|
||||
{
|
||||
|
@ -1834,14 +1823,13 @@ ClangExpressionDeclMap::GetVariableValue
|
|||
}
|
||||
|
||||
if (user_type)
|
||||
*user_type = TypeFromUser(var_opaque_type, var_ast_context);
|
||||
*user_type = TypeFromUser(var_opaque_type, ast);
|
||||
|
||||
return var_location.release();
|
||||
}
|
||||
|
||||
void
|
||||
ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
|
||||
Variable* var)
|
||||
ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, Variable* var)
|
||||
{
|
||||
assert (m_parser_vars.get());
|
||||
|
||||
|
@ -1965,7 +1953,6 @@ ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, const ClangNam
|
|||
{
|
||||
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
|
||||
clang::Decl *copied_decl = ClangASTContext::CopyDecl (context.GetASTContext(),
|
||||
namespace_decl.GetASTContext(),
|
||||
namespace_decl.GetNamespaceDecl());
|
||||
|
@ -2012,8 +1999,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
|
|||
|
||||
fun_address = &fun->GetAddressRange().GetBaseAddress();
|
||||
|
||||
TypeList *type_list = fun_type->GetTypeList();
|
||||
fun_ast_context = type_list->GetClangASTContext().getASTContext();
|
||||
fun_ast_context = fun_type->GetClangASTContext().getASTContext();
|
||||
void *copied_type = GuardedCopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type);
|
||||
|
||||
fun_decl = context.AddFunDecl(copied_type);
|
||||
|
|
|
@ -186,6 +186,7 @@ CommandInterpreter::LoadCommandDictionary ()
|
|||
break_regex_cmd_ap->AddRegexCommand("^[\"']?([-+]\\[.*\\])[\"']?[[:space:]]*$", "breakpoint set --name '%1'") &&
|
||||
break_regex_cmd_ap->AddRegexCommand("^$", "breakpoint list") &&
|
||||
break_regex_cmd_ap->AddRegexCommand("^(-.*)$", "breakpoint set %1") &&
|
||||
break_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])`(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%2' --shlib '%1'") &&
|
||||
break_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%1'"))
|
||||
{
|
||||
CommandObjectSP break_regex_cmd_sp(break_regex_cmd_ap.release());
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
@ -380,12 +379,14 @@ DisassemblerLLVM::CreateInstance(const ArchSpec &arch)
|
|||
}
|
||||
|
||||
DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) :
|
||||
Disassembler(arch)
|
||||
Disassembler (arch),
|
||||
m_disassembler (NULL)
|
||||
{
|
||||
char triple[256];
|
||||
if (TripleForArchSpec (arch, triple, sizeof(triple)))
|
||||
{
|
||||
assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!");
|
||||
int err = EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch));
|
||||
assert (err == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,6 +403,9 @@ DisassemblerLLVM::DecodeInstructions
|
|||
uint32_t num_instructions
|
||||
)
|
||||
{
|
||||
if (m_disassembler == NULL)
|
||||
return 0;
|
||||
|
||||
size_t total_inst_byte_size = 0;
|
||||
|
||||
m_instruction_list.Clear();
|
||||
|
|
|
@ -574,12 +574,6 @@ ProcessGDBRemote::DidLaunchOrAttach ()
|
|||
|
||||
m_byte_order = m_gdb_comm.GetByteOrder();
|
||||
|
||||
Module * exe_module = GetTarget().GetExecutableModule().get();
|
||||
assert(exe_module);
|
||||
|
||||
ObjectFile *exe_objfile = exe_module->GetObjectFile();
|
||||
assert(exe_objfile);
|
||||
|
||||
StreamString strm;
|
||||
|
||||
ArchSpec inferior_arch;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "lldb/Core/Value.h"
|
||||
|
||||
#include "lldb/Symbol/Block.h"
|
||||
#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
|
||||
#include "lldb/Symbol/CompileUnit.h"
|
||||
#include "lldb/Symbol/LineTable.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
@ -118,13 +119,6 @@ SymbolFileDWARF::CreateInstance (ObjectFile* obj_file)
|
|||
return new SymbolFileDWARF(obj_file);
|
||||
}
|
||||
|
||||
|
||||
ClangASTContext &
|
||||
SymbolFileDWARF::GetClangASTContext()
|
||||
{
|
||||
return GetTypeList()->GetClangASTContext();
|
||||
}
|
||||
|
||||
TypeList *
|
||||
SymbolFileDWARF::GetTypeList ()
|
||||
{
|
||||
|
@ -183,13 +177,61 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectFile* objfile) :
|
|||
m_global_index(),
|
||||
m_type_index(),
|
||||
m_namespace_index(),
|
||||
m_indexed(false),
|
||||
m_indexed (false),
|
||||
m_is_external_ast_source (false),
|
||||
m_ranges()
|
||||
{
|
||||
}
|
||||
|
||||
SymbolFileDWARF::~SymbolFileDWARF()
|
||||
{
|
||||
if (m_is_external_ast_source)
|
||||
m_obj_file->GetModule()->GetClangASTContext().RemoveExternalSource ();
|
||||
}
|
||||
|
||||
static const ConstString &
|
||||
GetDWARFMachOSegmentName ()
|
||||
{
|
||||
static ConstString g_dwarf_section_name ("__DWARF");
|
||||
return g_dwarf_section_name;
|
||||
}
|
||||
|
||||
ClangASTContext &
|
||||
SymbolFileDWARF::GetClangASTContext ()
|
||||
{
|
||||
if (m_debug_map_symfile)
|
||||
return m_debug_map_symfile->GetClangASTContext ();
|
||||
|
||||
ClangASTContext &ast = m_obj_file->GetModule()->GetClangASTContext();
|
||||
if (!m_is_external_ast_source)
|
||||
{
|
||||
m_is_external_ast_source = true;
|
||||
llvm::OwningPtr<clang::ExternalASTSource> ast_source_ap (
|
||||
new ClangExternalASTSourceCallbacks (SymbolFileDWARF::CompleteTagDecl,
|
||||
SymbolFileDWARF::CompleteObjCInterfaceDecl,
|
||||
this));
|
||||
|
||||
ast.SetExternalSource (ast_source_ap);
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
|
||||
void
|
||||
SymbolFileDWARF::InitializeObject()
|
||||
{
|
||||
// Install our external AST source callbacks so we can complete Clang types.
|
||||
Module *module = m_obj_file->GetModule();
|
||||
if (module)
|
||||
{
|
||||
const SectionList *section_list = m_obj_file->GetSectionList();
|
||||
|
||||
const Section* section = section_list->FindSectionByName(GetDWARFMachOSegmentName ()).get();
|
||||
|
||||
// Memory map the DWARF mach-o segment so we have everything mmap'ed
|
||||
// to keep our heap memory usage down.
|
||||
if (section)
|
||||
section->MemoryMapSectionDataFromObjectFile(m_obj_file, m_dwarf_data);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -221,15 +263,10 @@ SymbolFileDWARF::GetAbilities ()
|
|||
uint64_t debug_ranges_file_size = 0;
|
||||
uint64_t debug_str_file_size = 0;
|
||||
|
||||
static ConstString g_dwarf_section_name ("__DWARF");
|
||||
|
||||
section = section_list->FindSectionByName(g_dwarf_section_name).get();
|
||||
section = section_list->FindSectionByName(GetDWARFMachOSegmentName ()).get();
|
||||
|
||||
if (section)
|
||||
{
|
||||
section->MemoryMapSectionDataFromObjectFile(m_obj_file, m_dwarf_data);
|
||||
section_list = §ion->GetChildren ();
|
||||
}
|
||||
|
||||
section = section_list->FindSectionByType (eSectionTypeDWARFDebugInfo, true).get();
|
||||
if (section != NULL)
|
||||
|
@ -1079,6 +1116,7 @@ SymbolFileDWARF::ParseChildMembers
|
|||
size_t count = 0;
|
||||
const DWARFDebugInfoEntry *die;
|
||||
const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize());
|
||||
uint32_t member_idx = 0;
|
||||
|
||||
for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling())
|
||||
{
|
||||
|
@ -1156,6 +1194,17 @@ SymbolFileDWARF::ParseChildMembers
|
|||
class_language == eLanguageTypeObjC_plus_plus)
|
||||
accessibility = eAccessNone;
|
||||
|
||||
if (member_idx == 0 && !is_artificial && name && (strstr (name, "_vptr$") == name))
|
||||
{
|
||||
// Not all compilers will mark the vtable pointer
|
||||
// member as artificial (llvm-gcc). We can't have
|
||||
// the virtual members in our classes otherwise it
|
||||
// throws off all child offsets since we end up
|
||||
// having and extra pointer sized member in our
|
||||
// class layouts.
|
||||
is_artificial = true;
|
||||
}
|
||||
|
||||
if (is_artificial == false)
|
||||
{
|
||||
Type *member_type = ResolveTypeUID(encoding_uid);
|
||||
|
@ -1171,6 +1220,7 @@ SymbolFileDWARF::ParseChildMembers
|
|||
bit_size);
|
||||
}
|
||||
}
|
||||
++member_idx;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1319,13 +1369,32 @@ SymbolFileDWARF::ResolveTypeUID (lldb::user_id_t type_uid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// This function is used when SymbolFileDWARFDebugMap owns a bunch of
|
||||
// SymbolFileDWARF objects to detect if this DWARF file is the one that
|
||||
// can resolve a clang_type.
|
||||
bool
|
||||
SymbolFileDWARF::HasForwardDeclForClangType (lldb::clang_type_t clang_type)
|
||||
{
|
||||
clang_type_t clang_type_no_qualifiers = ClangASTType::RemoveFastQualifiers(clang_type);
|
||||
const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (clang_type_no_qualifiers);
|
||||
return die != NULL;
|
||||
}
|
||||
|
||||
|
||||
lldb::clang_type_t
|
||||
SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type)
|
||||
{
|
||||
// We have a struct/union/class/enum that needs to be fully resolved.
|
||||
const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (ClangASTType::RemoveFastQualifiers(clang_type));
|
||||
clang_type_t clang_type_no_qualifiers = ClangASTType::RemoveFastQualifiers(clang_type);
|
||||
const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (clang_type_no_qualifiers);
|
||||
if (die == NULL)
|
||||
{
|
||||
// if (m_debug_map_symfile)
|
||||
// {
|
||||
// Type *type = m_die_to_type[die];
|
||||
// if (type && type->GetSymbolFile() != this)
|
||||
// return type->GetClangType();
|
||||
// }
|
||||
// We have already resolved this type...
|
||||
return clang_type;
|
||||
}
|
||||
|
@ -1333,7 +1402,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type
|
|||
// map in case anyone child members or other types require this type to get resolved.
|
||||
// The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
|
||||
// are done.
|
||||
m_forward_decl_clang_type_to_die.erase (ClangASTType::RemoveFastQualifiers(clang_type));
|
||||
m_forward_decl_clang_type_to_die.erase (clang_type_no_qualifiers);
|
||||
|
||||
|
||||
DWARFDebugInfo* debug_info = DebugInfo();
|
||||
|
@ -2743,7 +2812,7 @@ SymbolFileDWARF::GetClangDeclContextForDIE (DWARFCompileUnit *curr_cu, const DWA
|
|||
if (namespace_name)
|
||||
{
|
||||
Declaration decl; // TODO: fill in the decl object
|
||||
clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextForDIE (curr_cu, die->GetParent()));
|
||||
clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextForDIE (curr_cu, die));
|
||||
if (namespace_decl)
|
||||
{
|
||||
//printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
|
||||
|
@ -2775,7 +2844,7 @@ SymbolFileDWARF::GetClangDeclContextForDIE (DWARFCompileUnit *curr_cu, const DWA
|
|||
}
|
||||
|
||||
clang::DeclContext *decl_ctx;
|
||||
dw_offset_t die_offset = die->GetAttributeValueAsUnsigned(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
|
||||
dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
|
||||
if (die_offset != DW_INVALID_OFFSET)
|
||||
{
|
||||
//printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) check DW_AT_specification 0x%8.8x\n", decl_die->GetOffset(), die_offset);
|
||||
|
@ -2784,7 +2853,7 @@ SymbolFileDWARF::GetClangDeclContextForDIE (DWARFCompileUnit *curr_cu, const DWA
|
|||
return decl_ctx;
|
||||
}
|
||||
|
||||
die_offset = die->GetAttributeValueAsUnsigned(this, curr_cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
|
||||
die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
|
||||
if (die_offset != DW_INVALID_OFFSET)
|
||||
{
|
||||
//printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) check DW_AT_abstract_origin 0x%8.8x\n", decl_die->GetOffset(), die_offset);
|
||||
|
@ -3182,6 +3251,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// When the definition needs to be defined.
|
||||
m_forward_decl_die_to_clang_type[die] = clang_type;
|
||||
m_forward_decl_clang_type_to_die[ClangASTType::RemoveFastQualifiers (clang_type)] = die;
|
||||
ClangASTContext::SetHasExternalStorage (clang_type, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3244,7 +3314,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
DW_ATE_signed,
|
||||
byte_size * 8);
|
||||
clang_type = ast.CreateEnumerationType (type_name_cstr,
|
||||
GetClangDeclContextForDIE (dwarf_cu, die->GetParent()),
|
||||
GetClangDeclContextForDIE (dwarf_cu, die),
|
||||
decl,
|
||||
enumerator_clang_type);
|
||||
}
|
||||
|
@ -3268,6 +3338,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
|
||||
#if LEAVE_ENUMS_FORWARD_DECLARED
|
||||
// Leave this as a forward declaration until we need
|
||||
// to know the details of the type. lldb_private::Type
|
||||
// will automatically call the SymbolFile virtual function
|
||||
|
@ -3275,7 +3346,16 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// When the definition needs to be defined.
|
||||
m_forward_decl_die_to_clang_type[die] = clang_type;
|
||||
m_forward_decl_clang_type_to_die[ClangASTType::RemoveFastQualifiers (clang_type)] = die;
|
||||
|
||||
ClangASTContext::SetHasExternalStorage (clang_type, true);
|
||||
#else
|
||||
ast.StartTagDeclarationDefinition (clang_type);
|
||||
if (die->HasChildren())
|
||||
{
|
||||
SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
|
||||
ParseChildEnumerators(sc, clang_type, type_sp->GetByteSize(), dwarf_cu, die);
|
||||
}
|
||||
ast.CompleteTagDeclarationDefinition (clang_type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -4165,3 +4245,21 @@ SymbolFileDWARF::EnablePluginLogging (Stream *strm, Args &command)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SymbolFileDWARF::CompleteTagDecl (void *baton, clang::TagDecl *decl)
|
||||
{
|
||||
SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
|
||||
clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl);
|
||||
if (clang_type)
|
||||
symbol_file_dwarf->ResolveClangOpaqueTypeDefinition (clang_type);
|
||||
}
|
||||
|
||||
void
|
||||
SymbolFileDWARF::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *decl)
|
||||
{
|
||||
SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
|
||||
clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl);
|
||||
if (clang_type)
|
||||
symbol_file_dwarf->ResolveClangOpaqueTypeDefinition (clang_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "lldb/Core/DataExtractor.h"
|
||||
#include "lldb/Core/Flags.h"
|
||||
#include "lldb/Core/UniqueCStringMap.h"
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/SymbolFile.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
|
||||
|
@ -81,6 +80,7 @@ public:
|
|||
virtual ~SymbolFileDWARF();
|
||||
|
||||
virtual uint32_t GetAbilities ();
|
||||
virtual void InitializeObject();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Compile Unit function calls
|
||||
|
@ -108,12 +108,25 @@ public:
|
|||
virtual uint32_t FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
|
||||
virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
|
||||
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
|
||||
// virtual uint32_t FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
|
||||
virtual lldb_private::TypeList *GetTypeList ();
|
||||
virtual lldb_private::TypeList *
|
||||
GetTypeList ();
|
||||
virtual lldb_private::ClangASTContext &
|
||||
GetClangASTContext ();
|
||||
|
||||
virtual lldb_private::ClangNamespaceDecl
|
||||
FindNamespace (const lldb_private::SymbolContext& sc,
|
||||
const lldb_private::ConstString &name);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ClangASTContext callbacks for external source lookups.
|
||||
//------------------------------------------------------------------
|
||||
static void
|
||||
CompleteTagDecl (void *baton, clang::TagDecl *);
|
||||
|
||||
static void
|
||||
CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
//------------------------------------------------------------------
|
||||
|
@ -186,6 +199,9 @@ public:
|
|||
return m_flags;
|
||||
}
|
||||
|
||||
bool
|
||||
HasForwardDeclForClangType (lldb::clang_type_t clang_type);
|
||||
|
||||
protected:
|
||||
|
||||
enum
|
||||
|
@ -301,9 +317,6 @@ protected:
|
|||
m_debug_map_symfile = debug_map_symfile;
|
||||
}
|
||||
|
||||
lldb_private::ClangASTContext &
|
||||
GetClangASTContext();
|
||||
|
||||
clang::NamespaceDecl *
|
||||
ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die);
|
||||
|
||||
|
@ -333,7 +346,8 @@ protected:
|
|||
NameToDIE m_global_index; // Global and static variables
|
||||
NameToDIE m_type_index; // All type DIE offsets
|
||||
NameToDIE m_namespace_index; // All type DIE offsets
|
||||
bool m_indexed;
|
||||
bool m_indexed:1,
|
||||
m_is_external_ast_source:1;
|
||||
|
||||
std::auto_ptr<DWARFDebugRanges> m_ranges;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "lldb/Core/RegularExpression.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
|
||||
#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/SymbolVendor.h"
|
||||
#include "lldb/Symbol/VariableList.h"
|
||||
|
@ -72,12 +74,20 @@ SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap()
|
|||
{
|
||||
}
|
||||
|
||||
lldb_private::ClangASTContext &
|
||||
SymbolFileDWARFDebugMap::GetClangASTContext ()
|
||||
void
|
||||
SymbolFileDWARFDebugMap::InitializeObject()
|
||||
{
|
||||
return GetTypeList()->GetClangASTContext();
|
||||
// Install our external AST source callbacks so we can complete Clang types.
|
||||
llvm::OwningPtr<clang::ExternalASTSource> ast_source_ap (
|
||||
new ClangExternalASTSourceCallbacks (SymbolFileDWARFDebugMap::CompleteTagDecl,
|
||||
SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl,
|
||||
this));
|
||||
|
||||
GetClangASTContext().SetExternalSource (ast_source_ap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
SymbolFileDWARFDebugMap::InitOSO ()
|
||||
{
|
||||
|
@ -1093,3 +1103,44 @@ SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompU
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SymbolFileDWARFDebugMap::CompleteTagDecl (void *baton, clang::TagDecl *decl)
|
||||
{
|
||||
SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton;
|
||||
clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl);
|
||||
if (clang_type)
|
||||
{
|
||||
SymbolFileDWARF *oso_dwarf;
|
||||
|
||||
for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
|
||||
{
|
||||
if (oso_dwarf->HasForwardDeclForClangType (clang_type))
|
||||
{
|
||||
oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *decl)
|
||||
{
|
||||
SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton;
|
||||
clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl);
|
||||
if (clang_type)
|
||||
{
|
||||
SymbolFileDWARF *oso_dwarf;
|
||||
|
||||
for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
|
||||
{
|
||||
if (oso_dwarf->HasForwardDeclForClangType (clang_type))
|
||||
{
|
||||
oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
|
||||
virtual uint32_t GetAbilities ();
|
||||
|
||||
virtual void InitializeObject();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Compile Unit function calls
|
||||
//------------------------------------------------------------------
|
||||
|
@ -70,11 +72,20 @@ public:
|
|||
virtual uint32_t FindFunctions (const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
|
||||
virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
|
||||
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
|
||||
// virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
|
||||
virtual lldb_private::ClangNamespaceDecl
|
||||
FindNamespace (const lldb_private::SymbolContext& sc,
|
||||
const lldb_private::ConstString &name);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ClangASTContext callbacks for external source lookups.
|
||||
//------------------------------------------------------------------
|
||||
static void
|
||||
CompleteTagDecl (void *baton, clang::TagDecl *);
|
||||
|
||||
static void
|
||||
CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
//------------------------------------------------------------------
|
||||
|
@ -200,9 +211,6 @@ protected:
|
|||
const DWARFDebugInfoEntry *die,
|
||||
const lldb_private::ConstString &type_name);
|
||||
|
||||
lldb_private::ClangASTContext &
|
||||
GetClangASTContext ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//------------------------------------------------------------------
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -363,6 +363,7 @@ ClangASTType::DumpValue
|
|||
switch (qual_type->getTypeClass())
|
||||
{
|
||||
case clang::Type::Record:
|
||||
if (ClangASTContext::GetCompleteType (ast_context, clang_type))
|
||||
{
|
||||
const clang::RecordType *record_type = cast<clang::RecordType>(qual_type.getTypePtr());
|
||||
const clang::RecordDecl *record_decl = record_type->getDecl();
|
||||
|
@ -491,6 +492,7 @@ ClangASTType::DumpValue
|
|||
return;
|
||||
|
||||
case clang::Type::Enum:
|
||||
if (ClangASTContext::GetCompleteType (ast_context, clang_type))
|
||||
{
|
||||
const clang::EnumType *enum_type = cast<clang::EnumType>(qual_type.getTypePtr());
|
||||
const clang::EnumDecl *enum_decl = enum_type->getDecl();
|
||||
|
@ -690,7 +692,7 @@ ClangASTType::DumpTypeValue
|
|||
case clang::Type::Enum:
|
||||
// If our format is enum or default, show the enumeration value as
|
||||
// its enumeration string value, else just display it as requested.
|
||||
if (format == eFormatEnum || format == eFormatDefault)
|
||||
if ((format == eFormatEnum || format == eFormatDefault) && ClangASTContext::GetCompleteType (ast_context, clang_type))
|
||||
{
|
||||
const clang::EnumType *enum_type = cast<clang::EnumType>(qual_type.getTypePtr());
|
||||
const clang::EnumDecl *enum_decl = enum_type->getDecl();
|
||||
|
|
|
@ -18,7 +18,7 @@ using namespace lldb_private;
|
|||
SymbolFile*
|
||||
SymbolFile::FindPlugin (ObjectFile* obj_file)
|
||||
{
|
||||
std::auto_ptr<SymbolFile> best_sym_file_ap;
|
||||
std::auto_ptr<SymbolFile> best_symfile_ap;
|
||||
if (obj_file != NULL)
|
||||
{
|
||||
// TODO: Load any plug-ins in the appropriate plug-in search paths and
|
||||
|
@ -27,7 +27,6 @@ SymbolFile::FindPlugin (ObjectFile* obj_file)
|
|||
//----------------------------------------------------------------------
|
||||
// We currently only have one debug symbol parser...
|
||||
//----------------------------------------------------------------------
|
||||
std::auto_ptr<SymbolFile> best_symfile_ap;
|
||||
uint32_t best_symfile_abilities = 0;
|
||||
|
||||
SymbolFileCreateInstance create_callback;
|
||||
|
@ -41,16 +40,31 @@ SymbolFile::FindPlugin (ObjectFile* obj_file)
|
|||
if (sym_file_abilities > best_symfile_abilities)
|
||||
{
|
||||
best_symfile_abilities = sym_file_abilities;
|
||||
best_sym_file_ap = curr_symfile_ap;
|
||||
best_symfile_ap = curr_symfile_ap;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best_symfile_ap.get())
|
||||
{
|
||||
// Let the winning symbol file parser initialize itself more
|
||||
// completely now that it has been chosen
|
||||
best_symfile_ap->InitializeObject();
|
||||
}
|
||||
}
|
||||
return best_sym_file_ap.release();
|
||||
return best_symfile_ap.release();
|
||||
}
|
||||
|
||||
TypeList *
|
||||
SymbolFile::GetTypeList ()
|
||||
{
|
||||
return m_obj_file->GetModule()->GetTypeList();
|
||||
if (m_obj_file)
|
||||
return m_obj_file->GetModule()->GetTypeList();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lldb_private::ClangASTContext &
|
||||
SymbolFile::GetClangASTContext ()
|
||||
{
|
||||
return m_obj_file->GetModule()->GetClangASTContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,12 +69,6 @@ SymbolVendor::SymbolVendor(Module *module) :
|
|||
m_compile_units(),
|
||||
m_sym_file_ap()
|
||||
{
|
||||
ObjectFile * objfile = module->GetObjectFile();
|
||||
ConstString target_triple;
|
||||
if (objfile && objfile->GetTargetTriple(target_triple))
|
||||
{
|
||||
m_type_list.GetClangASTContext().SetTargetTriple (target_triple.AsCString());
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -284,7 +284,7 @@ lldb_private::Type::GetByteSize()
|
|||
case eEncodingIsPointerUID:
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_byte_size = GetTypeList()->GetClangASTContext().GetPointerBitSize() / 8;
|
||||
m_byte_size = m_symbol_file->GetClangASTContext().GetPointerBitSize() / 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -295,10 +295,13 @@ lldb_private::Type::GetByteSize()
|
|||
uint32_t
|
||||
lldb_private::Type::GetNumChildren (bool omit_empty_base_classes)
|
||||
{
|
||||
if (!ResolveClangType(eResolveStateFull))
|
||||
return 0;
|
||||
return ClangASTContext::GetNumChildren (m_clang_type, omit_empty_base_classes);
|
||||
|
||||
if (ResolveClangType(eResolveStateForward))
|
||||
{
|
||||
return ClangASTContext::GetNumChildren (m_symbol_file->GetClangASTContext().getASTContext(),
|
||||
m_clang_type,
|
||||
omit_empty_base_classes);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -422,7 +425,6 @@ lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
|
|||
Type *encoding_type = NULL;
|
||||
if (m_clang_type == NULL)
|
||||
{
|
||||
TypeList *type_list = GetTypeList();
|
||||
encoding_type = GetEncodingType();
|
||||
if (encoding_type)
|
||||
{
|
||||
|
@ -449,22 +451,22 @@ lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
|
|||
break;
|
||||
|
||||
case eEncodingIsTypedefUID:
|
||||
m_clang_type = type_list->CreateClangTypedefType (this, encoding_type);
|
||||
m_clang_type = CreateClangTypedefType (this, encoding_type);
|
||||
// Clear the name so it can get fully qualified in case the
|
||||
// typedef is in a namespace.
|
||||
m_name.Clear();
|
||||
break;
|
||||
|
||||
case eEncodingIsPointerUID:
|
||||
m_clang_type = type_list->CreateClangPointerType (encoding_type);
|
||||
m_clang_type = CreateClangPointerType (encoding_type);
|
||||
break;
|
||||
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
m_clang_type = type_list->CreateClangLValueReferenceType (encoding_type);
|
||||
m_clang_type = CreateClangLValueReferenceType (encoding_type);
|
||||
break;
|
||||
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_clang_type = type_list->CreateClangRValueReferenceType (encoding_type);
|
||||
m_clang_type = CreateClangRValueReferenceType (encoding_type);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -475,7 +477,7 @@ lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
|
|||
else
|
||||
{
|
||||
// We have no encoding type, return void?
|
||||
clang_type_t void_clang_type = type_list->GetClangASTContext().GetBuiltInType_void();
|
||||
clang_type_t void_clang_type = GetClangASTContext().GetBuiltInType_void();
|
||||
switch (m_encoding_uid_type)
|
||||
{
|
||||
case eEncodingIsUID:
|
||||
|
@ -495,19 +497,19 @@ lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
|
|||
break;
|
||||
|
||||
case eEncodingIsTypedefUID:
|
||||
m_clang_type = type_list->GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
|
||||
m_clang_type = GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
|
||||
break;
|
||||
|
||||
case eEncodingIsPointerUID:
|
||||
m_clang_type = type_list->GetClangASTContext().CreatePointerType (void_clang_type);
|
||||
m_clang_type = GetClangASTContext().CreatePointerType (void_clang_type);
|
||||
break;
|
||||
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
m_clang_type = type_list->GetClangASTContext().CreateLValueReferenceType (void_clang_type);
|
||||
m_clang_type = GetClangASTContext().CreateLValueReferenceType (void_clang_type);
|
||||
break;
|
||||
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_clang_type = type_list->GetClangASTContext().CreateRValueReferenceType (void_clang_type);
|
||||
m_clang_type = GetClangASTContext().CreateRValueReferenceType (void_clang_type);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -636,16 +638,13 @@ lldb_private::Type::GetClangForwardType ()
|
|||
clang::ASTContext *
|
||||
lldb_private::Type::GetClangAST ()
|
||||
{
|
||||
TypeList *type_list = GetTypeList();
|
||||
if (type_list)
|
||||
return type_list->GetClangASTContext().getASTContext();
|
||||
return NULL;
|
||||
return GetClangASTContext().getASTContext();
|
||||
}
|
||||
|
||||
lldb_private::ClangASTContext &
|
||||
lldb_private::Type::GetClangASTContext ()
|
||||
{
|
||||
return GetTypeList()->GetClangASTContext();
|
||||
return m_symbol_file->GetClangASTContext();
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -663,3 +662,35 @@ lldb_private::Type::Compare(const Type &a, const Type &b)
|
|||
// return 0;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
lldb_private::Type::CreateClangPointerType (lldb_private::Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return GetClangASTContext().CreatePointerType(type->GetClangForwardType());
|
||||
}
|
||||
|
||||
void *
|
||||
lldb_private::Type::CreateClangTypedefType (lldb_private::Type *typedef_type, lldb_private::Type *base_type)
|
||||
{
|
||||
assert(typedef_type && base_type);
|
||||
return GetClangASTContext().CreateTypedefType (typedef_type->GetName().AsCString(),
|
||||
base_type->GetClangForwardType(),
|
||||
typedef_type->GetSymbolFile()->GetClangDeclContextForTypeUID(typedef_type->GetID()));
|
||||
}
|
||||
|
||||
void *
|
||||
lldb_private::Type::CreateClangLValueReferenceType (lldb_private::Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return GetClangASTContext().CreateLValueReferenceType(type->GetClangForwardType());
|
||||
}
|
||||
|
||||
void *
|
||||
lldb_private::Type::CreateClangRValueReferenceType (lldb_private::Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return GetClangASTContext().CreateRValueReferenceType (type->GetClangForwardType());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/SymbolFile.h"
|
||||
#include "lldb/Symbol/SymbolVendor.h"
|
||||
#include "lldb/Symbol/Type.h"
|
||||
|
@ -39,8 +38,7 @@ using namespace lldb;
|
|||
using namespace lldb_private;
|
||||
using namespace clang;
|
||||
|
||||
TypeList::TypeList(const char *target_triple) :
|
||||
m_ast (target_triple),
|
||||
TypeList::TypeList() :
|
||||
m_types ()
|
||||
{
|
||||
}
|
||||
|
@ -94,18 +92,18 @@ TypeList::FindType(lldb::user_id_t uid)
|
|||
//----------------------------------------------------------------------
|
||||
// Find a type by name.
|
||||
//----------------------------------------------------------------------
|
||||
TypeList
|
||||
TypeList::FindTypes (const ConstString &name)
|
||||
{
|
||||
// Do we ever need to make a lookup by name map? Here we are doing
|
||||
// a linear search which isn't going to be fast.
|
||||
TypeList types(m_ast.getTargetInfo()->getTriple().getTriple().c_str());
|
||||
iterator pos, end;
|
||||
for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
|
||||
if (pos->second->GetName() == name)
|
||||
types.Insert (pos->second);
|
||||
return types;
|
||||
}
|
||||
//TypeList
|
||||
//TypeList::FindTypes (const ConstString &name)
|
||||
//{
|
||||
// // Do we ever need to make a lookup by name map? Here we are doing
|
||||
// // a linear search which isn't going to be fast.
|
||||
// TypeList types(m_ast.getTargetInfo()->getTriple().getTriple().c_str());
|
||||
// iterator pos, end;
|
||||
// for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
|
||||
// if (pos->second->GetName() == name)
|
||||
// types.Insert (pos->second);
|
||||
// return types;
|
||||
//}
|
||||
|
||||
void
|
||||
TypeList::Clear()
|
||||
|
@ -146,42 +144,35 @@ TypeList::Dump(Stream *s, bool show_context)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
ClangASTContext &
|
||||
TypeList::GetClangASTContext ()
|
||||
{
|
||||
return m_ast;
|
||||
}
|
||||
|
||||
void *
|
||||
TypeList::CreateClangPointerType (Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return m_ast.CreatePointerType(type->GetClangForwardType());
|
||||
}
|
||||
|
||||
void *
|
||||
TypeList::CreateClangTypedefType (Type *typedef_type, Type *base_type)
|
||||
{
|
||||
assert(typedef_type && base_type);
|
||||
return m_ast.CreateTypedefType (typedef_type->GetName().AsCString(),
|
||||
base_type->GetClangForwardType(),
|
||||
typedef_type->GetSymbolFile()->GetClangDeclContextForTypeUID(typedef_type->GetID()));
|
||||
}
|
||||
|
||||
void *
|
||||
TypeList::CreateClangLValueReferenceType (Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return m_ast.CreateLValueReferenceType(type->GetClangForwardType());
|
||||
}
|
||||
|
||||
void *
|
||||
TypeList::CreateClangRValueReferenceType (Type *type)
|
||||
{
|
||||
assert(type);
|
||||
return m_ast.CreateRValueReferenceType (type->GetClangForwardType());
|
||||
}
|
||||
|
||||
//void *
|
||||
//TypeList::CreateClangPointerType (Type *type)
|
||||
//{
|
||||
// assert(type);
|
||||
// return m_ast.CreatePointerType(type->GetClangForwardType());
|
||||
//}
|
||||
//
|
||||
//void *
|
||||
//TypeList::CreateClangTypedefType (Type *typedef_type, Type *base_type)
|
||||
//{
|
||||
// assert(typedef_type && base_type);
|
||||
// return m_ast.CreateTypedefType (typedef_type->GetName().AsCString(),
|
||||
// base_type->GetClangForwardType(),
|
||||
// typedef_type->GetSymbolFile()->GetClangDeclContextForTypeUID(typedef_type->GetID()));
|
||||
//}
|
||||
//
|
||||
//void *
|
||||
//TypeList::CreateClangLValueReferenceType (Type *type)
|
||||
//{
|
||||
// assert(type);
|
||||
// return m_ast.CreateLValueReferenceType(type->GetClangForwardType());
|
||||
//}
|
||||
//
|
||||
//void *
|
||||
//TypeList::CreateClangRValueReferenceType (Type *type)
|
||||
//{
|
||||
// assert(type);
|
||||
// return m_ast.CreateRValueReferenceType (type->GetClangForwardType());
|
||||
//}
|
||||
//
|
||||
|
||||
|
||||
|
|
|
@ -562,7 +562,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
{
|
||||
// Incorrect use of "." with a pointer, or "->" with
|
||||
// a class/union/struct instance or reference.
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
if (actual_is_ptr)
|
||||
error.SetErrorStringWithFormat ("\"%s\" is a pointer and . was used to attempt to access \"%s\". Did you mean \"%s->%s\"?",
|
||||
var_expr_path_strm.GetString().c_str(),
|
||||
|
@ -583,7 +583,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
if (!child_valobj_sp)
|
||||
{
|
||||
// No child member with name "child_name"
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
if (child_name)
|
||||
{
|
||||
error.SetErrorStringWithFormat ("\"%s\" is not a member of \"(%s) %s\"",
|
||||
|
@ -619,7 +619,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
child_valobj_sp = valobj_sp->GetSyntheticArrayMemberFromPointer (child_index, true);
|
||||
if (!child_valobj_sp)
|
||||
{
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
error.SetErrorStringWithFormat ("failed to use pointer as array for index %i for \"(%s) %s\"",
|
||||
child_index,
|
||||
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
||||
|
@ -631,7 +631,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
child_valobj_sp = valobj_sp->GetChildAtIndex (child_index, true);
|
||||
if (!child_valobj_sp)
|
||||
{
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"",
|
||||
child_index,
|
||||
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
||||
|
@ -640,7 +640,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
}
|
||||
else
|
||||
{
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
error.SetErrorStringWithFormat ("\"(%s) %s\" is not an array type",
|
||||
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
||||
var_expr_path_strm.GetString().c_str());
|
||||
|
@ -667,7 +667,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c
|
|||
default:
|
||||
// Failure...
|
||||
{
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm);
|
||||
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
||||
error.SetErrorStringWithFormat ("unexpected char '%c' encountered after \"%s\" in \"%s\"",
|
||||
separator_type,
|
||||
var_expr_path_strm.GetString().c_str(),
|
||||
|
|
|
@ -114,13 +114,12 @@ ThreadPlanAssemblyTracer::InitializeTracer()
|
|||
|
||||
m_abi = process.GetABI();
|
||||
|
||||
ModuleSP executableModuleSP (target.GetExecutableModule());
|
||||
TypeList *type_list = executableModuleSP->GetTypeList();
|
||||
ModuleSP exe_module_sp (target.GetExecutableModule());
|
||||
|
||||
if (type_list)
|
||||
if (exe_module_sp)
|
||||
{
|
||||
m_intptr_type = TypeFromUser(type_list->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
|
||||
type_list->GetClangASTContext().getASTContext());
|
||||
m_intptr_type = TypeFromUser(exe_module_sp->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
|
||||
exe_module_sp->GetClangASTContext().getASTContext());
|
||||
}
|
||||
|
||||
const unsigned int buf_size = 32;
|
||||
|
|
|
@ -180,7 +180,7 @@ class ClassTypesTestCase(TestBase):
|
|||
|
||||
# Verify that 'frame variable this' gets the data type correct.
|
||||
self.expect("frame variable this",VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['class C *'])
|
||||
substrs = ['C *'])
|
||||
|
||||
# Verify that frame variable -t this->m_c_int behaves correctly.
|
||||
self.expect("frame variable -t this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
|
@ -188,7 +188,7 @@ class ClassTypesTestCase(TestBase):
|
|||
|
||||
# Verify that 'expression this' gets the data type correct.
|
||||
self.expect("expression this", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['class C *'])
|
||||
substrs = ['C *'])
|
||||
|
||||
# rdar://problem/8430916
|
||||
# expr this->m_c_int returns an incorrect value
|
||||
|
|
Loading…
Reference in New Issue