diff options
author | Greg Clayton <gclayton@apple.com> | 2010-10-14 22:52:14 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-10-14 22:52:14 +0000 |
commit | 8f92f0a35cba08ca0b4ff83b062494bc9d81ebe0 (patch) | |
tree | 2eadcc035d4e643d3ede63794a1b6a85a60ccf95 | |
parent | 10169b94cfe6838f881339f1944891f6d8451174 (diff) | |
download | bcm5719-llvm-8f92f0a35cba08ca0b4ff83b062494bc9d81ebe0.tar.gz bcm5719-llvm-8f92f0a35cba08ca0b4ff83b062494bc9d81ebe0.zip |
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'
llvm-svn: 116532
20 files changed, 478 insertions, 191 deletions
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index b89aca92e51..9463b815890 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -71,6 +71,9 @@ public: ~SBTypeMember (); bool + IsBaseClass (); + + bool IsValid (); void @@ -110,7 +113,7 @@ protected: int32_t m_offset; uint32_t m_bit_size; uint32_t m_bit_offset; - + bool m_is_base_class; }; diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 0e6385f7d40..a26a332eeda 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -82,6 +82,15 @@ public: IsPointerOrReferenceType (); virtual bool + IsBaseClass () + { + return false; + } + + virtual void + GetExpressionPath (Stream &s);//, ValueObject *child); + + virtual bool IsInScope (StackFrame *frame) { return true; @@ -199,7 +208,8 @@ public: 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 @@ public: 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 @@ protected: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - ValueObject (); + ValueObject (ValueObject *parent); void SetName (const char *name); diff --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h index bfa9d962ab8..2e046cd54d3 100644 --- a/lldb/include/lldb/Core/ValueObjectChild.h +++ b/lldb/include/lldb/Core/ValueObjectChild.h @@ -31,7 +31,8 @@ public: 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 @@ public: 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 @@ protected: 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; diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index 98f538ce254..83717dc1d39 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/include/lldb/Core/ValueObjectRegister.h @@ -26,7 +26,7 @@ namespace lldb_private { class ValueObjectRegisterContext : public ValueObject { public: - ValueObjectRegisterContext (RegisterContext *reg_ctx); + ValueObjectRegisterContext (ValueObject *parent, RegisterContext *reg_ctx); virtual ~ValueObjectRegisterContext(); @@ -71,7 +71,7 @@ private: 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 @@ private: 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(); diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 135ce55df53..da8583d16be 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -30,6 +30,26 @@ class Declaration; 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 2f85b0da538..2d7c222e820 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -197,7 +197,8 @@ public: 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 @@ protected: 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 (); diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index f4dfb33242d..9afac97b4ba 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -390,7 +390,7 @@ SBFrame::GetRegisters () 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))); } } } diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 5c3e97381ad..35c280dc21e 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -83,6 +83,7 @@ SBType::GetChildAtIndex (bool omit_empty_base_classes, uint32_t idx, SBTypeMembe 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 @@ SBType::GetChildAtIndex (bool omit_empty_base_classes, uint32_t idx, SBTypeMembe 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 @@ SBType::GetChildAtIndex (bool omit_empty_base_classes, uint32_t idx, SBTypeMembe 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 @@ SBTypeMember::SBTypeMember () : 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 @@ SBTypeMember::Clear() m_offset = 0; m_bit_size = 0; m_bit_offset = 0; + m_is_base_class = false; } bool @@ -248,6 +254,12 @@ SBTypeMember::GetBitfieldOffset () return m_bit_offset; } +bool +SBTypeMember::IsBaseClass () +{ + return m_is_base_class; +} + size_t SBTypeMember::GetOffset () { diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 516d941867d..178ca530f10 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -250,8 +250,8 @@ CommandObjectExpression::EvaluateExpression 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); } diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index a77a64969a0..5a519f98614 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -318,6 +318,7 @@ public: 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 @@ public: show_location = false; show_decl = false; debug = false; + flat_output = false; max_depth = UINT32_MAX; ptr_depth = 0; globals.clear(); @@ -386,7 +388,8 @@ public: 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 @@ public: m_options.show_types, m_options.show_location, m_options.use_objc, - false); - s.EOL(); + false, + m_options.flat_output); } } } @@ -561,8 +564,8 @@ public: m_options.show_types, m_options.show_location, m_options.use_objc, - false); - s.EOL(); + false, + m_options.flat_output); } } } @@ -731,9 +734,8 @@ public: 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 @@ public: m_options.show_types, m_options.show_location, m_options.use_objc, - false); - - s.EOL(); + false, + m_options.flat_output); } } } @@ -849,6 +850,7 @@ CommandObjectFrameVariable::CommandOptions::g_option_table[] = { 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 diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index bd613ba7b2c..c8c5f3362fe 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -42,8 +42,9 @@ static lldb::user_id_t g_value_obj_uid = 0; //---------------------------------------------------------------------- // 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 @@ ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int3 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 @@ ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int3 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 @@ ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int3 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 @@ ValueObject::SetDynamicValue () 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 @@ ValueObject::DumpValueObject 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 @@ ValueObject::DumpValueObject } 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"); } } } diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index 03986822f51..9a9aebc9d90 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -33,16 +33,17 @@ ValueObjectChild::ValueObjectChild 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; } diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index 103edadddbe..173eb55c39d 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -35,7 +35,7 @@ ValueObjectConstResult::ValueObjectConstResult 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 } ValueObjectConstResult::ValueObjectConstResult (const Error& error) : - ValueObject (), + ValueObject (NULL), m_clang_ast (NULL), m_type_name () { diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index ff3dac8d561..7f3603f032a 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -29,8 +29,8 @@ using namespace lldb_private; #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 @@ ValueObjectRegisterContext::CreateChildAtIndex (uint32_t idx, bool synthetic_arr 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 @@ ValueObjectRegisterContext::CreateChildAtIndex (uint32_t idx, bool synthetic_arr #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 @@ ValueObjectRegisterSet::CreateChildAtIndex (uint32_t idx, bool synthetic_array_m { 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 @@ ValueObjectRegisterSet::CreateChildAtIndex (uint32_t idx, bool synthetic_array_m #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), diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 759b5ce34e3..104aa1f0e21 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -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! diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 6d72ed2488d..b34004d58c3 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -871,6 +871,9 @@ ClangExpressionDeclMap::FindVariableInScope(StackFrame &frame, VariableList *var_list = frame.GetVariableList(true); + if (!var_list) + return NULL; + lldb::VariableSP var = var_list->FindVariable(name_cs); if (!var) diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index ed16d0c5685..7cd4e15b1ed 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1651,6 +1651,61 @@ ClangASTContext::AddMethodToObjCObjectType } +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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex // 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex { 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::GetChildClangTypeAtIndex 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 @@ ClangASTContext::IsFloatingPointType (clang_type_t clang_type, uint32_t &count, 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) { diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 7568e79dfcc..a2c59d20c82 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -49,9 +49,11 @@ lldb_private::Type::Type 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 @@ lldb_private::Type::Type () : m_byte_size (0), m_is_forward_decl (false), m_decl (), - m_clang_qual_type (NULL) + m_clang_type (NULL) { } @@ -86,7 +88,7 @@ lldb_private::Type::operator= (const Type& rhs) 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 @@ lldb_private::Type::GetDescription (Stream *s, lldb::DescriptionLevel level, boo 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 @@ lldb_private::Type::Dump (Stream *s, bool show_context) 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 @@ lldb_private::Type::GetName() { 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::Type::DumpValue } lldb_private::ClangASTType::DumpValue (GetClangAST (), - m_clang_qual_type, + m_clang_type, exe_ctx, s, format == lldb::eFormatDefault ? GetFormat() : format, @@ -300,7 +302,7 @@ lldb_private::Type::GetNumChildren (bool omit_empty_base_classes) { 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 @@ bool 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 @@ lldb_private::Type::GetFormat () // 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 @@ lldb_private::Type::GetEncoding (uint32_t &count) 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 @@ lldb_private::Type::GetDeclaration () const 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 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok) 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 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok) 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 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok) } // 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 @@ lldb_private::Type::GetChildClangTypeAtIndex 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 @@ lldb_private::Type::GetChildClangTypeAtIndex 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 @@ lldb_private::Type::GetChildClangTypeAtIndex 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 @@ lldb_private::Type::GetClangType () { 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 @@ lldb_private::Type::GetClangForwardType () { const bool forward_decl_is_ok = true; ResolveClangType (forward_decl_is_ok); - return m_clang_qual_type; + return m_clang_type; } clang::ASTContext * diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py index d7b1d5be24f..32d999d6698 100644 --- a/lldb/test/array_types/TestArrayTypes.py +++ b/lldb/test/array_types/TestArrayTypes.py @@ -69,18 +69,18 @@ class ArrayTypesTestCase(TestBase): 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])') diff --git a/lldb/test/bitfields/TestBitfields.py b/lldb/test/bitfields/TestBitfields.py index 6d169d3551c..0c7a4fe2b5d 100644 --- a/lldb/test/bitfields/TestBitfields.py +++ b/lldb/test/bitfields/TestBitfields.py @@ -61,25 +61,25 @@ class BitfieldsTestCase(TestBase): # 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): |