summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBModule.h19
-rw-r--r--lldb/include/lldb/API/SBType.h3
-rw-r--r--lldb/include/lldb/Symbol/Type.h13
-rw-r--r--lldb/scripts/Python/interface/SBModule.i3
-rw-r--r--lldb/scripts/Python/interface/SBType.i3
-rw-r--r--lldb/source/API/SBModule.cpp17
-rw-r--r--lldb/source/API/SBType.cpp8
-rw-r--r--lldb/source/Symbol/Type.cpp10
8 files changed, 75 insertions, 1 deletions
diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h
index f5955b39734..e85654bccc7 100644
--- a/lldb/include/lldb/API/SBModule.h
+++ b/lldb/include/lldb/API/SBModule.h
@@ -235,6 +235,25 @@ public:
lldb::SBTypeList
FindTypes (const char* type);
+ //------------------------------------------------------------------
+ /// Get a type using its type ID.
+ ///
+ /// Each symbol file reader will assign different user IDs to their
+ /// types, but it is sometimes useful when debugging type issues to
+ /// be able to grab a type using its type ID.
+ ///
+ /// For DWARF debug info, the type ID is the DIE offset.
+ ///
+ /// @param[in] uid
+ /// The type user ID.
+ ///
+ /// @return
+ /// An SBType for the given type ID, or an empty SBType if the
+ /// type was not found.
+ //------------------------------------------------------------------
+ lldb::SBType
+ GetTypeByID (lldb::user_id_t uid);
+
lldb::SBType
GetBasicType(lldb::BasicType type);
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 3729b2f84b9..2cd9b4459a3 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -106,6 +106,9 @@ public:
GetReferenceType();
lldb::SBType
+ GetTypedefedType();
+
+ lldb::SBType
GetDereferencedType();
lldb::SBType
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 920f571fa1e..da327439936 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -417,7 +417,15 @@ public:
return type_sp->GetClangLayoutType().GetLValueReferenceType();
return clang_type.GetLValueReferenceType();
}
-
+
+ ClangASTType
+ GetTypedefedType () const
+ {
+ if (type_sp)
+ return type_sp->GetClangFullType().GetTypedefedType();
+ return clang_type.GetTypedefedType();
+ }
+
ClangASTType
GetDereferencedType () const
{
@@ -513,6 +521,9 @@ public:
GetReferenceType () const;
TypeImpl
+ GetTypedefedType () const;
+
+ TypeImpl
GetDereferencedType () const;
TypeImpl
diff --git a/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i
index 21f9dcc4055..387a2741e02 100644
--- a/lldb/scripts/Python/interface/SBModule.i
+++ b/lldb/scripts/Python/interface/SBModule.i
@@ -231,6 +231,9 @@ public:
FindTypes (const char* type);
lldb::SBType
+ GetTypeByID (lldb::user_id_t uid);
+
+ lldb::SBType
GetBasicType(lldb::BasicType type);
%feature("docstring", "
diff --git a/lldb/scripts/Python/interface/SBType.i b/lldb/scripts/Python/interface/SBType.i
index fbeed3efd66..936bf2ccf27 100644
--- a/lldb/scripts/Python/interface/SBType.i
+++ b/lldb/scripts/Python/interface/SBType.i
@@ -178,6 +178,9 @@ public:
GetReferenceType();
lldb::SBType
+ SBType::GetTypedefedType();
+
+ lldb::SBType
GetDereferencedType();
lldb::SBType
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 0285cf304d4..19c3ee7fce5 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -579,6 +579,23 @@ SBModule::FindTypes (const char *type)
return retval;
}
+lldb::SBType
+SBModule::GetTypeByID (lldb::user_id_t uid)
+{
+ ModuleSP module_sp (GetSP ());
+ if (module_sp)
+ {
+ SymbolVendor* vendor = module_sp->GetSymbolVendor();
+ if (vendor)
+ {
+ Type *type_ptr = vendor->ResolveTypeUID(uid);
+ if (type_ptr)
+ return SBType(type_ptr->shared_from_this());
+ }
+ }
+ return SBType();
+}
+
lldb::SBTypeList
SBModule::GetTypes (uint32_t type_mask)
{
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 3055c275208..5ca7ddf3d81 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -186,6 +186,14 @@ SBType::GetReferenceType()
}
SBType
+SBType::GetTypedefedType()
+{
+ if (!IsValid())
+ return SBType();
+ return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetTypedefedType())));
+}
+
+SBType
SBType::GetDereferencedType()
{
if (!IsValid())
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 32a1d474053..073940e8a7f 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1084,6 +1084,16 @@ TypeImpl::GetReferenceType () const
}
TypeImpl
+TypeImpl::GetTypedefedType () const
+{
+ if (m_dynamic_type.IsValid())
+ {
+ return TypeImpl(m_static_type, m_dynamic_type.GetTypedefedType());
+ }
+ return TypeImpl(m_static_type.GetTypedefedType());
+}
+
+TypeImpl
TypeImpl::GetDereferencedType () const
{
if (m_dynamic_type.IsValid())
OpenPOWER on IntegriCloud