[Lldb-commits] [lldb] r116532 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ include/lldb/Symbol/ source/API/ source/Commands/ source/Core/ source/Expression/ source/Symbol/ test/array_types/ test/bitfields/
Greg Clayton
gclayton at apple.com
Thu Oct 14 15:52:14 PDT 2010
Author: gclayton
Date: Thu Oct 14 17:52:14 2010
New Revision: 116532
URL: http://llvm.org/viewvc/llvm-project?rev=116532&view=rev
Log:
Fixed an expression parsing issue where if you were stopped somewhere without
debug information and you evaluated an expression, a crash would occur as a
result of an unchecked pointer.
Added the ability to get the expression path for a ValueObject. For a rectangle
point child "x" the expression path would be something like: "rect.top_left.x".
This will allow GUI and command lines to get ahold of the expression path for
a value object without having to explicitly know about the hierarchy. This
means the ValueObject base class now has a "ValueObject *m_parent;" member.
All ValueObject subclasses now correctly track their lineage and are able
to provide value expression paths as well.
Added a new "--flat" option to the "frame variable" to allow for flat variable
output. An example of the current and new outputs:
(lldb) frame variable
argc = 1
argv = 0x00007fff5fbffe80
pt = {
x = 2
y = 3
}
rect = {
bottom_left = {
x = 1
y = 2
}
top_right = {
x = 3
y = 4
}
}
(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffe80
pt.x = 2
pt.y = 3
rect.bottom_left.x = 1
rect.bottom_left.y = 2
rect.top_right.x = 3
rect.top_right.y = 4
As you can see when there is a lot of hierarchy it can help flatten things out.
Also if you want to use a member in an expression, you can copy the text from
the "--flat" output and not have to piece it together manually. This can help
when you want to use parts of the STL in expressions:
(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffea8
hello_world._M_dataplus._M_p = 0x0000000000000000
(lldb) expr hello_world._M_dataplus._M_p[0] == '\0'
Modified:
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectChild.h
lldb/trunk/include/lldb/Core/ValueObjectRegister.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectChild.cpp
lldb/trunk/source/Core/ValueObjectConstResult.cpp
lldb/trunk/source/Core/ValueObjectRegister.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/test/array_types/TestArrayTypes.py
lldb/trunk/test/bitfields/TestBitfields.py
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Thu Oct 14 17:52:14 2010
@@ -71,6 +71,9 @@
~SBTypeMember ();
bool
+ IsBaseClass ();
+
+ bool
IsValid ();
void
@@ -110,7 +113,7 @@
int32_t m_offset;
uint32_t m_bit_size;
uint32_t m_bit_offset;
-
+ bool m_is_base_class;
};
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Oct 14 17:52:14 2010
@@ -82,6 +82,15 @@
IsPointerOrReferenceType ();
virtual bool
+ IsBaseClass ()
+ {
+ return false;
+ }
+
+ virtual void
+ GetExpressionPath (Stream &s);//, ValueObject *child);
+
+ virtual bool
IsInScope (StackFrame *frame)
{
return true;
@@ -199,7 +208,8 @@
bool show_types,
bool show_location,
bool use_objc,
- bool scope_already_checked);
+ bool scope_already_checked,
+ bool flat_output);
bool
GetIsConstant () const
@@ -225,10 +235,22 @@
m_format = format;
}
+ ValueObject *
+ GetParent()
+ {
+ return m_parent;
+ }
+
+ const ValueObject *
+ GetParent() const
+ {
+ return m_parent;
+ }
protected:
//------------------------------------------------------------------
// Classes that inherit from ValueObject can see and modify these
//------------------------------------------------------------------
+ ValueObject* m_parent; // The parent value object, or NULL if this has no parent
lldb::user_id_t m_update_id; // An integer that specifies the update number for this value in
// this value object list. If this value object is asked to update itself
// it will first check if the update ID match the value object
@@ -257,7 +279,7 @@
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- ValueObject ();
+ ValueObject (ValueObject *parent);
void
SetName (const char *name);
Modified: lldb/trunk/include/lldb/Core/ValueObjectChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectChild.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectChild.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectChild.h Thu Oct 14 17:52:14 2010
@@ -31,7 +31,8 @@
uint32_t byte_size,
int32_t byte_offset,
uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset);
+ uint32_t bitfield_bit_offset,
+ bool is_base_class);
virtual ~ValueObjectChild();
@@ -69,8 +70,13 @@
virtual bool
IsInScope (StackFrame *frame);
+ virtual bool
+ IsBaseClass ()
+ {
+ return m_is_base_class;
+ }
+
protected:
- ValueObject* m_parent; // The parent value object of which this is a child of.
clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from
void *m_clang_type; // The type of the child in question within the parent (m_parent_sp)
ConstString m_type_name;
@@ -78,6 +84,7 @@
int32_t m_byte_offset;
uint32_t m_bitfield_bit_size;
uint32_t m_bitfield_bit_offset;
+ bool m_is_base_class;
uint32_t
GetByteOffset() const;
Modified: lldb/trunk/include/lldb/Core/ValueObjectRegister.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectRegister.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectRegister.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectRegister.h Thu Oct 14 17:52:14 2010
@@ -26,7 +26,7 @@
class ValueObjectRegisterContext : public ValueObject
{
public:
- ValueObjectRegisterContext (RegisterContext *reg_ctx);
+ ValueObjectRegisterContext (ValueObject *parent, RegisterContext *reg_ctx);
virtual
~ValueObjectRegisterContext();
@@ -71,7 +71,7 @@
class ValueObjectRegisterSet : public ValueObject
{
public:
- ValueObjectRegisterSet (RegisterContext *reg_ctx, uint32_t set_idx);
+ ValueObjectRegisterSet (ValueObject *parent, RegisterContext *reg_ctx, uint32_t set_idx);
virtual
~ValueObjectRegisterSet();
@@ -119,7 +119,7 @@
class ValueObjectRegister : public ValueObject
{
public:
- ValueObjectRegister (RegisterContext *reg_ctx, uint32_t reg_num);
+ ValueObjectRegister (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_num);
virtual
~ValueObjectRegister();
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Oct 14 17:52:14 2010
@@ -30,6 +30,26 @@
class ClangASTContext
{
public:
+ enum {
+ eTypeHasChildren = (1u << 0),
+ eTypeHasValue = (1u << 1),
+ eTypeIsArray = (1u << 2),
+ eTypeIsBlock = (1u << 3),
+ eTypeIsBuiltIn = (1u << 4),
+ eTypeIsClass = (1u << 5),
+ eTypeIsCPlusPlus = (1u << 6),
+ eTypeIsEnumeration = (1u << 7),
+ eTypeIsFuncPrototype = (1u << 8),
+ eTypeIsMember = (1u << 9),
+ eTypeIsObjC = (1u << 10),
+ eTypeIsPointer = (1u << 11),
+ eTypeIsReference = (1u << 12),
+ eTypeIsStructUnion = (1u << 13),
+ eTypeIsTemplate = (1u << 14),
+ eTypeIsTypedef = (1u << 15),
+ eTypeIsVector = (1u << 16)
+ };
+
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
@@ -304,6 +324,10 @@
static bool
IsAggregateType (lldb::clang_type_t clang_type);
+ // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
+ static uint32_t
+ GetTypeInfoMask (lldb::clang_type_t clang_type);
+
static uint32_t
GetNumChildren (lldb::clang_type_t clang_type,
bool omit_empty_base_classes);
@@ -318,7 +342,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset);
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class);
static lldb::clang_type_t
GetChildClangTypeAtIndex (clang::ASTContext *ast_context,
@@ -331,7 +356,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset);
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class);
// Lookup a child given a name. This function will match base class names
// and member member names in "clang_type" only, not descendants.
@@ -529,6 +555,10 @@
IsFloatingPointType (lldb::clang_type_t clang_type, uint32_t &count, bool &is_complex);
static bool
+ GetCXXClassName (lldb::clang_type_t clang_type,
+ std::string &class_name);
+
+ static bool
IsCXXClassType (lldb::clang_type_t clang_type);
static bool
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Thu Oct 14 17:52:14 2010
@@ -197,7 +197,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset);
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class);
static int
Compare(const Type &a, const Type &b);
@@ -210,9 +211,11 @@
EncodingDataType m_encoding_uid_type;
uint32_t m_encoding_uid;
uint32_t m_byte_size;
- bool m_is_forward_decl;
Declaration m_decl;
- lldb::clang_type_t m_clang_qual_type;
+ lldb::clang_type_t m_clang_type;
+ bool m_is_forward_decl:1,
+ m_encoding_type_forward_decl_resolved:1,
+ m_encoding_type_decl_resolved:1;
Type *
GetEncodingType ();
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Oct 14 17:52:14 2010
@@ -390,7 +390,7 @@
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
{
- value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (reg_ctx, set_idx)));
+ value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (NULL, reg_ctx, set_idx)));
}
}
}
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Thu Oct 14 17:52:14 2010
@@ -83,6 +83,7 @@
int32_t child_byte_offset = 0;
uint32_t child_bitfield_bit_size = 0;
uint32_t child_bitfield_bit_offset = 0;
+ bool child_is_base_class = false;
if (IsValid ())
{
@@ -97,7 +98,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
}
@@ -110,6 +112,7 @@
member.m_offset = child_byte_offset;
member.m_bit_size = child_bitfield_bit_size;
member.m_bit_offset = child_bitfield_bit_offset;
+ member.m_is_base_class = child_is_base_class;
}
else
{
@@ -192,7 +195,9 @@
m_member_name (NULL),
m_offset (0),
m_bit_size (0),
- m_bit_offset (0)
+ m_bit_offset (0),
+ m_is_base_class (false)
+
{
}
@@ -222,6 +227,7 @@
m_offset = 0;
m_bit_size = 0;
m_bit_offset = 0;
+ m_is_base_class = false;
}
bool
@@ -248,6 +254,12 @@
return m_bit_offset;
}
+bool
+SBTypeMember::IsBaseClass ()
+{
+ return m_is_base_class;
+}
+
size_t
SBTypeMember::GetOffset ()
{
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Oct 14 17:52:14 2010
@@ -250,8 +250,8 @@
m_options.show_types, // Show types when dumping?
false, // Show locations of variables, no since this is a host address which we don't care to see
m_options.print_object, // Print the objective C object?
- true); // Scope is already checked. Const results are always in scope.
- output_stream.EOL();
+ true, // Scope is already checked. Const results are always in scope.
+ false); // Don't flatten output
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Oct 14 17:52:14 2010
@@ -318,6 +318,7 @@
case 'L': show_location= true; break;
case 'c': show_decl = true; break;
case 'D': debug = true; break;
+ case 'f': flat_output = true; break;
case 'd':
max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success);
if (!success)
@@ -362,6 +363,7 @@
show_location = false;
show_decl = false;
debug = false;
+ flat_output = false;
max_depth = UINT32_MAX;
ptr_depth = 0;
globals.clear();
@@ -386,7 +388,8 @@
show_summary:1,
show_location:1,
show_decl:1,
- debug:1;
+ debug:1,
+ flat_output:1;
uint32_t max_depth; // The depth to print when dumping concrete (not pointers) aggreate values
uint32_t ptr_depth; // The default depth that is dumped when we find pointers
std::vector<ConstString> globals;
@@ -502,8 +505,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -561,8 +564,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -731,9 +734,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
-
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
else
@@ -813,9 +815,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
-
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -849,6 +850,7 @@
{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, eArgTypeNone, "When looking up a variable by name (--name), print as an Objective-C object."},
{ LLDB_OPT_SET_1, false, "ptr-depth", 'p', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."},
{ LLDB_OPT_SET_1, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."},
+{ LLDB_OPT_SET_1, false, "flat", 'f', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."},
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
};
#pragma mark CommandObjectMultiwordFrame
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Oct 14 17:52:14 2010
@@ -42,8 +42,9 @@
//----------------------------------------------------------------------
// ValueObject constructor
//----------------------------------------------------------------------
-ValueObject::ValueObject () :
+ValueObject::ValueObject (ValueObject *parent) :
UserID (++g_value_obj_uid), // Unique identifier for every value object
+ m_parent (parent),
m_update_id (0), // Value object lists always start at 1, value objects start at zero
m_name (),
m_data (),
@@ -354,6 +355,7 @@
int32_t child_byte_offset = 0;
uint32_t child_bitfield_bit_size = 0;
uint32_t child_bitfield_bit_offset = 0;
+ bool child_is_base_class = false;
const bool transparent_pointers = synthetic_array_member == false;
clang::ASTContext *clang_ast = GetClangAST();
void *clang_type = GetClangType();
@@ -368,7 +370,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
if (child_clang_type)
{
if (synthetic_index)
@@ -385,7 +388,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset));
+ child_bitfield_bit_offset,
+ child_is_base_class));
}
return valobj_sp;
}
@@ -863,6 +867,46 @@
void
+ValueObject::GetExpressionPath (Stream &s)
+{
+ if (m_parent)
+ {
+ m_parent->GetExpressionPath (s);
+ clang_type_t parent_clang_type = m_parent->GetClangType();
+ if (parent_clang_type)
+ {
+ if (ClangASTContext::IsPointerType(parent_clang_type))
+ {
+ s.PutCString("->");
+ }
+ else if (ClangASTContext::IsAggregateType (parent_clang_type))
+ {
+ if (ClangASTContext::IsArrayType (parent_clang_type) == false &&
+ m_parent->IsBaseClass() == false)
+ s.PutChar('.');
+ }
+ }
+ }
+
+ if (IsBaseClass())
+ {
+ clang_type_t clang_type = GetClangType();
+ std::string cxx_class_name;
+ if (ClangASTContext::GetCXXClassName (clang_type, cxx_class_name))
+ {
+ s << cxx_class_name.c_str() << "::";
+ }
+ }
+ else
+ {
+ const char *name = GetName().AsCString();
+ if (name)
+ s.PutCString(name);
+ }
+}
+
+
+void
ValueObject::DumpValueObject
(
Stream &s,
@@ -875,33 +919,59 @@
bool show_types,
bool show_location,
bool use_objc,
- bool scope_already_checked
+ bool scope_already_checked,
+ bool flat_output
)
{
if (valobj)
{
//const char *loc_cstr = valobj->GetLocationAsCString();
- if (show_location)
+ clang_type_t clang_type = valobj->GetClangType();
+
+ const Flags type_info_flags (ClangASTContext::GetTypeInfoMask (clang_type));
+ const char *err_cstr = NULL;
+ const bool has_children = type_info_flags.IsSet (ClangASTContext::eTypeHasChildren);
+ const bool has_value = type_info_flags.IsSet (ClangASTContext::eTypeHasValue);
+
+ const bool print_valobj = flat_output == false || has_value;
+
+ if (print_valobj)
{
- s.Printf("%s: ", valobj->GetLocationAsCString(exe_scope));
- }
+ if (show_location)
+ {
+ s.Printf("%s: ", valobj->GetLocationAsCString(exe_scope));
+ }
- s.Indent();
+ s.Indent();
- if (show_types)
- s.Printf("(%s) ", valobj->GetTypeName().AsCString());
+ if (show_types)
+ s.Printf("(%s) ", valobj->GetTypeName().AsCString());
- const char *name_cstr = root_valobj_name ? root_valobj_name : valobj->GetName().AsCString("");
- s.Printf ("%s = ", name_cstr);
- if (!scope_already_checked && !valobj->IsInScope(exe_scope->CalculateStackFrame()))
- {
- s.PutCString("error: out of scope");
- return;
+ if (flat_output)
+ {
+ valobj->GetExpressionPath(s);
+ s.PutCString(" =");
+ }
+ else
+ {
+ const char *name_cstr = root_valobj_name ? root_valobj_name : valobj->GetName().AsCString("");
+ s.Printf ("%s =", name_cstr);
+ }
+
+ if (!scope_already_checked && !valobj->IsInScope(exe_scope->CalculateStackFrame()))
+ {
+ err_cstr = "error: out of scope";
+ }
}
- const char *val_cstr = valobj->GetValueAsCString(exe_scope);
- const char *err_cstr = valobj->GetError().AsCString();
+ const char *val_cstr = NULL;
+
+ if (err_cstr == NULL)
+ {
+ val_cstr = valobj->GetValueAsCString(exe_scope);
+ err_cstr = valobj->GetError().AsCString();
+ }
if (err_cstr)
{
@@ -909,75 +979,99 @@
}
else
{
- const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope);
-
- const bool is_aggregate = ClangASTContext::IsAggregateType (valobj->GetClangType());
+ if (print_valobj)
+ {
+ const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope);
- if (val_cstr)
- s.PutCString(val_cstr);
+ if (val_cstr)
+ s.Printf(" %s", val_cstr);
- if (sum_cstr)
- s.Printf(" %s", sum_cstr);
-
- if (use_objc)
- {
- const char *object_desc = valobj->GetObjectDescription(exe_scope);
- if (object_desc)
- s.Printf("\n%s\n", object_desc);
- else
- s.Printf ("No description available.\n");
- return;
+ if (sum_cstr)
+ s.Printf(" %s", sum_cstr);
+
+ if (use_objc)
+ {
+ const char *object_desc = valobj->GetObjectDescription(exe_scope);
+ if (object_desc)
+ s.Printf(" %s\n", object_desc);
+ else
+ s.Printf ("No description available.\n");
+ return;
+ }
}
-
if (curr_depth < max_depth)
{
- if (is_aggregate)
- s.PutChar('{');
-
- bool is_ptr_or_ref = ClangASTContext::IsPointerOrReferenceType (valobj->GetClangType());
+ bool is_ptr_or_ref = type_info_flags.IsSet (ClangASTContext::eTypeIsPointer | ClangASTContext::eTypeIsReference);
- if (is_ptr_or_ref && ptr_depth == 0)
- return;
-
- const uint32_t num_children = valobj->GetNumChildren();
- if (num_children)
+ if (!is_ptr_or_ref || ptr_depth > 0)
{
- s.IndentMore();
- for (uint32_t idx=0; idx<num_children; ++idx)
+ const uint32_t num_children = valobj->GetNumChildren();
+ if (num_children)
{
- ValueObjectSP child_sp(valobj->GetChildAtIndex(idx, true));
- if (child_sp.get())
+ if (flat_output)
{
- s.EOL();
- DumpValueObject (s,
- exe_scope,
- child_sp.get(),
- NULL,
- is_ptr_or_ref ? ptr_depth - 1 : ptr_depth,
- curr_depth + 1,
- max_depth,
- show_types,
- show_location,
- false,
- true);
- if (idx + 1 < num_children)
- s.PutChar(',');
+ if (print_valobj)
+ s.EOL();
+ }
+ else
+ {
+ if (print_valobj)
+ s.PutCString(" {\n");
+ s.IndentMore();
+ }
+
+ for (uint32_t idx=0; idx<num_children; ++idx)
+ {
+ ValueObjectSP child_sp(valobj->GetChildAtIndex(idx, true));
+ if (child_sp.get())
+ {
+ DumpValueObject (s,
+ exe_scope,
+ child_sp.get(),
+ NULL,
+ is_ptr_or_ref ? ptr_depth - 1 : ptr_depth,
+ curr_depth + 1,
+ max_depth,
+ show_types,
+ show_location,
+ false,
+ true,
+ flat_output);
+ }
+ }
+
+ if (!flat_output)
+ {
+ s.IndentLess();
+ s.Indent("}\n");
}
}
- s.IndentLess();
+ else if (has_children)
+ {
+ // Aggregate, no children...
+ if (print_valobj)
+ s.PutCString("{}\n");
+ }
+ else
+ {
+ if (print_valobj)
+ s.EOL();
+ }
+
}
- if (is_aggregate)
- {
+ else
+ {
+ // We printed a pointer, but we are stopping and not printing
+ // and children of this pointer...
s.EOL();
- s.Indent("}");
}
}
else
{
- if (is_aggregate)
+ if (has_children && print_valobj)
{
- s.PutCString("{...}");
+ s.PutCString("{...}\n");
}
}
}
Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Thu Oct 14 17:52:14 2010
@@ -33,16 +33,17 @@
uint32_t byte_size,
int32_t byte_offset,
uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset
+ uint32_t bitfield_bit_offset,
+ bool is_base_class
) :
- ValueObject (),
- m_parent (parent),
+ ValueObject (parent),
m_clang_ast (clang_ast),
m_clang_type (clang_type),
m_byte_size (byte_size),
m_byte_offset (byte_offset),
m_bitfield_bit_size (bitfield_bit_size),
- m_bitfield_bit_offset (bitfield_bit_offset)
+ m_bitfield_bit_offset (bitfield_bit_offset),
+ m_is_base_class (is_base_class)
{
m_name = name;
}
Modified: lldb/trunk/source/Core/ValueObjectConstResult.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResult.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResult.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResult.cpp Thu Oct 14 17:52:14 2010
@@ -35,7 +35,7 @@
lldb::ByteOrder data_byte_order,
uint8_t data_addr_size
) :
- ValueObject (),
+ ValueObject (NULL),
m_clang_ast (clang_ast),
m_type_name ()
{
@@ -50,7 +50,7 @@
}
ValueObjectConstResult::ValueObjectConstResult (const Error& error) :
- ValueObject (),
+ ValueObject (NULL),
m_clang_ast (NULL),
m_type_name ()
{
Modified: lldb/trunk/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectRegister.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectRegister.cpp Thu Oct 14 17:52:14 2010
@@ -29,8 +29,8 @@
#pragma mark ValueObjectRegisterContext
-ValueObjectRegisterContext::ValueObjectRegisterContext (RegisterContext *reg_ctx) :
- ValueObject (),
+ValueObjectRegisterContext::ValueObjectRegisterContext (ValueObject *parent, RegisterContext *reg_ctx) :
+ ValueObject (parent),
m_reg_ctx (reg_ctx)
{
assert (reg_ctx);
@@ -93,7 +93,7 @@
const uint32_t num_children = GetNumChildren();
if (idx < num_children)
- valobj_sp.reset (new ValueObjectRegisterSet(m_reg_ctx, idx));
+ valobj_sp.reset (new ValueObjectRegisterSet(this, m_reg_ctx, idx));
return valobj_sp;
}
@@ -101,8 +101,8 @@
#pragma mark -
#pragma mark ValueObjectRegisterSet
-ValueObjectRegisterSet::ValueObjectRegisterSet (RegisterContext *reg_ctx, uint32_t reg_set_idx) :
- ValueObject (),
+ValueObjectRegisterSet::ValueObjectRegisterSet (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_set_idx) :
+ ValueObject (parent),
m_reg_ctx (reg_ctx),
m_reg_set (NULL),
m_reg_set_idx (reg_set_idx)
@@ -195,7 +195,7 @@
{
const uint32_t num_children = GetNumChildren();
if (idx < num_children)
- valobj_sp.reset (new ValueObjectRegister(m_reg_ctx, m_reg_set->registers[idx]));
+ valobj_sp.reset (new ValueObjectRegister(this, m_reg_ctx, m_reg_set->registers[idx]));
}
return valobj_sp;
}
@@ -204,8 +204,8 @@
#pragma mark -
#pragma mark ValueObjectRegister
-ValueObjectRegister::ValueObjectRegister (RegisterContext *reg_ctx, uint32_t reg_num) :
- ValueObject (),
+ValueObjectRegister::ValueObjectRegister (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_num) :
+ ValueObject (parent),
m_reg_ctx (reg_ctx),
m_reg_info (NULL),
m_reg_num (reg_num),
Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Thu Oct 14 17:52:14 2010
@@ -33,7 +33,7 @@
using namespace lldb_private;
ValueObjectVariable::ValueObjectVariable (const lldb::VariableSP &var_sp) :
- ValueObject(),
+ ValueObject(NULL),
m_variable_sp(var_sp)
{
// Do not attempt to construct one of these objects with no variable!
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 14 17:52:14 2010
@@ -871,6 +871,9 @@
VariableList *var_list = frame.GetVariableList(true);
+ if (!var_list)
+ return NULL;
+
lldb::VariableSP var = var_list->FindVariable(name_cs);
if (!var)
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Oct 14 17:52:14 2010
@@ -1651,6 +1651,61 @@
}
+uint32_t
+ClangASTContext::GetTypeInfoMask (clang_type_t clang_type)
+{
+ if (clang_type == NULL)
+ return false;
+
+ QualType qual_type (QualType::getFromOpaquePtr(clang_type));
+
+ const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+ switch (type_class)
+ {
+ case clang::Type::BlockPointer: return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock;
+ case clang::Type::Builtin: return eTypeIsBuiltIn | eTypeHasValue;
+ case clang::Type::Complex: return eTypeHasChildren | eTypeIsBuiltIn | eTypeHasValue;
+ case clang::Type::ConstantArray: return eTypeHasChildren | eTypeIsArray;
+ case clang::Type::DependentName: return 0;
+ case clang::Type::DependentSizedArray: return eTypeHasChildren | eTypeIsArray;
+ case clang::Type::DependentSizedExtVector: return eTypeHasChildren | eTypeIsVector;
+ case clang::Type::DependentTemplateSpecialization: return eTypeIsTemplate;
+ case clang::Type::Decltype: return 0;
+ case clang::Type::Enum: return eTypeIsEnumeration | eTypeHasValue;
+ case clang::Type::Elaborated: return 0;
+ case clang::Type::ExtVector: return eTypeHasChildren | eTypeIsVector;
+ case clang::Type::FunctionProto: return eTypeIsFuncPrototype | eTypeHasValue;
+ case clang::Type::FunctionNoProto: return eTypeIsFuncPrototype | eTypeHasValue;
+ case clang::Type::IncompleteArray: return eTypeHasChildren | eTypeIsArray;
+ case clang::Type::InjectedClassName: return 0;
+ case clang::Type::LValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue;
+ case clang::Type::MemberPointer: return eTypeIsPointer | eTypeIsMember | eTypeHasValue;
+ case clang::Type::ObjCObjectPointer: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer | eTypeHasValue;
+ case clang::Type::ObjCObject: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass;
+ case clang::Type::ObjCInterface: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass;
+ case clang::Type::Pointer: return eTypeHasChildren | eTypeIsPointer | eTypeHasValue;
+ case clang::Type::Record:
+ if (qual_type->getAsCXXRecordDecl())
+ return eTypeHasChildren | eTypeIsClass | eTypeIsCPlusPlus;
+ else
+ return eTypeHasChildren | eTypeIsStructUnion;
+ break;
+ case clang::Type::RValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue;
+ case clang::Type::SubstTemplateTypeParm: return eTypeIsTemplate;
+ case clang::Type::TemplateTypeParm: return eTypeIsTemplate;
+ case clang::Type::TemplateSpecialization: return eTypeIsTemplate;
+ case clang::Type::Typedef: return eTypeIsTypedef |
+ ClangASTContext::GetTypeInfoMask (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr());
+ case clang::Type::TypeOfExpr: return 0;
+ case clang::Type::TypeOf: return 0;
+ case clang::Type::UnresolvedUsing: return 0;
+ case clang::Type::VariableArray: return eTypeHasChildren | eTypeIsArray;
+ case clang::Type::Vector: return eTypeHasChildren | eTypeIsVector;
+ default: return 0;
+ }
+ return 0;
+}
+
#pragma mark Aggregate Types
@@ -1838,7 +1893,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class
)
{
if (parent_clang_type)
@@ -1853,7 +1909,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
return NULL;
}
@@ -1870,7 +1927,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class
)
{
if (parent_clang_type == NULL)
@@ -1881,6 +1939,7 @@
uint32_t bit_offset;
child_bitfield_bit_size = 0;
child_bitfield_bit_offset = 0;
+ child_is_base_class = false;
QualType parent_qual_type(QualType::getFromOpaquePtr(parent_clang_type));
const clang::Type::TypeClass parent_type_class = parent_qual_type->getTypeClass();
switch (parent_type_class)
@@ -1956,6 +2015,7 @@
// Base classes biut sizes should be a multiple of 8 bits in size
assert (clang_type_info_bit_size % 8 == 0);
child_byte_size = clang_type_info_bit_size / 8;
+ child_is_base_class = true;
return base_class->getType().getAsOpaquePtr();
}
// We don't increment the child index in the for loop since we might
@@ -2025,6 +2085,7 @@
child_byte_size = ivar_type_info.first / 8;
child_byte_offset = 0;
+ child_is_base_class = true;
return ivar_qual_type.getAsOpaquePtr();
}
@@ -2087,7 +2148,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
}
else
{
@@ -2119,8 +2181,8 @@
{
std::pair<uint64_t, unsigned> field_type_info = ast_context->getTypeInfo(array->getElementType());
- char element_name[32];
- ::snprintf (element_name, sizeof (element_name), "%s[%u]", parent_name ? parent_name : "", idx);
+ char element_name[64];
+ ::snprintf (element_name, sizeof (element_name), "[%u]", idx);
child_name.assign(element_name);
assert(field_type_info.first % 8 == 0);
@@ -2148,7 +2210,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
}
else
{
@@ -2182,7 +2245,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
break;
default:
@@ -3411,6 +3475,26 @@
return false;
}
+
+bool
+ClangASTContext::GetCXXClassName (clang_type_t clang_type, std::string &class_name)
+{
+ if (clang_type)
+ {
+ QualType qual_type (QualType::getFromOpaquePtr(clang_type));
+
+ CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
+ if (cxx_record_decl)
+ {
+ class_name.assign (cxx_record_decl->getIdentifier()->getNameStart());
+ return true;
+ }
+ }
+ class_name.clear();
+ return false;
+}
+
+
bool
ClangASTContext::IsCXXClassType (clang_type_t clang_type)
{
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Thu Oct 14 17:52:14 2010
@@ -49,9 +49,11 @@
m_encoding_uid_type (encoding_data_type),
m_encoding_uid (encoding_data),
m_byte_size (byte_size),
- m_is_forward_decl (is_forward_decl),
m_decl (decl),
- m_clang_qual_type (clang_type)
+ m_clang_type (clang_type),
+ m_is_forward_decl (is_forward_decl),
+ m_encoding_type_forward_decl_resolved (false),
+ m_encoding_type_decl_resolved (false)
{
}
@@ -66,7 +68,7 @@
m_byte_size (0),
m_is_forward_decl (false),
m_decl (),
- m_clang_qual_type (NULL)
+ m_clang_type (NULL)
{
}
@@ -86,7 +88,7 @@
m_byte_size = rhs.m_byte_size;
m_is_forward_decl = rhs.m_is_forward_decl;
m_decl = rhs.m_decl;
- m_clang_qual_type = rhs.m_clang_qual_type;
+ m_clang_type = rhs.m_clang_type;
}
return *this;
}
@@ -107,10 +109,10 @@
bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
m_decl.Dump(s, show_fullpaths);
- if (m_clang_qual_type)
+ if (m_clang_type)
{
*s << ", clang_type = \"";
- ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_qual_type, s);
+ ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_type, s);
*s << '"';
}
else if (m_encoding_uid != LLDB_INVALID_UID)
@@ -154,11 +156,11 @@
bool show_fullpaths = false;
m_decl.Dump (s,show_fullpaths);
- if (m_clang_qual_type)
+ if (m_clang_type)
{
- *s << ", clang_type = " << m_clang_qual_type << ' ';
+ *s << ", clang_type = " << m_clang_type << ' ';
- ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_qual_type, s);
+ ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_type, s);
}
else if (m_encoding_uid != LLDB_INVALID_UID)
{
@@ -190,7 +192,7 @@
{
if (ResolveClangType(true))
{
- std::string type_name = ClangASTContext::GetTypeName (m_clang_qual_type);
+ std::string type_name = ClangASTContext::GetTypeName (m_clang_type);
if (!type_name.empty())
m_name.SetCString (type_name.c_str());
}
@@ -230,7 +232,7 @@
}
lldb_private::ClangASTType::DumpValue (GetClangAST (),
- m_clang_qual_type,
+ m_clang_type,
exe_ctx,
s,
format == lldb::eFormatDefault ? GetFormat() : format,
@@ -300,7 +302,7 @@
{
if (!ResolveClangType())
return 0;
- return ClangASTContext::GetNumChildren (m_clang_qual_type, omit_empty_base_classes);
+ return ClangASTContext::GetNumChildren (m_clang_type, omit_empty_base_classes);
}
@@ -308,7 +310,7 @@
lldb_private::Type::IsAggregateType ()
{
if (ResolveClangType())
- return ClangASTContext::IsAggregateType (m_clang_qual_type);
+ return ClangASTContext::IsAggregateType (m_clang_type);
return false;
}
@@ -318,7 +320,7 @@
// Make sure we resolve our type if it already hasn't been.
if (!ResolveClangType())
return lldb::eFormatInvalid;
- return lldb_private::ClangASTType::GetFormat (m_clang_qual_type);
+ return lldb_private::ClangASTType::GetFormat (m_clang_type);
}
@@ -330,7 +332,7 @@
if (!ResolveClangType())
return lldb::eEncodingInvalid;
- return lldb_private::ClangASTType::GetEncoding (m_clang_qual_type, count);
+ return lldb_private::ClangASTType::GetEncoding (m_clang_type, count);
}
@@ -422,10 +424,7 @@
bool
lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
{
-// static int g_depth = 0;
-// g_depth++;
-// printf ("%.*sType::ResolveClangType (forward = %i) uid = 0x%8.8x, name = %s\n", g_depth, "", forward_decl_is_ok, m_uid, m_name.AsCString());
- if (m_clang_qual_type == NULL)
+ if (m_clang_type == NULL)
{
TypeList *type_list = GetTypeList();
Type *encoding_type = GetEncodingType();
@@ -435,38 +434,38 @@
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
- m_clang_qual_type = encoding_type->GetClangType();
+ m_clang_type = encoding_type->GetClangType();
break;
case eEncodingIsConstUID:
- m_clang_qual_type = ClangASTContext::AddConstModifier (encoding_type->GetClangForwardType());
+ m_clang_type = ClangASTContext::AddConstModifier (encoding_type->GetClangForwardType());
break;
case eEncodingIsRestrictUID:
- m_clang_qual_type = ClangASTContext::AddRestrictModifier (encoding_type->GetClangForwardType());
+ m_clang_type = ClangASTContext::AddRestrictModifier (encoding_type->GetClangForwardType());
break;
case eEncodingIsVolatileUID:
- m_clang_qual_type = ClangASTContext::AddVolatileModifier (encoding_type->GetClangForwardType());
+ m_clang_type = ClangASTContext::AddVolatileModifier (encoding_type->GetClangForwardType());
break;
case eEncodingIsTypedefUID:
- m_clang_qual_type = type_list->CreateClangTypedefType (this, encoding_type);
+ m_clang_type = type_list->CreateClangTypedefType (this, encoding_type);
// Clear the name so it can get fully qualified in case the
// typedef is in a namespace.
m_name.Clear();
break;
case eEncodingIsPointerUID:
- m_clang_qual_type = type_list->CreateClangPointerType (encoding_type);
+ m_clang_type = type_list->CreateClangPointerType (encoding_type);
break;
case eEncodingIsLValueReferenceUID:
- m_clang_qual_type = type_list->CreateClangLValueReferenceType (encoding_type);
+ m_clang_type = type_list->CreateClangLValueReferenceType (encoding_type);
break;
case eEncodingIsRValueReferenceUID:
- m_clang_qual_type = type_list->CreateClangRValueReferenceType (encoding_type);
+ m_clang_type = type_list->CreateClangRValueReferenceType (encoding_type);
break;
default:
@@ -481,35 +480,35 @@
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
- m_clang_qual_type = void_clang_type;
+ m_clang_type = void_clang_type;
break;
case eEncodingIsConstUID:
- m_clang_qual_type = ClangASTContext::AddConstModifier (void_clang_type);
+ m_clang_type = ClangASTContext::AddConstModifier (void_clang_type);
break;
case eEncodingIsRestrictUID:
- m_clang_qual_type = ClangASTContext::AddRestrictModifier (void_clang_type);
+ m_clang_type = ClangASTContext::AddRestrictModifier (void_clang_type);
break;
case eEncodingIsVolatileUID:
- m_clang_qual_type = ClangASTContext::AddVolatileModifier (void_clang_type);
+ m_clang_type = ClangASTContext::AddVolatileModifier (void_clang_type);
break;
case eEncodingIsTypedefUID:
- m_clang_qual_type = type_list->GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
+ m_clang_type = type_list->GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
break;
case eEncodingIsPointerUID:
- m_clang_qual_type = type_list->GetClangASTContext().CreatePointerType (void_clang_type);
+ m_clang_type = type_list->GetClangASTContext().CreatePointerType (void_clang_type);
break;
case eEncodingIsLValueReferenceUID:
- m_clang_qual_type = type_list->GetClangASTContext().CreateLValueReferenceType (void_clang_type);
+ m_clang_type = type_list->GetClangASTContext().CreateLValueReferenceType (void_clang_type);
break;
case eEncodingIsRValueReferenceUID:
- m_clang_qual_type = type_list->GetClangASTContext().CreateRValueReferenceType (void_clang_type);
+ m_clang_type = type_list->GetClangASTContext().CreateRValueReferenceType (void_clang_type);
break;
default:
@@ -520,26 +519,51 @@
}
// Check if we have a forward reference to a class/struct/union/enum?
- if (m_is_forward_decl && m_clang_qual_type && !forward_decl_is_ok)
+ if (m_clang_type != NULL &&
+ m_is_forward_decl == true &&
+ forward_decl_is_ok == false)
{
m_is_forward_decl = false;
- if (!ClangASTType::IsDefined (m_clang_qual_type))
+ if (!ClangASTType::IsDefined (m_clang_type))
{
// We have a forward declaration, we need to resolve it to a complete
// definition.
- m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_qual_type);
+ m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_type);
}
}
// If we have an encoding type, then we need to make sure it is
- // resolved appropriately
- Type *encoding_type = GetEncodingType ();
- if (encoding_type != NULL)
- encoding_type->ResolveClangType (forward_decl_is_ok);
-
-// if (g_depth > 0)
-// --g_depth;
- return m_clang_qual_type != NULL;
+ // resolved appropriately.
+ if (m_encoding_type_decl_resolved == false)
+ {
+ if ((forward_decl_is_ok == true && !m_encoding_type_forward_decl_resolved) ||
+ (forward_decl_is_ok == false))
+ {
+ Type *encoding_type = GetEncodingType ();
+ if (encoding_type != NULL)
+ {
+ if (encoding_type->ResolveClangType (forward_decl_is_ok))
+ {
+ // We have at least resolve the forward declaration for our
+ // encoding type...
+ m_encoding_type_forward_decl_resolved = true;
+
+ // Check if we fully resolved our encoding type, and if so
+ // mark it as having been completely resolved.
+ if (forward_decl_is_ok == false)
+ m_encoding_type_decl_resolved = true;
+ }
+ }
+ else
+ {
+ // We don't have an encoding type, so mark everything as being
+ // resolved so we don't get into this if statement again
+ m_encoding_type_decl_resolved = true;
+ m_encoding_type_forward_decl_resolved = true;
+ }
+ }
+ }
+ return m_clang_type != NULL;
}
clang_type_t
@@ -553,7 +577,8 @@
uint32_t &child_byte_size,
int32_t &child_byte_offset,
uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class
)
{
if (!ResolveClangType())
@@ -562,7 +587,7 @@
std::string name_str;
clang_type_t child_qual_type = GetClangASTContext().GetChildClangTypeAtIndex (
parent_name,
- m_clang_qual_type,
+ m_clang_type,
idx,
transparent_pointers,
omit_empty_base_classes,
@@ -570,7 +595,8 @@
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
- child_bitfield_bit_offset);
+ child_bitfield_bit_offset,
+ child_is_base_class);
if (child_qual_type)
{
@@ -588,7 +614,7 @@
{
const bool forward_decl_is_ok = false;
ResolveClangType(forward_decl_is_ok);
- return m_clang_qual_type;
+ return m_clang_type;
}
clang_type_t
@@ -596,7 +622,7 @@
{
const bool forward_decl_is_ok = true;
ResolveClangType (forward_decl_is_ok);
- return m_clang_qual_type;
+ return m_clang_type;
}
clang::ASTContext *
Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Thu Oct 14 17:52:14 2010
@@ -69,18 +69,18 @@
self.expect("frame variable -t strings", VARIABLES_DISPLAYED_CORRECTLY,
startstr = '(char *[4])',
- substrs = ['(char *) strings[0]',
- '(char *) strings[1]',
- '(char *) strings[2]',
- '(char *) strings[3]',
+ substrs = ['(char *) [0]',
+ '(char *) [1]',
+ '(char *) [2]',
+ '(char *) [3]',
'Hello',
'Hola',
'Bonjour',
'Guten Tag'])
self.expect("frame variable -t char_16", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(char) char_16[0]',
- '(char) char_16[15]'])
+ substrs = ['(char) [0]',
+ '(char) [15]'])
self.expect("frame variable -t ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
startstr = '(unsigned short [2][3])')
Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=116532&r1=116531&r2=116532&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Thu Oct 14 17:52:14 2010
@@ -61,25 +61,25 @@
# This should display correctly.
self.expect("frame variable -t bits", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1,',
- '(uint32_t:2) b2 = 3,',
- '(uint32_t:3) b3 = 7,',
- '(uint32_t:4) b4 = 15,',
- '(uint32_t:5) b5 = 31,',
- '(uint32_t:6) b6 = 63,',
- '(uint32_t:7) b7 = 127,',
+ substrs = ['(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t:4) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
'(uint32_t:4) four = 15'])
# And so should this.
# rdar://problem/8348251
self.expect("frame variable -t", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1,',
- '(uint32_t:2) b2 = 3,',
- '(uint32_t:3) b3 = 7,',
- '(uint32_t:4) b4 = 15,',
- '(uint32_t:5) b5 = 31,',
- '(uint32_t:6) b6 = 63,',
- '(uint32_t:7) b7 = 127,',
+ substrs = ['(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t:4) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
'(uint32_t:4) four = 15'])
def bitfields_variable_python(self):
More information about the lldb-commits
mailing list