<rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
SBTypeCategory
SBTypeFilter
SBTypeFormat
SBTypeSummary
SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150558 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/ScriptInterpreterPython.cpp b/source/Interpreter/ScriptInterpreterPython.cpp
index d2d355c..71b7162 100644
--- a/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/source/Interpreter/ScriptInterpreterPython.cpp
@@ -1140,7 +1140,7 @@
// this implementation is identical to GenerateBreakpointCommandCallbackData (apart from the name
// given to generated functions, of course)
bool
-ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output)
+ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_functions = 0;
user_input.RemoveBlankLines ();
@@ -1154,7 +1154,10 @@
// Take what the user wrote, wrap it all up inside one big auto-generated Python function, passing in the
// ValueObject as parameter to the function.
- sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
+ if (!name_token)
+ sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
+ else
+ sstr.Printf ("lldb_gen_python_type_print_func_%p", name_token);
++num_created_functions;
std::string auto_generated_function_name = sstr.GetData();
@@ -1267,7 +1270,7 @@
bool
-ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output)
+ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_classes = 0;
user_input.RemoveBlankLines ();
@@ -1280,7 +1283,10 @@
// Wrap all user input into a Python class
- sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
+ if (!name_token)
+ sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
+ else
+ sstr.Printf ("lldb_gen_python_type_synth_class_%p", name_token);
++num_created_classes;
std::string auto_generated_class_name = sstr.GetData();
@@ -1349,13 +1355,23 @@
}
bool
-ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output)
+ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output, void* name_token)
{
- StringList input(oneliner);
- return GenerateTypeScriptFunction(input, output);
+ StringList input;
+ input.SplitIntoLines(oneliner, strlen(oneliner));
+ return GenerateTypeScriptFunction(input, output, name_token);
}
bool
+ScriptInterpreterPython::GenerateTypeSynthClass (const char* oneliner, StringList &output, void* name_token)
+{
+ StringList input;
+ input.SplitIntoLines(oneliner, strlen(oneliner));
+ return GenerateTypeSynthClass(input, output, name_token);
+}
+
+
+bool
ScriptInterpreterPython::GenerateBreakpointCommandCallbackData (StringList &user_input, StringList &callback_data)
{
static int num_created_functions = 0;
@@ -1775,12 +1791,12 @@
return false;
}
- // call __lldb_module_init(debugger,dict)
+ // call __lldb_init_module(debugger,dict)
if (!g_swig_call_module_init (basename,
m_dictionary_name.c_str(),
debugger_sp))
{
- error.SetErrorString("calling __lldb_module_init failed");
+ error.SetErrorString("calling __lldb_init_module failed");
return false;
}
return true;