summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Symbol
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Symbol')
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/ClangASTImporter.cpp15
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/ClangASTType.cpp108
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/CompileUnit.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/DWARFCallFrameInfo.cpp9
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/FuncUnwinders.cpp23
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/LineEntry.cpp6
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp6
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/Symbol.cpp120
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/SymbolContext.cpp12
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/Symtab.cpp11
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/Type.cpp286
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/UnwindTable.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/Symbol/Variable.cpp11
13 files changed, 492 insertions, 119 deletions
diff --git a/contrib/llvm/tools/lldb/source/Symbol/ClangASTImporter.cpp b/contrib/llvm/tools/lldb/source/Symbol/ClangASTImporter.cpp
index 1529496..afdca97 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/ClangASTImporter.cpp
@@ -716,3 +716,18 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to)
return clang::ASTImporter::Imported(from, to);
}
+
+clang::Decl *ClangASTImporter::Minion::GetOriginalDecl (clang::Decl *To)
+{
+ ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&To->getASTContext());
+
+ if (!to_context_md)
+ return NULL;
+
+ OriginMap::iterator iter = to_context_md->m_origins.find(To);
+
+ if (iter == to_context_md->m_origins.end())
+ return NULL;
+
+ return const_cast<clang::Decl*>(iter->second.decl);
+}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/ClangASTType.cpp b/contrib/llvm/tools/lldb/source/Symbol/ClangASTType.cpp
index 2e7c079..c904b79 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/ClangASTType.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/ClangASTType.cpp
@@ -288,6 +288,26 @@ ClangASTType::IsArrayType (ClangASTType *element_type_ptr,
return 0;
}
+bool
+ClangASTType::IsRuntimeGeneratedType () const
+{
+ if (!IsValid())
+ return false;
+
+ clang::DeclContext* decl_ctx = GetDeclContextForType();
+ if (!decl_ctx)
+ return false;
+
+ if (!llvm::isa<clang::ObjCInterfaceDecl>(decl_ctx))
+ return false;
+
+ clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
+
+ ClangASTMetadata* ast_metadata = ClangASTContext::GetMetadata(m_ast, result_iface_decl);
+ if (!ast_metadata)
+ return false;
+ return (ast_metadata->GetISAPtr() != 0);
+}
bool
ClangASTType::IsCharType () const
@@ -385,6 +405,34 @@ ClangASTType::IsFunctionType (bool *is_variadic_ptr) const
return false;
}
+size_t
+ClangASTType::GetNumberOfFunctionArguments () const
+{
+ if (IsValid())
+ {
+ QualType qual_type (GetCanonicalQualType());
+ const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
+ if (func)
+ return func->getNumArgs();
+ }
+ return 0;
+}
+
+ClangASTType
+ClangASTType::GetFunctionArgumentAtIndex (const size_t index)
+{
+ if (IsValid())
+ {
+ QualType qual_type (GetCanonicalQualType());
+ const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
+ if (func)
+ {
+ if (index < func->getNumArgs())
+ return ClangASTType(m_ast, func->getArgType(index).getAsOpaquePtr());
+ }
+ }
+ return ClangASTType();
+}
bool
ClangASTType::IsFunctionPointerType () const
@@ -1065,14 +1113,14 @@ ClangASTType::GetConstTypeName () const
{
if (IsValid())
{
- std::string type_name (GetTypeName());
- if (!type_name.empty())
- return ConstString (type_name.c_str());
+ ConstString type_name (GetTypeName());
+ if (type_name)
+ return type_name;
}
return ConstString("<invalid>");
}
-std::string
+ConstString
ClangASTType::GetTypeName () const
{
std::string type_name;
@@ -1093,7 +1141,7 @@ ClangASTType::GetTypeName () const
type_name = qual_type.getAsString(printing_policy);
}
}
- return type_name;
+ return ConstString(type_name);
}
@@ -1865,7 +1913,6 @@ ClangASTType::GetEncoding (uint64_t &count) const
case clang::Type::TemplateSpecialization:
case clang::Type::Atomic:
break;
-
}
count = 0;
return lldb::eEncodingInvalid;
@@ -2271,26 +2318,29 @@ ClangASTType::GetNumDirectBaseClasses () const
break;
case clang::Type::ObjCObjectPointer:
+ count = GetPointeeType().GetNumDirectBaseClasses();
+ break;
+
+ case clang::Type::ObjCObject:
if (GetCompleteType())
{
- const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ const ObjCObjectType *objc_class_type = qual_type->getAsObjCQualifiedInterfaceType();
if (objc_class_type)
{
- ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+
if (class_interface_decl && class_interface_decl->getSuperClass())
count = 1;
}
}
break;
-
- case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
if (GetCompleteType())
{
- const ObjCObjectType *objc_class_type = qual_type->getAsObjCQualifiedInterfaceType();
- if (objc_class_type)
+ const ObjCInterfaceType *objc_interface_type = qual_type->getAs<ObjCInterfaceType>();
+ if (objc_interface_type)
{
- ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+ ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getInterface();
if (class_interface_decl && class_interface_decl->getSuperClass())
count = 1;
@@ -2472,12 +2522,16 @@ ClangASTType::GetDirectBaseClassAtIndex (size_t idx, uint32_t *bit_offset_ptr) c
break;
case clang::Type::ObjCObjectPointer:
+ return GetPointeeType().GetDirectBaseClassAtIndex(idx,bit_offset_ptr);
+
+ case clang::Type::ObjCObject:
if (idx == 0 && GetCompleteType())
{
- const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ const ObjCObjectType *objc_class_type = qual_type->getAsObjCQualifiedInterfaceType();
if (objc_class_type)
{
- ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+
if (class_interface_decl)
{
ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
@@ -2491,15 +2545,13 @@ ClangASTType::GetDirectBaseClassAtIndex (size_t idx, uint32_t *bit_offset_ptr) c
}
}
break;
-
- case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
if (idx == 0 && GetCompleteType())
{
- const ObjCObjectType *objc_class_type = qual_type->getAsObjCQualifiedInterfaceType();
- if (objc_class_type)
+ const ObjCObjectType *objc_interface_type = qual_type->getAs<ObjCInterfaceType>();
+ if (objc_interface_type)
{
- ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+ ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getInterface();
if (class_interface_decl)
{
@@ -2977,7 +3029,7 @@ ClangASTType::GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
// Base classes should be a multiple of 8 bits in size
child_byte_offset = bit_offset/8;
ClangASTType base_class_clang_type(m_ast, base_class->getType());
- child_name = base_class_clang_type.GetTypeName();
+ child_name = base_class_clang_type.GetTypeName().AsCString("");
uint64_t base_class_clang_type_bit_size = base_class_clang_type.GetBitSize();
// Base classes bit sizes should be a multiple of 8 bits in size
@@ -3507,7 +3559,17 @@ ClangASTType::GetIndexOfChildMemberWithName (const char *name,
field != field_end;
++field, ++child_idx)
{
- if (field->getName().equals (name_sref))
+ llvm::StringRef field_name = field->getName();
+ if (field_name.empty())
+ {
+ ClangASTType field_type(m_ast,field->getType());
+ child_indexes.push_back(child_idx);
+ if (field_type.GetIndexOfChildMemberWithName(name, omit_empty_base_classes, child_indexes))
+ return child_indexes.size();
+ child_indexes.pop_back();
+
+ }
+ else if (field_name.equals (name_sref))
{
// We have to add on the number of base classes to this index!
child_indexes.push_back (child_idx + ClangASTContext::GetNumBaseClasses (cxx_record_decl, omit_empty_base_classes));
@@ -3767,7 +3829,7 @@ ClangASTType::GetIndexOfChildWithName (const char *name, bool omit_empty_base_cl
continue;
ClangASTType base_class_clang_type (m_ast, base_class->getType());
- std::string base_class_type_name (base_class_clang_type.GetTypeName());
+ std::string base_class_type_name (base_class_clang_type.GetTypeName().AsCString(""));
if (base_class_type_name.compare (name) == 0)
return child_idx;
++child_idx;
diff --git a/contrib/llvm/tools/lldb/source/Symbol/CompileUnit.cpp b/contrib/llvm/tools/lldb/source/Symbol/CompileUnit.cpp
index 751b09e..62ae1cc 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/CompileUnit.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/CompileUnit.cpp
@@ -324,7 +324,7 @@ CompileUnit::ResolveSymbolContext
// "file_spec" has an empty directory, then only compare the basenames
// when finding file indexes
std::vector<uint32_t> file_indexes;
- const bool full_match = file_spec.GetDirectory();
+ const bool full_match = (bool)file_spec.GetDirectory();
bool file_spec_matches_cu_file_spec = FileSpec::Equal(file_spec, *this, full_match);
// If we are not looking for inlined functions and our file spec doesn't
diff --git a/contrib/llvm/tools/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/contrib/llvm/tools/lldb/source/Symbol/DWARFCallFrameInfo.cpp
index e8f99a9..d3d9628 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/DWARFCallFrameInfo.cpp
@@ -341,7 +341,7 @@ DWARFCallFrameInfo::GetFDEIndex ()
dw_offset_t next_entry = current_entry + len + 4;
dw_offset_t cie_id = m_cfi_data.GetU32 (&offset);
- if (cie_id == 0 || cie_id == UINT32_MAX)
+ if (cie_id == 0 || cie_id == UINT32_MAX || len == 0)
{
m_cie_map[current_entry] = ParseCIE (current_entry);
offset = next_entry;
@@ -444,6 +444,8 @@ DWARFCallFrameInfo::FDEToUnwindPlan (dw_offset_t dwarf_offset, Address startaddr
unwind_plan.SetRegisterKind (m_reg_kind);
unwind_plan.SetReturnAddressRegister (cie->return_addr_reg_num);
+ std::vector<UnwindPlan::RowSP> stack;
+
UnwindPlan::Row::RegisterLocation reg_location;
while (m_cfi_data.ValidOffset(offset) && offset < end_offset)
{
@@ -629,7 +631,7 @@ DWARFCallFrameInfo::FDEToUnwindPlan (dw_offset_t dwarf_offset, Address startaddr
// the stack and place them in the current row. (This operation is
// useful for compilers that move epilogue code into the body of a
// function.)
- unwind_plan.AppendRow (row);
+ stack.push_back (row);
UnwindPlan::Row *newrow = new UnwindPlan::Row;
*newrow = *row.get();
row.reset (newrow);
@@ -645,7 +647,8 @@ DWARFCallFrameInfo::FDEToUnwindPlan (dw_offset_t dwarf_offset, Address startaddr
// useful for compilers that move epilogue code into the body of a
// function.)
{
- row = unwind_plan.GetRowAtIndex(unwind_plan.GetRowCount() - 1);
+ row = stack.back ();
+ stack.pop_back ();
}
break;
diff --git a/contrib/llvm/tools/lldb/source/Symbol/FuncUnwinders.cpp b/contrib/llvm/tools/lldb/source/Symbol/FuncUnwinders.cpp
index 3de0617..68b05ad 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/FuncUnwinders.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/FuncUnwinders.cpp
@@ -114,9 +114,12 @@ FuncUnwinders::GetUnwindPlanAtNonCallSite (Thread& thread)
if (m_tried_unwind_at_non_call_site == false && m_unwind_plan_non_call_site_sp.get() == NULL)
{
m_tried_unwind_at_non_call_site = true;
- m_unwind_plan_non_call_site_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
- if (!m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *m_unwind_plan_non_call_site_sp))
- m_unwind_plan_non_call_site_sp.reset();
+ if (m_assembly_profiler)
+ {
+ m_unwind_plan_non_call_site_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
+ if (!m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *m_unwind_plan_non_call_site_sp))
+ m_unwind_plan_non_call_site_sp.reset();
+ }
}
return m_unwind_plan_non_call_site_sp;
}
@@ -140,9 +143,12 @@ FuncUnwinders::GetUnwindPlanFastUnwind (Thread& thread)
if (m_tried_unwind_fast == false && m_unwind_plan_fast_sp.get() == NULL)
{
m_tried_unwind_fast = true;
- m_unwind_plan_fast_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
- if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_unwind_plan_fast_sp))
- m_unwind_plan_fast_sp.reset();
+ if (m_assembly_profiler)
+ {
+ m_unwind_plan_fast_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
+ if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_unwind_plan_fast_sp))
+ m_unwind_plan_fast_sp.reset();
+ }
}
return m_unwind_plan_fast_sp;
}
@@ -216,7 +222,7 @@ FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry (Thread& thread)
}
}
- return m_unwind_plan_arch_default_sp;
+ return m_unwind_plan_arch_default_at_func_entry_sp;
}
@@ -226,7 +232,8 @@ FuncUnwinders::GetFirstNonPrologueInsn (Target& target)
if (m_first_non_prologue_insn.IsValid())
return m_first_non_prologue_insn;
ExecutionContext exe_ctx (target.shared_from_this(), false);
- m_assembly_profiler->FirstNonPrologueInsn (m_range, exe_ctx, m_first_non_prologue_insn);
+ if (m_assembly_profiler)
+ m_assembly_profiler->FirstNonPrologueInsn (m_range, exe_ctx, m_first_non_prologue_insn);
return m_first_non_prologue_insn;
}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/LineEntry.cpp b/contrib/llvm/tools/lldb/source/Symbol/LineEntry.cpp
index 10dc552..08a2392 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/LineEntry.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/LineEntry.cpp
@@ -17,7 +17,7 @@ using namespace lldb_private;
LineEntry::LineEntry() :
range(),
file(),
- line(0),
+ line(LLDB_INVALID_LINE_NUMBER),
column(0),
is_start_of_statement(0),
is_start_of_basic_block(0),
@@ -58,7 +58,7 @@ LineEntry::Clear()
{
range.Clear();
file.Clear();
- line = 0;
+ line = LLDB_INVALID_LINE_NUMBER;
column = 0;
is_start_of_statement = 0;
is_start_of_basic_block = 0;
@@ -71,7 +71,7 @@ LineEntry::Clear()
bool
LineEntry::IsValid() const
{
- return range.GetBaseAddress().IsValid() && line != 0;
+ return range.GetBaseAddress().IsValid() && line != LLDB_INVALID_LINE_NUMBER;
}
bool
diff --git a/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp b/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp
index 0c61591..ec69c9d 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp
@@ -423,6 +423,7 @@ ObjectFile::GetAddressClass (addr_t file_addr)
case eSymbolTypeObjCClass: return eAddressClassRuntime;
case eSymbolTypeObjCMetaClass: return eAddressClassRuntime;
case eSymbolTypeObjCIVar: return eAddressClassRuntime;
+ case eSymbolTypeReExported: return eAddressClassRuntime;
}
}
}
@@ -459,7 +460,8 @@ size_t
ObjectFile::CopyData (off_t offset, size_t length, void *dst) const
{
// The entire file has already been mmap'ed into m_data, so just copy from there
- return m_data.CopyByteOrderedData (offset, length, dst, length, lldb::endian::InlHostByteOrder());
+ // Note that the data remains in target byte order.
+ return m_data.CopyData (offset, length, dst);
}
@@ -501,7 +503,7 @@ ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void
uint64_t section_dst_len = dst_len;
if (section_dst_len > section_bytes_left)
section_dst_len = section_bytes_left;
- bzero(dst, section_dst_len);
+ memset(dst, 0, section_dst_len);
return section_dst_len;
}
}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/Symbol.cpp b/contrib/llvm/tools/lldb/source/Symbol/Symbol.cpp
index 7f3543c..a881b6f 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/Symbol.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/Symbol.cpp
@@ -10,6 +10,7 @@
#include "lldb/Symbol/Symbol.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -176,6 +177,66 @@ Symbol::ValueIsAddress() const
return m_addr_range.GetBaseAddress().GetSection().get() != NULL;
}
+ConstString
+Symbol::GetReExportedSymbolName() const
+{
+ if (m_type == eSymbolTypeReExported)
+ {
+ // For eSymbolTypeReExported, the "const char *" from a ConstString
+ // is used as the offset in the address range base address. We can
+ // then make this back into a string that is the re-exported name.
+ intptr_t str_ptr = m_addr_range.GetBaseAddress().GetOffset();
+ if (str_ptr != 0)
+ return ConstString((const char *)str_ptr);
+ else
+ return GetName();
+ }
+ return ConstString();
+}
+
+FileSpec
+Symbol::GetReExportedSymbolSharedLibrary() const
+{
+ if (m_type == eSymbolTypeReExported)
+ {
+ // For eSymbolTypeReExported, the "const char *" from a ConstString
+ // is used as the offset in the address range base address. We can
+ // then make this back into a string that is the re-exported name.
+ intptr_t str_ptr = m_addr_range.GetByteSize();
+ if (str_ptr != 0)
+ return FileSpec((const char *)str_ptr, false);
+ }
+ return FileSpec();
+}
+
+bool
+Symbol::SetReExportedSymbolName(const ConstString &name)
+{
+ if (m_type == eSymbolTypeReExported)
+ {
+ // For eSymbolTypeReExported, the "const char *" from a ConstString
+ // is used as the offset in the address range base address.
+ m_addr_range.GetBaseAddress().SetOffset((intptr_t)name.GetCString());
+ return true;
+ }
+ return false;
+
+}
+
+bool
+Symbol::SetReExportedSymbolSharedLibrary(const FileSpec &fspec)
+{
+ if (m_type == eSymbolTypeReExported)
+ {
+ // For eSymbolTypeReExported, the "const char *" from a ConstString
+ // is used as the offset in the address range base address.
+ m_addr_range.SetByteSize((intptr_t)ConstString(fspec.GetPath().c_str()).GetCString());
+ return true;
+ }
+ return false;
+
+}
+
uint32_t
Symbol::GetSiblingIndex() const
{
@@ -267,6 +328,19 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const
m_flags,
m_mangled.GetName().AsCString(""));
}
+ else if (m_type == eSymbolTypeReExported)
+ {
+ s->Printf (" 0x%8.8x %s",
+ m_flags,
+ m_mangled.GetName().AsCString(""));
+
+ ConstString reexport_name = GetReExportedSymbolName();
+ intptr_t shlib = m_addr_range.GetByteSize();
+ if (shlib)
+ s->Printf(" -> %s`%s\n", (const char *)shlib, reexport_name.GetCString());
+ else
+ s->Printf(" -> %s\n", reexport_name.GetCString());
+ }
else
{
const char *format = m_size_is_sibling ?
@@ -380,6 +454,7 @@ Symbol::GetTypeAsString() const
ENUM_TO_CSTRING(Invalid);
ENUM_TO_CSTRING(Absolute);
ENUM_TO_CSTRING(Code);
+ ENUM_TO_CSTRING(Resolver);
ENUM_TO_CSTRING(Data);
ENUM_TO_CSTRING(Trampoline);
ENUM_TO_CSTRING(Runtime);
@@ -404,6 +479,7 @@ Symbol::GetTypeAsString() const
ENUM_TO_CSTRING(ObjCClass);
ENUM_TO_CSTRING(ObjCMetaClass);
ENUM_TO_CSTRING(ObjCIVar);
+ ENUM_TO_CSTRING(ReExported);
default:
break;
}
@@ -460,3 +536,47 @@ Symbol::GetByteSize () const
return m_addr_range.GetByteSize();
}
+Symbol *
+Symbol::ResolveReExportedSymbol (Target &target)
+{
+ ConstString reexport_name (GetReExportedSymbolName());
+ if (reexport_name)
+ {
+ ModuleSpec module_spec;
+ ModuleSP module_sp;
+ module_spec.GetFileSpec() = GetReExportedSymbolSharedLibrary();
+ if (module_spec.GetFileSpec())
+ {
+ // Try searching for the module file spec first using the full path
+ module_sp = target.GetImages().FindFirstModule(module_spec);
+ if (!module_sp)
+ {
+ // Next try and find the module by basename in case environment
+ // variables or other runtime trickery causes shared libraries
+ // to be loaded from alternate paths
+ module_spec.GetFileSpec().GetDirectory().Clear();
+ module_sp = target.GetImages().FindFirstModule(module_spec);
+ }
+ }
+
+ if (module_sp)
+ {
+ lldb_private::SymbolContextList sc_list;
+ module_sp->FindSymbolsWithNameAndType(reexport_name, eSymbolTypeAny, sc_list);
+ const size_t num_scs = sc_list.GetSize();
+ if (num_scs > 0)
+ {
+ for (size_t i=0; i<num_scs; ++i)
+ {
+ lldb_private::SymbolContext sc;
+ if (sc_list.GetContextAtIndex(i, sc))
+ {
+ if (sc.symbol->IsExternal())
+ return sc.symbol;
+ }
+ }
+ }
+ }
+ }
+ return NULL;
+}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/SymbolContext.cpp b/contrib/llvm/tools/lldb/source/Symbol/SymbolContext.cpp
index ac91161..f1e581f 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/SymbolContext.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/SymbolContext.cpp
@@ -910,15 +910,15 @@ SymbolContextSpecifier::GetDescription (Stream *s, lldb::DescriptionLevel level)
s->Printf ("File: %s", path_str);
if (m_type == eLineStartSpecified)
{
- s->Printf (" from line %lu", m_start_line);
+ s->Printf (" from line %zu", m_start_line);
if (m_type == eLineEndSpecified)
- s->Printf ("to line %lu", m_end_line);
+ s->Printf ("to line %zu", m_end_line);
else
s->Printf ("to end");
}
else if (m_type == eLineEndSpecified)
{
- s->Printf (" from start to line %ld", m_end_line);
+ s->Printf (" from start to line %zu", m_end_line);
}
s->Printf (".\n");
}
@@ -926,16 +926,16 @@ SymbolContextSpecifier::GetDescription (Stream *s, lldb::DescriptionLevel level)
if (m_type == eLineStartSpecified)
{
s->Indent();
- s->Printf ("From line %lu", m_start_line);
+ s->Printf ("From line %zu", m_start_line);
if (m_type == eLineEndSpecified)
- s->Printf ("to line %lu", m_end_line);
+ s->Printf ("to line %zu", m_end_line);
else
s->Printf ("to end");
s->Printf (".\n");
}
else if (m_type == eLineEndSpecified)
{
- s->Printf ("From start to line %ld.\n", m_end_line);
+ s->Printf ("From start to line %zu.\n", m_end_line);
}
if (m_type == eFunctionSpecified)
diff --git a/contrib/llvm/tools/lldb/source/Symbol/Symtab.cpp b/contrib/llvm/tools/lldb/source/Symbol/Symtab.cpp
index 27af698..430fc17 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/Symtab.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/Symtab.cpp
@@ -90,14 +90,14 @@ Symtab::Dump (Stream *s, Target *target, SortOrder sort_order)
object_name = m_objfile->GetModule()->GetObjectName().GetCString();
if (file_spec)
- s->Printf("Symtab, file = %s%s%s%s, num_symbols = %lu",
+ s->Printf("Symtab, file = %s%s%s%s, num_symbols = %zu",
file_spec.GetPath().c_str(),
object_name ? "(" : "",
object_name ? object_name : "",
object_name ? ")" : "",
m_symbols.size());
else
- s->Printf("Symtab, num_symbols = %lu", m_symbols.size());
+ s->Printf("Symtab, num_symbols = %zu", m_symbols.size());
if (!m_symbols.empty())
{
@@ -166,7 +166,7 @@ Symtab::Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const
const size_t num_symbols = GetNumSymbols();
//s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
- s->Printf("Symtab %lu symbol indexes (%lu symbols total):\n", indexes.size(), m_symbols.size());
+ s->Printf("Symtab %zu symbol indexes (%zu symbols total):\n", indexes.size(), m_symbols.size());
s->IndentMore();
if (!indexes.empty())
@@ -682,7 +682,7 @@ Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, Symb
if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
++pos;
else
- indexes.erase(pos);
+ pos = indexes.erase(pos);
}
}
return indexes.size();
@@ -701,7 +701,7 @@ Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, Symb
if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
++pos;
else
- indexes.erase(pos);
+ pos = indexes.erase(pos);
}
}
return indexes.size();
@@ -1135,6 +1135,7 @@ Symtab::FindFunctionSymbols (const ConstString &name,
{
case eSymbolTypeCode:
case eSymbolTypeResolver:
+ case eSymbolTypeReExported:
symbol_indexes.push_back(temp_symbol_indexes[i]);
break;
default:
diff --git a/contrib/llvm/tools/lldb/source/Symbol/Type.cpp b/contrib/llvm/tools/lldb/source/Symbol/Type.cpp
index 0af2359..32a1d47 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/Type.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/Type.cpp
@@ -798,12 +798,12 @@ Type::GetTypeScopeAndBasename (const char* &name_cstr,
-TypeAndOrName::TypeAndOrName () : m_type_sp(), m_type_name()
+TypeAndOrName::TypeAndOrName () : m_type_pair(), m_type_name()
{
}
-TypeAndOrName::TypeAndOrName (TypeSP &in_type_sp) : m_type_sp(in_type_sp)
+TypeAndOrName::TypeAndOrName (TypeSP &in_type_sp) : m_type_pair(in_type_sp)
{
if (in_type_sp)
m_type_name = in_type_sp->GetName();
@@ -813,7 +813,7 @@ TypeAndOrName::TypeAndOrName (const char *in_type_str) : m_type_name(in_type_str
{
}
-TypeAndOrName::TypeAndOrName (const TypeAndOrName &rhs) : m_type_sp (rhs.m_type_sp), m_type_name (rhs.m_type_name)
+TypeAndOrName::TypeAndOrName (const TypeAndOrName &rhs) : m_type_pair (rhs.m_type_pair), m_type_name (rhs.m_type_name)
{
}
@@ -828,7 +828,7 @@ TypeAndOrName::operator= (const TypeAndOrName &rhs)
if (this != &rhs)
{
m_type_name = rhs.m_type_name;
- m_type_sp = rhs.m_type_sp;
+ m_type_pair = rhs.m_type_pair;
}
return *this;
}
@@ -836,7 +836,7 @@ TypeAndOrName::operator= (const TypeAndOrName &rhs)
bool
TypeAndOrName::operator==(const TypeAndOrName &other) const
{
- if (m_type_sp != other.m_type_sp)
+ if (m_type_pair != other.m_type_pair)
return false;
if (m_type_name != other.m_type_name)
return false;
@@ -846,7 +846,7 @@ TypeAndOrName::operator==(const TypeAndOrName &other) const
bool
TypeAndOrName::operator!=(const TypeAndOrName &other) const
{
- if (m_type_sp != other.m_type_sp)
+ if (m_type_pair != other.m_type_pair)
return true;
if (m_type_name != other.m_type_name)
return true;
@@ -855,11 +855,12 @@ TypeAndOrName::operator!=(const TypeAndOrName &other) const
ConstString
TypeAndOrName::GetName () const
-{
- if (m_type_sp)
- return m_type_sp->GetName();
- else
+{
+ if (m_type_name)
return m_type_name;
+ if (m_type_pair)
+ return m_type_pair.GetName();
+ return ConstString("<invalid>");
}
void
@@ -877,15 +878,23 @@ TypeAndOrName::SetName (const char *type_name_cstr)
void
TypeAndOrName::SetTypeSP (lldb::TypeSP type_sp)
{
- m_type_sp = type_sp;
- if (type_sp)
- m_type_name = type_sp->GetName();
+ m_type_pair.SetType(type_sp);
+ if (m_type_pair)
+ m_type_name = m_type_pair.GetName();
+}
+
+void
+TypeAndOrName::SetClangASTType (ClangASTType clang_type)
+{
+ m_type_pair.SetType(clang_type);
+ if (m_type_pair)
+ m_type_name = m_type_pair.GetName();
}
bool
-TypeAndOrName::IsEmpty()
+TypeAndOrName::IsEmpty() const
{
- if (m_type_name || m_type_sp)
+ if ((bool)m_type_name || (bool)m_type_pair)
return false;
else
return true;
@@ -895,96 +904,247 @@ void
TypeAndOrName::Clear ()
{
m_type_name.Clear();
- m_type_sp.reset();
+ m_type_pair.Clear();
}
bool
-TypeAndOrName::HasName ()
+TypeAndOrName::HasName () const
{
return (bool)m_type_name;
}
bool
-TypeAndOrName::HasTypeSP ()
+TypeAndOrName::HasTypeSP () const
+{
+ return m_type_pair.GetTypeSP().get() != nullptr;
+}
+
+bool
+TypeAndOrName::HasClangASTType () const
+{
+ return m_type_pair.GetClangASTType().IsValid();
+}
+
+
+TypeImpl::TypeImpl() :
+m_static_type(),
+m_dynamic_type()
{
- return m_type_sp.get() != NULL;
}
-TypeImpl::TypeImpl(const lldb_private::ClangASTType& clang_ast_type) :
- m_clang_ast_type(clang_ast_type),
- m_type_sp()
+TypeImpl::TypeImpl(const TypeImpl& rhs) :
+m_static_type(rhs.m_static_type),
+m_dynamic_type(rhs.m_dynamic_type)
{
}
-TypeImpl::TypeImpl(const lldb::TypeSP& type) :
- m_clang_ast_type(type->GetClangForwardType()),
- m_type_sp(type)
+TypeImpl::TypeImpl (lldb::TypeSP type_sp) :
+m_static_type(type_sp),
+m_dynamic_type()
+{
+}
+
+TypeImpl::TypeImpl (ClangASTType clang_type) :
+m_static_type(clang_type),
+m_dynamic_type()
+{
+}
+
+TypeImpl::TypeImpl (lldb::TypeSP type_sp, ClangASTType dynamic) :
+m_static_type (type_sp),
+m_dynamic_type(dynamic)
+{
+}
+
+TypeImpl::TypeImpl (ClangASTType clang_type, ClangASTType dynamic) :
+m_static_type (clang_type),
+m_dynamic_type(dynamic)
+{
+}
+
+TypeImpl::TypeImpl (TypePair pair, ClangASTType dynamic) :
+m_static_type (pair),
+m_dynamic_type(dynamic)
{
}
void
-TypeImpl::SetType (const lldb::TypeSP &type_sp)
+TypeImpl::SetType (lldb::TypeSP type_sp)
{
- if (type_sp)
- {
- m_clang_ast_type = type_sp->GetClangForwardType();
- m_type_sp = type_sp;
- }
- else
- {
- m_clang_ast_type.Clear();
- m_type_sp.reset();
- }
+ m_static_type.SetType(type_sp);
+}
+
+void
+TypeImpl::SetType (ClangASTType clang_type)
+{
+ m_static_type.SetType (clang_type);
+}
+
+void
+TypeImpl::SetType (lldb::TypeSP type_sp, ClangASTType dynamic)
+{
+ m_static_type.SetType (type_sp);
+ m_dynamic_type = dynamic;
+}
+
+void
+TypeImpl::SetType (ClangASTType clang_type, ClangASTType dynamic)
+{
+ m_static_type.SetType (clang_type);
+ m_dynamic_type = dynamic;
+}
+
+void
+TypeImpl::SetType (TypePair pair, ClangASTType dynamic)
+{
+ m_static_type = pair;
+ m_dynamic_type = dynamic;
}
TypeImpl&
TypeImpl::operator = (const TypeImpl& rhs)
{
- if (*this != rhs)
+ if (rhs != *this)
{
- m_clang_ast_type = rhs.m_clang_ast_type;
- m_type_sp = rhs.m_type_sp;
+ m_static_type = rhs.m_static_type;
+ m_dynamic_type = rhs.m_dynamic_type;
}
return *this;
}
-clang::ASTContext*
-TypeImpl::GetASTContext()
+bool
+TypeImpl::operator == (const TypeImpl& rhs) const
{
- if (!IsValid())
- return NULL;
-
- return m_clang_ast_type.GetASTContext();
+ return m_static_type == rhs.m_static_type &&
+ m_dynamic_type == rhs.m_dynamic_type;
}
-lldb::clang_type_t
-TypeImpl::GetOpaqueQualType()
+bool
+TypeImpl::operator != (const TypeImpl& rhs) const
{
- if (!IsValid())
- return NULL;
-
- return m_clang_ast_type.GetOpaqueQualType();
+ return m_static_type != rhs.m_static_type ||
+ m_dynamic_type != rhs.m_dynamic_type;
}
bool
-TypeImpl::GetDescription (lldb_private::Stream &strm,
- lldb::DescriptionLevel description_level)
+TypeImpl::IsValid() const
+{
+ // just a name is not valid
+ return m_static_type.IsValid() || m_dynamic_type.IsValid();
+}
+
+TypeImpl::operator bool () const
+{
+ return IsValid();
+}
+
+void
+TypeImpl::Clear()
+{
+ m_static_type.Clear();
+ m_dynamic_type.Clear();
+}
+
+ConstString
+TypeImpl::GetName () const
{
- if (m_clang_ast_type.IsValid())
+ if (m_dynamic_type)
+ return m_dynamic_type.GetTypeName();
+ return m_static_type.GetName ();
+}
+
+TypeImpl
+TypeImpl::GetPointerType () const
+{
+ if (m_dynamic_type.IsValid())
{
- m_clang_ast_type.DumpTypeDescription (&strm);
+ return TypeImpl(m_static_type, m_dynamic_type.GetPointerType());
}
- else
+ return TypeImpl(m_static_type.GetPointerType());
+}
+
+TypeImpl
+TypeImpl::GetPointeeType () const
+{
+ if (m_dynamic_type.IsValid())
{
- strm.PutCString ("No value");
+ return TypeImpl(m_static_type, m_dynamic_type.GetPointeeType());
}
- return true;
+ return TypeImpl(m_static_type.GetPointeeType());
}
-ConstString
-TypeImpl::GetName ()
+TypeImpl
+TypeImpl::GetReferenceType () const
{
- if (m_clang_ast_type.IsValid())
- return m_clang_ast_type.GetConstTypeName();
- return ConstString();
+ if (m_dynamic_type.IsValid())
+ {
+ return TypeImpl(m_static_type, m_dynamic_type.GetLValueReferenceType());
+ }
+ return TypeImpl(m_static_type.GetReferenceType());
+}
+
+TypeImpl
+TypeImpl::GetDereferencedType () const
+{
+ if (m_dynamic_type.IsValid())
+ {
+ return TypeImpl(m_static_type, m_dynamic_type.GetNonReferenceType());
+ }
+ return TypeImpl(m_static_type.GetDereferencedType());
+}
+
+TypeImpl
+TypeImpl::GetUnqualifiedType() const
+{
+ if (m_dynamic_type.IsValid())
+ {
+ return TypeImpl(m_static_type, m_dynamic_type.GetFullyUnqualifiedType());
+ }
+ return TypeImpl(m_static_type.GetUnqualifiedType());
+}
+
+TypeImpl
+TypeImpl::GetCanonicalType() const
+{
+ if (m_dynamic_type.IsValid())
+ {
+ return TypeImpl(m_static_type, m_dynamic_type.GetCanonicalType());
+ }
+ return TypeImpl(m_static_type.GetCanonicalType());
+}
+
+ClangASTType
+TypeImpl::GetClangASTType (bool prefer_dynamic)
+{
+ if (prefer_dynamic)
+ {
+ if (m_dynamic_type.IsValid())
+ return m_dynamic_type;
+ }
+ return m_static_type.GetClangASTType();
+}
+
+clang::ASTContext *
+TypeImpl::GetClangASTContext (bool prefer_dynamic)
+{
+ if (prefer_dynamic)
+ {
+ if (m_dynamic_type.IsValid())
+ return m_dynamic_type.GetASTContext();
+ }
+ return m_static_type.GetClangASTContext();
+}
+
+bool
+TypeImpl::GetDescription (lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level)
+{
+ if (m_dynamic_type.IsValid())
+ {
+ strm.Printf("Dynamic:\n");
+ m_dynamic_type.DumpTypeDescription(&strm);
+ strm.Printf("\nStatic:\n");
+ }
+ m_static_type.GetClangASTType().DumpTypeDescription(&strm);
+ return true;
}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/UnwindTable.cpp b/contrib/llvm/tools/lldb/source/Symbol/UnwindTable.cpp
index c77628b..33eb4d6 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/UnwindTable.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/UnwindTable.cpp
@@ -102,7 +102,7 @@ UnwindTable::GetFuncUnwindersContainingAddress (const Address& addr, SymbolConte
FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, m_assembly_profiler, range));
m_unwinds.insert (insert_pos, std::make_pair(range.GetBaseAddress().GetFileAddress(), func_unwinder_sp));
-// StreamFile s(stdout);
+// StreamFile s(stdout, false);
// Dump (s);
return func_unwinder_sp;
}
diff --git a/contrib/llvm/tools/lldb/source/Symbol/Variable.cpp b/contrib/llvm/tools/lldb/source/Symbol/Variable.cpp
index 36439b5..7276e0a 100644
--- a/contrib/llvm/tools/lldb/source/Symbol/Variable.cpp
+++ b/contrib/llvm/tools/lldb/source/Symbol/Variable.cpp
@@ -684,11 +684,14 @@ PrivateAutoComplete (StackFrame *frame,
VariableList *variable_list = frame->GetVariableList(get_file_globals);
- const size_t num_variables = variable_list->GetSize();
- for (size_t i=0; i<num_variables; ++i)
+ if (variable_list)
{
- Variable *variable = variable_list->GetVariableAtIndex(i).get();
- matches.AppendString (variable->GetName().AsCString());
+ const size_t num_variables = variable_list->GetSize();
+ for (size_t i=0; i<num_variables; ++i)
+ {
+ Variable *variable = variable_list->GetVariableAtIndex(i).get();
+ matches.AppendString (variable->GetName().AsCString());
+ }
}
}
}
OpenPOWER on IntegriCloud