diff options
| author | Greg Clayton <gclayton@apple.com> | 2014-01-23 21:38:34 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2014-01-23 21:38:34 +0000 |
| commit | 1f4db7da8fa4e3c8e0b7ac9807abc7905675c61f (patch) | |
| tree | f653e8e793a10b715e4755ff491e2c434f553358 /lldb | |
| parent | b1ce33379a847a0b5257a03560d96a4158f1edf8 (diff) | |
| download | bcm5719-llvm-1f4db7da8fa4e3c8e0b7ac9807abc7905675c61f.tar.gz bcm5719-llvm-1f4db7da8fa4e3c8e0b7ac9807abc7905675c61f.zip | |
Added the ability to get the type that a typedef points to via:
SBType SBType::GetTypedefedType();
Also added the ability to get a type by type ID from a SBModule:
SBType SBModule::GetTypeByID (lldb::user_id_t uid);
llvm-svn: 199939
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/include/lldb/API/SBModule.h | 19 | ||||
| -rw-r--r-- | lldb/include/lldb/API/SBType.h | 3 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/Type.h | 13 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBModule.i | 3 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBType.i | 3 | ||||
| -rw-r--r-- | lldb/source/API/SBModule.cpp | 17 | ||||
| -rw-r--r-- | lldb/source/API/SBType.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Symbol/Type.cpp | 10 |
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()) |

