diff options
11 files changed, 376 insertions, 44 deletions
diff --git a/lldb/include/lldb/DataFormatters/FormatManager.h b/lldb/include/lldb/DataFormatters/FormatManager.h index 183b18d7987..d4743acc442 100644 --- a/lldb/include/lldb/DataFormatters/FormatManager.h +++ b/lldb/include/lldb/DataFormatters/FormatManager.h @@ -60,8 +60,33 @@ public: EnableCategory (const ConstString& category_name, TypeCategoryMap::Position pos = TypeCategoryMap::Default) { - m_categories_map.Enable(category_name, - pos); + EnableCategory(category_name, + pos, + std::initializer_list<lldb::LanguageType>()); + } + + void + EnableCategory (const ConstString& category_name, + TypeCategoryMap::Position pos, + lldb::LanguageType lang) + { + EnableCategory(category_name, + pos, + {lang}); + } + + void + EnableCategory (const ConstString& category_name, + TypeCategoryMap::Position pos = TypeCategoryMap::Default, + std::initializer_list<lldb::LanguageType> langs = {}) + { + TypeCategoryMap::ValueSP category_sp; + if (m_categories_map.Get(category_name, category_sp) && category_sp) + { + m_categories_map.Enable(category_sp, pos); + for (const lldb::LanguageType lang : langs) + category_sp->AddLanguage(lang); + } } void diff --git a/lldb/include/lldb/DataFormatters/FormattersHelpers.h b/lldb/include/lldb/DataFormatters/FormattersHelpers.h index 291cd074d60..a57397e909a 100644 --- a/lldb/include/lldb/DataFormatters/FormattersHelpers.h +++ b/lldb/include/lldb/DataFormatters/FormattersHelpers.h @@ -32,6 +32,12 @@ namespace lldb_private { bool regex = false); void + AddSummary(TypeCategoryImpl::SharedPointer category_sp, + lldb::TypeSummaryImplSP summary_sp, + ConstString type_name, + bool regex = false); + + void AddStringSummary(TypeCategoryImpl::SharedPointer category_sp, const char* string, ConstString type_name, diff --git a/lldb/include/lldb/DataFormatters/TypeCategory.h b/lldb/include/lldb/DataFormatters/TypeCategory.h index c13d0de7a10..f26312a3c74 100644 --- a/lldb/include/lldb/DataFormatters/TypeCategory.h +++ b/lldb/include/lldb/DataFormatters/TypeCategory.h @@ -99,7 +99,8 @@ namespace lldb_private { typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP; TypeCategoryImpl (IFormatChangeListener* clist, - ConstString name); + ConstString name, + std::initializer_list<lldb::LanguageType> langs = {}); FormatContainerSP GetTypeFormatsContainer () @@ -264,6 +265,21 @@ namespace lldb_private { { return m_name.GetCString(); } + + size_t + GetNumLanguages (); + + lldb::LanguageType + GetLanguageAtIndex (size_t idx); + + void + AddLanguage (lldb::LanguageType lang); + + bool + HasLanguage (lldb::LanguageType lang); + + std::string + GetDescription (); bool AnyMatches (ConstString type_name, @@ -291,6 +307,8 @@ namespace lldb_private { ConstString m_name; + std::vector<lldb::LanguageType> m_languages; + uint32_t m_enabled_position; void @@ -302,6 +320,9 @@ namespace lldb_private { Enable(false, UINT32_MAX); } + bool + IsApplicable (ValueObject& valobj); + uint32_t GetLastEnabledPosition () { diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index f326cc18d48..842c323b62e 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -30,6 +30,8 @@ #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/OptionGroupFormat.h" +#include "lldb/Interpreter/OptionValueBoolean.h" +#include "lldb/Interpreter/OptionValueLanguage.h" #include "lldb/Target/Language.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" @@ -1356,9 +1358,7 @@ private: if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false) return true; - result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n", - cate_name, - (cate->IsEnabled() ? "enabled" : "disabled")); + result->GetOutputStream().Printf("-----------------------\nCategory: %s\n-----------------------\n", cate->GetDescription().c_str()); cate->GetTypeFormatsContainer()->LoopThrough(CommandObjectTypeFormatList_LoopCallback, param_vp); @@ -2398,10 +2398,8 @@ private: if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false) return true; - result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n", - cate_name, - (cate->IsEnabled() ? "enabled" : "disabled")); - + result->GetOutputStream().Printf("-----------------------\nCategory: %s\n-----------------------\n", cate->GetDescription().c_str()); + cate->GetTypeSummariesContainer()->LoopThrough(CommandObjectTypeSummaryList_LoopCallback, param_vp); if (cate->GetRegexTypeSummariesContainer()->GetCount() > 0) @@ -2456,6 +2454,145 @@ CommandObjectTypeSummaryList::CommandOptions::g_option_table[] = }; //------------------------------------------------------------------------- +// CommandObjectTypeCategoryDefine +//------------------------------------------------------------------------- + +class CommandObjectTypeCategoryDefine : public CommandObjectParsed +{ + + class CommandOptions : public Options + { + public: + + CommandOptions (CommandInterpreter &interpreter) : + Options (interpreter), + m_define_enabled(false,false), + m_cate_language(eLanguageTypeUnknown,eLanguageTypeUnknown) + { + } + + virtual + ~CommandOptions (){} + + virtual Error + SetOptionValue (uint32_t option_idx, const char *option_arg) + { + Error error; + const int short_option = m_getopt_table[option_idx].val; + + switch (short_option) + { + case 'e': + m_define_enabled.SetValueFromString("true"); + break; + case 'l': + error = m_cate_language.SetValueFromString(option_arg); + break; + default: + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); + break; + } + + return error; + } + + void + OptionParsingStarting () + { + m_define_enabled.Clear(); + m_cate_language.Clear(); + } + + const OptionDefinition* + GetDefinitions () + { + return g_option_table; + } + + // Options table: Required for subclasses of Options. + + static OptionDefinition g_option_table[]; + + // Instance variables to hold the values for command options. + + OptionValueBoolean m_define_enabled; + OptionValueLanguage m_cate_language; + + + }; + + CommandOptions m_options; + + virtual Options * + GetOptions () + { + return &m_options; + } + +public: + CommandObjectTypeCategoryDefine (CommandInterpreter &interpreter) : + CommandObjectParsed (interpreter, + "type category define", + "Define a new category as a source of formatters.", + NULL), + m_options(interpreter) + { + CommandArgumentEntry type_arg; + CommandArgumentData type_style_arg; + + type_style_arg.arg_type = eArgTypeName; + type_style_arg.arg_repetition = eArgRepeatPlus; + + type_arg.push_back (type_style_arg); + + m_arguments.push_back (type_arg); + + } + + ~CommandObjectTypeCategoryDefine () + { + } + +protected: + bool + DoExecute (Args& command, CommandReturnObject &result) + { + const size_t argc = command.GetArgumentCount(); + + if (argc < 1) + { + result.AppendErrorWithFormat ("%s takes 1 or more args.\n", m_cmd_name.c_str()); + result.SetStatus(eReturnStatusFailed); + return false; + } + + for (size_t i = 0; i < argc; i++) + { + const char* cateName = command.GetArgumentAtIndex(i); + TypeCategoryImplSP category_sp; + if (DataVisualization::Categories::GetCategory(ConstString(cateName), category_sp) && category_sp) + { + category_sp->AddLanguage(m_options.m_cate_language.GetCurrentValue()); + if (m_options.m_define_enabled.GetCurrentValue()) + DataVisualization::Categories::Enable(category_sp, TypeCategoryMap::Default); + } + } + + result.SetStatus(eReturnStatusSuccessFinishResult); + return result.Succeeded(); + } + +}; + +OptionDefinition +CommandObjectTypeCategoryDefine::CommandOptions::g_option_table[] = +{ + { LLDB_OPT_SET_ALL, false, "enabled", 'e', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "If specified, this category will be created enabled."}, + { LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage, "Specify the language that this category is supported for."}, + { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +}; + +//------------------------------------------------------------------------- // CommandObjectTypeCategoryEnable //------------------------------------------------------------------------- @@ -2865,9 +3002,7 @@ private: const char* cate_name = cate->GetName(); if (regex == NULL || strcmp(cate_name, regex->GetText()) == 0 || regex->Execute(cate_name)) - result->GetOutputStream().Printf("Category %s is%s enabled\n", - cate_name, - (cate->IsEnabled() ? "" : " not")); + result->GetOutputStream().Printf("Category: %s\n", cate->GetDescription().c_str()); return true; } public: @@ -3081,9 +3216,7 @@ private: if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false) return true; - result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n", - cate_name, - (cate->IsEnabled() ? "enabled" : "disabled")); + result->GetOutputStream().Printf("-----------------------\nCategory: %s\n-----------------------\n", cate->GetDescription().c_str()); cate->GetTypeFiltersContainer()->LoopThrough(CommandObjectTypeFilterList_LoopCallback, param_vp); @@ -3296,9 +3429,7 @@ private: if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false) return true; - result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n", - cate_name, - (cate->IsEnabled() ? "enabled" : "disabled")); + result->GetOutputStream().Printf("-----------------------\nCategory: %s\n-----------------------\n", cate->GetDescription().c_str()); cate->GetTypeSyntheticsContainer()->LoopThrough(CommandObjectTypeSynthList_LoopCallback, param_vp); @@ -4117,10 +4248,10 @@ CommandObjectTypeSynthAdd::CommandOptions::g_option_table[] = { { LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true, cascade through typedef chains."}, { LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects."}, - { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Don't use this format for references-to-tNULL, ype objects."}, + { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Don't use this format for references-to-type objects."}, { LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeName, "Add this to the given category instead of the default one."}, { LLDB_OPT_SET_2, false, "python-class", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonClass, "Use this Python class to produce synthetic children."}, - { LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument,NULL, NULL, 0, eArgTypeNone, "Type Python code to generate a class that NULL, provides synthetic children."}, + { LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Type Python code to generate a class that provides synthetic children."}, { LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Type names are actually regular expressions."}, { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } }; @@ -4591,6 +4722,7 @@ public: "A set of commands for operating on categories", "type category [<sub-command-options>] ") { + LoadSubCommand ("define", CommandObjectSP (new CommandObjectTypeCategoryDefine (interpreter))); LoadSubCommand ("enable", CommandObjectSP (new CommandObjectTypeCategoryEnable (interpreter))); LoadSubCommand ("disable", CommandObjectSP (new CommandObjectTypeCategoryDisable (interpreter))); LoadSubCommand ("delete", CommandObjectSP (new CommandObjectTypeCategoryDelete (interpreter))); diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp index 16e600201d2..fdf86832ed6 100644 --- a/lldb/source/DataFormatters/DataVisualization.cpp +++ b/lldb/source/DataFormatters/DataVisualization.cpp @@ -164,7 +164,7 @@ DataVisualization::Categories::Enable (const ConstString& category, { if (GetFormatManager().GetCategory(category)->IsEnabled()) GetFormatManager().DisableCategory(category); - GetFormatManager().EnableCategory(category, pos); + GetFormatManager().EnableCategory(category, pos, std::initializer_list<lldb::LanguageType>()); } void diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index 8fcb8217c39..c6dd146c2b7 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -1036,8 +1036,8 @@ FormatManager::FormatManager() : LoadSystemFormatters(); LoadVectorFormatters(); - EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last); - EnableCategory(m_system_category_name,TypeCategoryMap::Last); + EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus); + EnableCategory(m_system_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus); } void diff --git a/lldb/source/DataFormatters/FormattersHelpers.cpp b/lldb/source/DataFormatters/FormattersHelpers.cpp index ba5f6c04f78..c2fcb98ec88 100644 --- a/lldb/source/DataFormatters/FormattersHelpers.cpp +++ b/lldb/source/DataFormatters/FormattersHelpers.cpp @@ -40,6 +40,17 @@ lldb_private::formatters::AddFormat (TypeCategoryImpl::SharedPointer category_sp category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp); } +void +lldb_private::formatters::AddSummary(TypeCategoryImpl::SharedPointer category_sp, + TypeSummaryImplSP summary_sp, + ConstString type_name, + bool regex) +{ + if (regex) + category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp); + else + category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp); +} void lldb_private::formatters::AddStringSummary(TypeCategoryImpl::SharedPointer category_sp, diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp index b05cea55ff5..636d935b762 100644 --- a/lldb/source/DataFormatters/TypeCategory.cpp +++ b/lldb/source/DataFormatters/TypeCategory.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/DataFormatters/TypeCategory.h" +#include "lldb/Target/Language.h" // C Includes // C++ Includes @@ -18,7 +19,8 @@ using namespace lldb; using namespace lldb_private; TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist, - ConstString name) : + ConstString name, + std::initializer_list<lldb::LanguageType> langs) : m_format_cont("format","regex-format",clist), m_summary_cont("summary","regex-summary",clist), m_filter_cont("filter","regex-filter",clist), @@ -29,8 +31,118 @@ m_validator_cont("validator","regex-validator",clist), m_enabled(false), m_change_listener(clist), m_mutex(Mutex::eMutexTypeRecursive), -m_name(name) -{} +m_name(name), +m_languages() +{ + for (const lldb::LanguageType lang : langs) + AddLanguage(lang); +} + +static bool +IsApplicable(lldb::LanguageType category_lang, + lldb::LanguageType valobj_lang) +{ + switch (category_lang) + { + // these are not languages that LLDB would ordinarily deal with + // only allow an exact equality here, since we really don't know + // any better + case eLanguageTypeAda83: + case eLanguageTypeCobol74: + case eLanguageTypeCobol85: + case eLanguageTypeFortran77: + case eLanguageTypeFortran90: + case eLanguageTypePascal83: + case eLanguageTypeModula2: + case eLanguageTypeJava: + case eLanguageTypeAda95: + case eLanguageTypeFortran95: + case eLanguageTypePLI: + case eLanguageTypeUPC: + case eLanguageTypeD: + case eLanguageTypePython: + return category_lang == valobj_lang; + + // the C family, we consider it as one + case eLanguageTypeC89: + case eLanguageTypeC: + case eLanguageTypeC99: + return valobj_lang == eLanguageTypeC89 || + valobj_lang == eLanguageTypeC || + valobj_lang == eLanguageTypeC99; + + // ObjC knows about C and itself + case eLanguageTypeObjC: + return valobj_lang == eLanguageTypeC89 || + valobj_lang == eLanguageTypeC || + valobj_lang == eLanguageTypeC99 || + valobj_lang == eLanguageTypeObjC; + + // C++ knows about C and C++ + case eLanguageTypeC_plus_plus: + return valobj_lang == eLanguageTypeC89 || + valobj_lang == eLanguageTypeC || + valobj_lang == eLanguageTypeC99 || + valobj_lang == eLanguageTypeC_plus_plus; + + // ObjC++ knows about C,C++,ObjC and ObjC++ + case eLanguageTypeObjC_plus_plus: + return valobj_lang == eLanguageTypeC89 || + valobj_lang == eLanguageTypeC || + valobj_lang == eLanguageTypeC99 || + valobj_lang == eLanguageTypeC_plus_plus || + valobj_lang == eLanguageTypeObjC; + + default: + case eLanguageTypeUnknown: + return true; + } +} + +bool +TypeCategoryImpl::IsApplicable (ValueObject& valobj) +{ + lldb::LanguageType valobj_lang = valobj.GetObjectRuntimeLanguage(); + for (size_t idx = 0; + idx < GetNumLanguages(); + idx++) + { + const lldb::LanguageType category_lang = GetLanguageAtIndex(idx); + if (::IsApplicable(category_lang,valobj_lang)) + return true; + } + return false; +} + +size_t +TypeCategoryImpl::GetNumLanguages () +{ + if (m_languages.empty()) + return 1; + return m_languages.size(); +} + +lldb::LanguageType +TypeCategoryImpl::GetLanguageAtIndex (size_t idx) +{ + if (m_languages.empty()) + return lldb::eLanguageTypeUnknown; + return m_languages[idx]; +} + +void +TypeCategoryImpl::AddLanguage (lldb::LanguageType lang) +{ + m_languages.push_back(lang); +} + +bool +TypeCategoryImpl::HasLanguage (lldb::LanguageType lang) +{ + const auto iter = std::find(m_languages.begin(), m_languages.end(), lang), + end = m_languages.end(); + return (iter != end); +} bool TypeCategoryImpl::Get (ValueObject& valobj, @@ -38,7 +150,7 @@ TypeCategoryImpl::Get (ValueObject& valobj, lldb::TypeFormatImplSP& entry, uint32_t* reason) { - if (!IsEnabled()) + if (!IsEnabled() || !IsApplicable(valobj)) return false; if (GetTypeFormatsContainer()->Get(candidates, entry, reason)) return true; @@ -54,7 +166,7 @@ TypeCategoryImpl::Get (ValueObject& valobj, lldb::TypeSummaryImplSP& entry, uint32_t* reason) { - if (!IsEnabled()) + if (!IsEnabled() || !IsApplicable(valobj)) return false; if (GetTypeSummariesContainer()->Get(candidates, entry, reason)) return true; @@ -70,7 +182,7 @@ TypeCategoryImpl::Get (ValueObject& valobj, lldb::SyntheticChildrenSP& entry, uint32_t* reason) { - if (!IsEnabled()) + if (!IsEnabled() || !IsApplicable(valobj)) return false; TypeFilterImpl::SharedPointer filter_sp; uint32_t reason_filter = 0; @@ -567,3 +679,30 @@ TypeCategoryImpl::Enable (bool value, uint32_t position) if (m_change_listener) m_change_listener->Changed(); } + +std::string +TypeCategoryImpl::GetDescription () +{ + StreamString stream; + stream.Printf("%s (%s", + GetName(), + (IsEnabled() ? "enabled" : "disabled")); + StreamString lang_stream; + lang_stream.Printf(", applicable for language(s): "); + bool print_lang = false; + for (size_t idx = 0; + idx < GetNumLanguages(); + idx++) + { + const lldb::LanguageType lang = GetLanguageAtIndex(idx); + if (lang != lldb::eLanguageTypeUnknown) + print_lang = true; + lang_stream.Printf("%s%s", + Language::GetNameForLanguageType(lang), + idx+1<GetNumLanguages() ? ", " : ""); + } + if (print_lang) + stream.Printf("%s",lang_stream.GetData()); + stream.PutChar(')'); + return stream.GetData(); +} diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp index fbfeeab9269..1ebfbd528b9 100644 --- a/lldb/source/DataFormatters/TypeCategoryMap.cpp +++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp @@ -247,7 +247,7 @@ TypeCategoryMap::GetFormat (ValueObject& valobj, lldb::TypeCategoryImplSP category_sp = *begin; lldb::TypeFormatImplSP current_format; if (log) - log->Printf("\n[TypeCategoryMap::GetFormat] Trying to use category %s", category_sp->GetName()); + log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s", category_sp->GetName()); if (!category_sp->Get(valobj, matches, current_format, &reason_why)) continue; return current_format; @@ -287,7 +287,7 @@ TypeCategoryMap::GetSummaryFormat (ValueObject& valobj, lldb::TypeCategoryImplSP category_sp = *begin; lldb::TypeSummaryImplSP current_format; if (log) - log->Printf("\n[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName()); + log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName()); if (!category_sp->Get(valobj, matches, current_format, &reason_why)) continue; return current_format; @@ -329,7 +329,7 @@ TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj, lldb::TypeCategoryImplSP category_sp = *begin; lldb::SyntheticChildrenSP current_format; if (log) - log->Printf("\n[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName()); + log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName()); if (!category_sp->Get(valobj, matches, current_format, &reason_why)) continue; return current_format; @@ -356,7 +356,7 @@ TypeCategoryMap::GetValidator (ValueObject& valobj, { for (auto match : matches) { - log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32, + log->Printf("[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = %" PRIu32, match.GetTypeName().GetCString(), match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers", match.DidStripReference() ? "strip-reference" : "no-strip-reference", @@ -370,7 +370,7 @@ TypeCategoryMap::GetValidator (ValueObject& valobj, lldb::TypeCategoryImplSP category_sp = *begin; lldb::TypeValidatorImplSP current_format; if (log) - log->Printf("\n[CategoryMap::GetValidator] Trying to use category %s", category_sp->GetName()); + log->Printf("[CategoryMap::GetValidator] Trying to use category %s", category_sp->GetName()); if (!category_sp->Get(valobj, matches, current_format, &reason_why)) continue; return current_format; diff --git a/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py b/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py index 76de9a7245e..299e3222d4a 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py @@ -159,8 +159,6 @@ class CategoriesDataFormatterTestCase(TestBase): self.runCmd("type summary add Rectangle -w Category1 --summary-string \"Category1\"") self.runCmd("type summary add Rectangle -w Category2 --summary-string \"Category2\"") - self.runCmd("type category list") - self.runCmd("type category enable Category2") self.runCmd("type category enable Category1") @@ -302,7 +300,7 @@ class CategoriesDataFormatterTestCase(TestBase): # check that list commands work self.expect("type category list", - substrs = ['RectangleStarCategory is enabled']) + substrs = ['RectangleStarCategory (enabled)']) self.expect("type summary list", substrs = ['ARectangleStar']) @@ -312,7 +310,7 @@ class CategoriesDataFormatterTestCase(TestBase): # check that list commands work self.expect("type category list", - substrs = ['CircleCategory is not enabled']) + substrs = ['CircleCategory (disabled']) self.expect("frame variable c1 r_ptr", substrs = ['AShape', diff --git a/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py b/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py index e12dfad32b5..25cea2a0b01 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py @@ -55,7 +55,7 @@ class DataFormatterDisablingTestCase(TestBase): #self.runCmd('type category enable system VectorTypes libcxx gnu-libstdc++ CoreGraphics CoreServices AppKit CoreFoundation objc default', check=False) - self.expect('type category list', substrs = ['system is enabled',]) + self.expect('type category list', substrs = ['system','enabled',]) self.expect("frame variable numbers", substrs = ['[0] = 1', '[3] = 1234']) @@ -70,23 +70,23 @@ class DataFormatterDisablingTestCase(TestBase): self.expect('frame variable string1', matching=False, substrs = ['hello world']) - self.expect('type category list', substrs = ['system is not enabled',]) + self.expect('type category list', substrs = ['system','disabled',]) # now enable and check that we are back to normal self.runCmd("type category enable *") - self.expect('type category list', substrs = ['system is enabled']) + self.expect('type category list', substrs = ['system','enabled']) self.expect("frame variable numbers", substrs = ['[0] = 1', '[3] = 1234']) self.expect('frame variable string1', substrs = ['hello world']) - self.expect('type category list', substrs = ['system is enabled']) + self.expect('type category list', substrs = ['system','enabled']) # last check - our cleanup will re-enable everything self.runCmd('type category disable *') - self.expect('type category list', substrs = ['system is not enabled']) + self.expect('type category list', substrs = ['system','disabled']) if __name__ == '__main__': |