This commit provides a new default summary for Objective-C boolean variables, which shows YES or NO instead of the character value. A new category named objc is added to contain this summary provider. Any future Objective-C related formatters would probably fit here
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149388 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Core/FormatManager.cpp b/source/Core/FormatManager.cpp
index b1cc6e8..9076296 100644
--- a/source/Core/FormatManager.cpp
+++ b/source/Core/FormatManager.cpp
@@ -560,7 +560,8 @@
m_categories_map(this),
m_default_category_name(ConstString("default")),
m_system_category_name(ConstString("system")),
- m_gnu_cpp_category_name(ConstString("gnu-libstdc++"))
+ m_gnu_cpp_category_name(ConstString("gnu-libstdc++")),
+ m_objc_category_name(ConstString("objc"))
{
// add some default stuff
@@ -584,7 +585,6 @@
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
-
FormatCategory::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
@@ -633,9 +633,23 @@
false,
false,
"gnu_libstdcpp.StdListSynthProvider")));
+
+ lldb::SummaryFormatSP ObjC_BOOL_summary(new ScriptSummaryFormat(false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ "objc.BOOL_SummaryProvider",
+ ""));
+ FormatCategory::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
+ objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
+ ObjC_BOOL_summary);
#endif
+
// DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
EnableCategory(m_system_category_name);
+ EnableCategory(m_objc_category_name);
EnableCategory(m_gnu_cpp_category_name);
EnableCategory(m_default_category_name);
diff --git a/source/Interpreter/ScriptInterpreterPython.cpp b/source/Interpreter/ScriptInterpreterPython.cpp
index 58cb329..26d058c 100644
--- a/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/source/Interpreter/ScriptInterpreterPython.cpp
@@ -247,6 +247,10 @@
run_string.Printf ("run_one_line (%s, 'import gnu_libstdcpp')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+ run_string.Printf ("run_one_line (%s, 'import objc')", m_dictionary_name.c_str());
+ PyRun_SimpleString (run_string.GetData());
+
if (m_dbg_stdout != NULL)
{
m_new_sysout = PyFile_FromFile (m_dbg_stdout, (char *) "", (char *) "w", _check_and_flush);