Modified "image lookup -t <typename>" to expand typedefs.
llvm-svn: 156845
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 6bb2da3..c7b644f 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1573,7 +1573,7 @@
}
static uint32_t
-LookupTypeInModule (CommandInterpreter &interpreter,
+LookupTypeInModule (CommandInterpreter &interpreter,
Stream &strm,
Module *module,
const char *name_cstr,
@@ -1606,6 +1606,18 @@
// to types that haven't yet been parsed will get parsed.
type_sp->GetClangFullType ();
type_sp->GetDescription (&strm, eDescriptionLevelFull, true);
+ // Print all typedef chains
+ TypeSP typedef_type_sp (type_sp);
+ TypeSP typedefed_type_sp (typedef_type_sp->GetTypedefType());
+ while (typedefed_type_sp)
+ {
+ strm.EOL();
+ strm.Printf(" typedef '%s': ", typedef_type_sp->GetName().GetCString());
+ typedefed_type_sp->GetClangFullType ();
+ typedefed_type_sp->GetDescription (&strm, eDescriptionLevelFull, true);
+ typedef_type_sp = typedefed_type_sp;
+ typedefed_type_sp = typedef_type_sp->GetTypedefType();
+ }
}
strm.EOL();
}
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index a3a9a4f..335cbce 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -346,6 +346,21 @@
return false;
}
+lldb::TypeSP
+Type::GetTypedefType()
+{
+ lldb::TypeSP type_sp;
+ if (IsTypedef())
+ {
+ Type *typedef_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
+ if (typedef_type)
+ type_sp = typedef_type->shared_from_this();
+ }
+ return type_sp;
+}
+
+
+
lldb::Format
Type::GetFormat ()
{