[Lldb-commits] [lldb] r161467 - in /lldb/trunk: source/Commands/CommandObjectBreakpointCommand.cpp source/Commands/CommandObjectCommands.cpp source/Commands/CommandObjectType.cpp source/Core/FormatManager.cpp source/Interpreter/ScriptInterpreterPython.cpp test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py www/python-reference.html www/varformats.html
Enrico Granata
egranata at apple.com
Tue Aug 7 19:06:30 PDT 2012
Author: enrico
Date: Tue Aug 7 21:06:30 2012
New Revision: 161467
URL: http://llvm.org/viewvc/llvm-project?rev=161467&view=rev
Log:
<rdar://problem/11975483> Removing user-visible references to 'dict' as a parameter name for Python summary-generating functions since it is a Python keyword.
Modified:
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Core/FormatManager.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
lldb/trunk/www/python-reference.html
lldb/trunk/www/varformats.html
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Aug 7 21:06:30 2012
@@ -558,7 +558,7 @@
else if (m_options.m_function_name.size())
{
std::string oneliner(m_options.m_function_name);
- oneliner += "(frame, bp_loc, dict)";
+ oneliner += "(frame, bp_loc, internal_dict)";
m_interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
oneliner.c_str());
}
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Aug 7 21:06:30 2012
@@ -330,7 +330,7 @@
static const char *g_python_command_instructions = "Enter your Python command(s). Type 'DONE' to end.\n"
"You must define a Python function with this signature:\n"
- "def my_command_impl(debugger, args, result, dict):";
+ "def my_command_impl(debugger, args, result, internal_dict):";
class CommandObjectCommandsAlias : public CommandObjectRaw
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Tue Aug 7 21:06:30 2012
@@ -742,7 +742,7 @@
//-------------------------------------------------------------------------
static const char *g_summary_addreader_instructions = "Enter your Python command(s). Type 'DONE' to end.\n"
- "def function (valobj,dict):";
+ "def function (valobj,internal_dict):";
class TypeScriptAddInputReader : public InputReaderEZ
{
@@ -1050,7 +1050,7 @@
return false;
}
- std::string code = (" " + m_options.m_python_function + "(valobj,dict)");
+ std::string code = (" " + m_options.m_python_function + "(valobj,internal_dict)");
script_format.reset(new ScriptSummaryFormat(m_options.m_flags,
funct_name,
Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Tue Aug 7 21:06:30 2012
@@ -772,7 +772,7 @@
.SetHideItemNames(false);
#ifndef LLDB_DISABLE_PYTHON
- std::string code(" lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,dict)");
+ std::string code(" lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)");
lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str()));
TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name);
@@ -868,7 +868,7 @@
{
std::string code(" ");
- code.append(funct_name).append("(valobj,dict)");
+ code.append(funct_name).append("(valobj,internal_dict)");
lldb::TypeSummaryImplSP summary_sp(new ScriptSummaryFormat(flags,
funct_name,
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Aug 7 21:06:30 2012
@@ -1466,9 +1466,9 @@
StringList auto_generated_function;
auto_generated_function.AppendString (signature);
auto_generated_function.AppendString (" global_dict = globals()"); // Grab the global dictionary
- auto_generated_function.AppendString (" new_keys = dict.keys()"); // Make a list of keys in the session dict
+ auto_generated_function.AppendString (" new_keys = internal_dict.keys()"); // Make a list of keys in the session dict
auto_generated_function.AppendString (" old_keys = global_dict.keys()"); // Save list of keys in global dict
- auto_generated_function.AppendString (" global_dict.update (dict)"); // Add the session dictionary to the
+ auto_generated_function.AppendString (" global_dict.update (internal_dict)"); // Add the session dictionary to the
// global dictionary.
// Wrap everything up inside the function, increasing the indentation.
@@ -1480,7 +1480,7 @@
auto_generated_function.AppendString (sstr.GetData());
}
auto_generated_function.AppendString (" for key in new_keys:"); // Iterate over all the keys from session dict
- auto_generated_function.AppendString (" dict[key] = global_dict[key]"); // Update session dict values
+ auto_generated_function.AppendString (" internal_dict[key] = global_dict[key]"); // Update session dict values
auto_generated_function.AppendString (" if key not in old_keys:"); // If key was not originally in global dict
auto_generated_function.AppendString (" del global_dict[key]"); // ...then remove key/value from global dict
@@ -1508,7 +1508,7 @@
// ValueObject as parameter to the function.
std::string auto_generated_function_name(GenerateUniqueName("lldb_autogen_python_type_print_func", num_created_functions, name_token));
- sstr.Printf ("def %s (valobj, dict):", auto_generated_function_name.c_str());
+ sstr.Printf ("def %s (valobj, internal_dict):", auto_generated_function_name.c_str());
if (!GenerateFunction(sstr.GetData(), user_input))
return false;
@@ -1531,7 +1531,7 @@
std::string auto_generated_function_name(GenerateUniqueName("lldb_autogen_python_cmd_alias_func", num_created_functions));
- sstr.Printf ("def %s (debugger, args, result, dict):", auto_generated_function_name.c_str());
+ sstr.Printf ("def %s (debugger, args, result, internal_dict):", auto_generated_function_name.c_str());
if (!GenerateFunction(sstr.GetData(),user_input))
return false;
@@ -1651,7 +1651,7 @@
return false;
std::string auto_generated_function_name(GenerateUniqueName("lldb_autogen_python_bp_callback_func_",num_created_functions));
- sstr.Printf ("def %s (frame, bp_loc, dict):", auto_generated_function_name.c_str());
+ sstr.Printf ("def %s (frame, bp_loc, internal_dict):", auto_generated_function_name.c_str());
if (!GenerateFunction(sstr.GetData(), user_input))
return false;
Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Tue Aug 7 21:06:30 2012
@@ -86,7 +86,7 @@
"here.close()"])
self.expect("breakpoint command list 3", "Breakpoint 3 command ok",
substrs = ["Breakpoint commands:",
- "bktptcmd.function(frame, bp_loc, dict)"])
+ "bktptcmd.function(frame, bp_loc, internal_dict)"])
self.runCmd("command script import --allow-reload ./bktptcmd.py")
Modified: lldb/trunk/www/python-reference.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/www/python-reference.html (original)
+++ lldb/trunk/www/python-reference.html Tue Aug 7 21:06:30 2012
@@ -300,12 +300,12 @@
debugging requirements. </p>
<p>To write a python function that implements a new LDB command define the function to take four arguments as follows:</p>
- <code><pre><tt>def command_function(<b>debugger</b>, <b>command</b>, <b>result</b>, <b>dict</b>):
+ <code><pre><tt>def command_function(<b>debugger</b>, <b>command</b>, <b>result</b>, <b>internal_dict</b>):
<font color=green># Your code goes here</font>
</tt></pre></code>
Optionally, you can also provide a Python docstring, and LLDB will use it when providing help for your command, as in:
- <code><pre><tt>def command_function(<b>debugger</b>, <b>command</b>, <b>result</b>, <b>dict</b>):
+ <code><pre><tt>def command_function(<b>debugger</b>, <b>command</b>, <b>result</b>, <b>internal_dict</b>):
<font color=green>"""This command takes a lot of options and does many fancy things"""</font>
<font color=green># Your code goes here</font>
</tt></pre></code>
@@ -357,7 +357,7 @@
</tr>
<tr>
<td class="content">
- <b>dict</b>
+ <b>internal_dict</b>
</td>
<td class="content">
<b>python dict object</b>
@@ -373,11 +373,11 @@
don't have to change your PYTHONPATH for temporary scripts. It also has another convenience
that if your new script module has a function of the form:</p>
-<code><pre><tt>def __lldb_init_module(<b>debugger</b>, <b>dict</b>):
+<code><pre><tt>def __lldb_init_module(<b>debugger</b>, <b>internal_dict</b>):
<font color=green># Command Initialization code goes here</font>
</tt></pre></code>
- <p>where <b>debugger</b> and <b>dict</b> are as above, that function will get run when the module is loaded
+ <p>where <b>debugger</b> and <b>internal_dict</b> are as above, that function will get run when the module is loaded
allowing you to add whatever commands you want into the current debugger. Note that
this function will only be run when using the LLDB comand <b>command script import</b>,
it will not get run if anyone imports your module from another module.
@@ -410,11 +410,11 @@
import optparse
import shlex
-def ls(debugger, command, result, dict):
+def ls(debugger, command, result, internal_dict):
result.PutCString(commands.getoutput('/bin/ls %s' % command))
<font color=green># And the initialization code to add your commands </font>
-def __lldb_init_module(debugger, dict):
+def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f ls.ls ls')
print 'The "ls" python command has been installed and is ready for use.'
</tt></pre></code>
Modified: lldb/trunk/www/varformats.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/varformats.html?rev=161467&r1=161466&r2=161467&view=diff
==============================================================================
--- lldb/trunk/www/varformats.html (original)
+++ lldb/trunk/www/varformats.html Tue Aug 7 21:06:30 2012
@@ -819,7 +819,7 @@
<td class="content">
<b>(lldb)</b> type summary add -P Rectangle<br/>
Enter your Python command(s). Type 'DONE' to end.<br/>
-def function (valobj,dict):<br/>
+def function (valobj,internal_dict):<br/>
height_val = valobj.GetChildMemberWithName('height')<br/>
width_val = valobj.GetChildMemberWithName('width')<br/>
height = height_val.GetValueAsUnsigned(0)<br/>
@@ -841,9 +841,9 @@
the LLDB <a href="docs.html">doxygen documentation</a> when it becomes available.</p>
<p>As a brief introduction, your script is encapsulated into a function that is
- passed two parameters: <code>valobj</code> and <code>dict</code>.</p>
+ passed two parameters: <code>valobj</code> and <code>internal_dict</code>.</p>
- <p><code>dict</code> is an internal support parameter used by LLDB and you should
+ <p><code>internal_dict</code> is an internal support parameter used by LLDB and you should
not touch it.<br/><code>valobj</code> is the object encapsulating the actual
variable being displayed, and its type is <a href="http://llvm.org/svn/llvm-project/lldb/trunk/include/lldb/API/SBValue.h">SBValue</a>.
Out of the many possible operations on an SBValue, the basic one is retrieve the children objects
@@ -1029,7 +1029,7 @@
must be implemented by the Python class):</p>
<code>
<font color=blue>class</font> SyntheticChildrenProvider:<br/>
- <font color=blue>def</font> __init__(self, valobj, dict):<br/>
+ <font color=blue>def</font> __init__(self, valobj, internal_dict):<br/>
<i>this call should initialize the Python object using valobj as the variable to provide synthetic children for</i> <br/>
<font color=blue>def</font> num_children(self): <br/>
<i>this call should return the number of children that you want your object to have</i> <br/>
More information about the lldb-commits
mailing list