[Lldb-commits] [lldb] r156845 - in /lldb/trunk: include/lldb/Symbol/Type.h source/Commands/CommandObjectTarget.cpp source/Symbol/Type.cpp
Greg Clayton
gclayton at apple.com
Tue May 15 12:26:12 PDT 2012
Author: gclayton
Date: Tue May 15 14:26:12 2012
New Revision: 156845
URL: http://llvm.org/viewvc/llvm-project?rev=156845&view=rev
Log:
Modified "image lookup -t <typename>" to expand typedefs.
Modified:
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Symbol/Type.cpp
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=156845&r1=156844&r2=156845&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Tue May 15 14:26:12 2012
@@ -138,6 +138,15 @@
return m_encoding_uid_type != eEncodingInvalid;
}
+ bool
+ IsTypedef ()
+ {
+ return m_encoding_uid_type == eEncodingIsTypedefUID;
+ }
+
+ lldb::TypeSP
+ GetTypedefType();
+
void
SetByteSize(uint32_t byte_size);
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=156845&r1=156844&r2=156845&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue May 15 14:26:12 2012
@@ -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();
}
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=156845&r1=156844&r2=156845&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Tue May 15 14:26:12 2012
@@ -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 ()
{
More information about the lldb-commits
mailing list