diff options
-rw-r--r-- | lldb/examples/summaries/objc.py | 9 | ||||
-rw-r--r-- | lldb/include/lldb/Core/FormatManager.h | 1 | ||||
-rwxr-xr-x | lldb/scripts/Python/finish-swig-Python-LLDB.sh | 15 | ||||
-rw-r--r-- | lldb/source/Core/FormatManager.cpp | 18 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 4 |
5 files changed, 45 insertions, 2 deletions
diff --git a/lldb/examples/summaries/objc.py b/lldb/examples/summaries/objc.py new file mode 100644 index 00000000000..33dc7d14bb8 --- /dev/null +++ b/lldb/examples/summaries/objc.py @@ -0,0 +1,9 @@ +# Summaries for common ObjC types that require Python scripting +# to be generated fit into this file + +def BOOL_SummaryProvider (valobj,dict): + if valobj.GetValueAsUnsigned() == 0: + return "NO" + else: + return "YES" + diff --git a/lldb/include/lldb/Core/FormatManager.h b/lldb/include/lldb/Core/FormatManager.h index 4b1098b54fd..b6be9643b00 100644 --- a/lldb/include/lldb/Core/FormatManager.h +++ b/lldb/include/lldb/Core/FormatManager.h @@ -508,6 +508,7 @@ private: ConstString m_default_category_name; ConstString m_system_category_name; ConstString m_gnu_cpp_category_name; + ConstString m_objc_category_name; CategoryMap& GetCategories () diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh index f8b3a004f29..690dbd0fb5d 100755 --- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh +++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh @@ -184,6 +184,21 @@ else fi fi +# Copy the ObjC formatters over to the framework Python directory +if [ -f "${SRC_ROOT}/examples/synthetic/objc.py" ] +then + if [ $Debug == 1 ] + then + echo "Copying objc.py to ${framework_python_dir}" + fi + cp "${SRC_ROOT}/examples/summaries/objc.py" "${framework_python_dir}" +else + if [ $Debug == 1 ] + then + echo "Unable to find ${SRC_ROOT}/examples/summaries/objc.py" + fi +fi + fi exit 0 diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp index b1cc6e8a1f2..90762965d10 100644 --- a/lldb/source/Core/FormatManager.cpp +++ b/lldb/source/Core/FormatManager.cpp @@ -560,7 +560,8 @@ FormatManager::FormatManager() : 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 @@ FormatManager::FormatManager() : 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 @@ FormatManager::FormatManager() : 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/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 58cb329a95c..26d058c9574 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -247,6 +247,10 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete 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); |