diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-08-03 02:18:51 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-08-03 02:18:51 +0000 |
commit | 9910bc855d55b4958182321cfc81140346aa2e9f (patch) | |
tree | b1580154477ba572aee2e9b1ed49954c408c9ffb /lldb/source/Core | |
parent | 59546b8f79bd020362c4478628111c0beb0b1dc0 (diff) | |
download | bcm5719-llvm-9910bc855d55b4958182321cfc81140346aa2e9f.tar.gz bcm5719-llvm-9910bc855d55b4958182321cfc81140346aa2e9f.zip |
Fixed an issue where the KVO swizzled type would be returned as the dynamic type instead of the actual user-level type
- see the test case in lang/objc/objc-dynamic-value for an example
Objective-C dynamic type lookup now works for every Objective-C type
- previously, true dynamic lookup was only performed for type id
llvm-svn: 136763
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index b742d0b0da1..c9310753d96 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -93,7 +93,7 @@ ValueObject::ValueObject (ValueObject &parent) : m_is_bitfield_for_scalar(false), m_is_expression_path_child(false), m_is_child_at_offset(false), - m_is_expression_result(false), + m_is_expression_result(parent.m_is_expression_result), m_dump_printable_counter(0) { m_manager->ManageObject(this); @@ -240,7 +240,7 @@ ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic) m_synthetic_value = NULL; - Debugger::Formatting::ValueFormats::Get(*this, use_dynamic, m_last_value_format); + Debugger::Formatting::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format); Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format); Debugger::Formatting::GetSyntheticFilter(*this, use_dynamic, m_last_synthetic_filter); @@ -2599,23 +2599,26 @@ ValueObject::DumpValueObject // Always show the type for the top level items. if (show_types || (curr_depth == 0 && !flat_output)) { - s.Printf("(%s", valobj->GetTypeName().AsCString("<invalid type>")); - if (use_dynamic != lldb::eNoDynamicValues && - strcmp(valobj->GetTypeName().AsCString("NULL"), "id") == 0) + const char* typeName = valobj->GetTypeName().AsCString("<invalid type>"); + s.Printf("(%s", typeName); + // only show dynamic types if the user really wants to see types + if (show_types && use_dynamic != lldb::eNoDynamicValues && + (/*strstr(typeName, "id") == typeName ||*/ + ClangASTType::GetMinimumLanguage(valobj->GetClangAST(), valobj->GetClangType()) == lldb::eLanguageTypeObjC)) { Process* process = valobj->GetUpdatePoint().GetProcessSP().get(); if (process == NULL) - s.Printf(") "); + s.Printf(", dynamic type: unknown) "); else { ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime(); if (runtime == NULL) - s.Printf(") "); + s.Printf(", dynamic type: unknown) "); else { ObjCLanguageRuntime::ObjCISA isa = runtime->GetISA(*valobj); if (!runtime->IsValidISA(isa)) - s.Printf(") "); + s.Printf(", dynamic type: unknown) "); else s.Printf(", dynamic type: %s) ", runtime->GetActualTypeName(isa).GetCString()); diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index f48bebd7d7e..3dd360d9876 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -160,7 +160,7 @@ ValueObjectDynamicValue::UpdateValue () { LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC); if (objc_runtime) - found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); + found_dynamic_type = objc_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); } } |