diff options
-rw-r--r-- | lldb/include/lldb/Core/ValueObject.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/Core/ValueObjectDynamicValue.h | 6 | ||||
-rw-r--r-- | lldb/include/lldb/Core/ValueObjectSyntheticFilter.h | 6 | ||||
-rw-r--r-- | lldb/include/lldb/DataFormatters/ValueObjectPrinter.h | 8 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectConstResult.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 21 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 22 | ||||
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 5 | ||||
-rw-r--r-- | lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py | 2 |
12 files changed, 82 insertions, 5 deletions
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 9ba837a3ac5..0f97a5c9351 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -1242,6 +1242,9 @@ protected: bool IsChecksumEmpty (); + void + SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType); + private: //------------------------------------------------------------------ // For ValueObject only diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h index f5cb4d98428..5a6d0023b53 100644 --- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h +++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h @@ -105,6 +105,12 @@ public: virtual TypeImpl GetTypeImpl (); + virtual lldb::LanguageType + GetPreferredDisplayLanguage (); + + void + SetPreferredDisplayLanguage (lldb::LanguageType); + virtual bool GetDeclaration (Declaration &decl); diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index 5eb7e2b5195..ae5327abe52 100644 --- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -152,6 +152,12 @@ public: virtual void SetFormat (lldb::Format format); + virtual lldb::LanguageType + GetPreferredDisplayLanguage (); + + void + SetPreferredDisplayLanguage (lldb::LanguageType); + virtual bool GetDeclaration (Declaration &decl); diff --git a/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h b/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h index ee22c8815c1..85b53dab6f3 100644 --- a/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -61,6 +61,7 @@ struct DumpValueObjectOptions lldb::Format m_format = lldb::eFormatDefault; lldb::TypeSummaryImplSP m_summary_sp; std::string m_root_valobj_name; + lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown; PointerDepth m_max_ptr_depth; bool m_use_synthetic : 1; bool m_scope_already_checked : 1; @@ -253,6 +254,13 @@ struct DumpValueObjectOptions } DumpValueObjectOptions& + SetVariableFormatDisplayLanguage (lldb::LanguageType lang = lldb::eLanguageTypeUnknown) + { + m_varformat_language = lang; + return *this; + } + + DumpValueObjectOptions& SetRunValidator (bool run = true) { m_run_validator = run; diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 96dd90e7ecc..980d11cb1cf 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -335,6 +335,7 @@ CommandObjectExpression::EvaluateExpression result_valobj_sp->SetFormat (format); DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format)); + options.SetVariableFormatDisplayLanguage(result_valobj_sp->GetPreferredDisplayLanguage()); result_valobj_sp->Dump(*output_stream,options); diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index f6382433e4c..5f5585aa6d3 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -500,6 +500,7 @@ protected: } options.SetFormat(format); + options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage()); Stream &output_stream = result.GetOutputStream(); options.SetRootValueObjectName(valobj_sp->GetParent() ? name_cstr : NULL); @@ -586,6 +587,7 @@ protected: } options.SetFormat(format); + options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage()); options.SetRootValueObjectName(name_cstr); valobj_sp->Dump(result.GetOutputStream(),options); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a784f49b7ff..708526d4469 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -4259,6 +4259,13 @@ ValueObject::SetPreferredDisplayLanguage (lldb::LanguageType lt) m_preferred_display_language = lt; } +void +ValueObject::SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType lt) +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + SetPreferredDisplayLanguage(lt); +} + bool ValueObject::CanProvideValue () { diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index 11925256708..6154829b240 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -374,5 +374,7 @@ ValueObjectConstResult::Cast (const CompilerType &compiler_type) lldb::LanguageType ValueObjectConstResult::GetPreferredDisplayLanguage () { - return lldb::eLanguageTypeUnknown; + if (m_preferred_display_language != lldb::eLanguageTypeUnknown) + return m_preferred_display_language; + return GetCompilerTypeImpl().GetMinimumLanguage(); } diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index e801bd71434..329d3c149e8 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -391,6 +391,27 @@ ValueObjectDynamicValue::SetData (DataExtractor &data, Error &error) return ret_val; } +void +ValueObjectDynamicValue::SetPreferredDisplayLanguage (lldb::LanguageType lang) +{ + this->ValueObject::SetPreferredDisplayLanguage(lang); + if (m_parent) + m_parent->SetPreferredDisplayLanguage(lang); +} + +lldb::LanguageType +ValueObjectDynamicValue::GetPreferredDisplayLanguage () +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + { + if (m_parent) + return m_parent->GetPreferredDisplayLanguage(); + return lldb::eLanguageTypeUnknown; + } + else + return m_preferred_display_language; +} + bool ValueObjectDynamicValue::GetDeclaration (Declaration &decl) { diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index 899c064e2f0..e82862af1df 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -223,6 +223,7 @@ ValueObjectSynthetic::GetChildAtIndex (size_t idx, bool can_create) if (!synth_guy) return synth_guy; m_children_byindex.SetValueForKey(idx, synth_guy.get()); + synth_guy->SetPreferredDisplayLanguageIfNeeded(GetPreferredDisplayLanguage()); return synth_guy; } else @@ -315,6 +316,27 @@ ValueObjectSynthetic::SetFormat (lldb::Format format) this->ClearUserVisibleData(eClearUserVisibleDataItemsAll); } +void +ValueObjectSynthetic::SetPreferredDisplayLanguage (lldb::LanguageType lang) +{ + this->ValueObject::SetPreferredDisplayLanguage(lang); + if (m_parent) + m_parent->SetPreferredDisplayLanguage(lang); +} + +lldb::LanguageType +ValueObjectSynthetic::GetPreferredDisplayLanguage () +{ + if (m_preferred_display_language == lldb::eLanguageTypeUnknown) + { + if (m_parent) + return m_parent->GetPreferredDisplayLanguage(); + return lldb::eLanguageTypeUnknown; + } + else + return m_preferred_display_language; +} + bool ValueObjectSynthetic::GetDeclaration (Declaration &decl) { diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 2d122dba4cd..63fb6cc46d3 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -26,6 +26,7 @@ DumpValueObjectOptions() { m_use_dynamic = valobj.GetDynamicValueType(); m_use_synthetic = valobj.IsSynthetic(); + m_varformat_language = valobj.GetPreferredDisplayLanguage(); } ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj, @@ -354,10 +355,10 @@ ValueObjectPrinter::GetValueSummaryError (std::string& value, { TypeSummaryImpl* entry = GetSummaryFormatter(); if (entry) - m_valobj->GetSummaryAsCString(entry, summary); + m_valobj->GetSummaryAsCString(entry, summary, options.m_varformat_language); else { - const char* sum_cstr = m_valobj->GetSummaryAsCString(); + const char* sum_cstr = m_valobj->GetSummaryAsCString(options.m_varformat_language); if (sum_cstr) summary.assign(sum_cstr); } diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py index 3aae3e5a201..885df116ad3 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py @@ -387,7 +387,6 @@ class ObjCDataFormatterTestCase(TestBase): self.addTearDownHook(cleanup) # check formatters for common Objective-C types - self.runCmd("log timers enable") expect_strings = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds', '(CFRange) cf_range = location=4 length=4', '(NSPoint) ns_point = (x = 4, y = 4)', @@ -414,7 +413,6 @@ class ObjCDataFormatterTestCase(TestBase): self.expect("frame variable", substrs = expect_strings) - self.runCmd('log timers dump') def kvo_data_formatter_commands(self): |