[Lldb-commits] [lldb] r172647 - in /lldb/trunk: include/lldb/Interpreter/ScriptInterpreter.h include/lldb/Interpreter/ScriptInterpreterPython.h scripts/Python/python-wrapper.swig source/Core/FormatClasses.cpp source/Interpreter/ScriptInterpreterPython.cpp
Greg Clayton
gclayton at apple.com
Wed Jan 16 11:53:56 PST 2013
Author: gclayton
Date: Wed Jan 16 13:53:55 2013
New Revision: 172647
URL: http://llvm.org/viewvc/llvm-project?rev=172647&view=rev
Log:
Remove std::string input arguments and replace with "const char *".
Modified:
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/scripts/Python/python-wrapper.swig
lldb/trunk/source/Core/FormatClasses.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=172647&r1=172646&r2=172647&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Wed Jan 16 13:53:55 2013
@@ -84,11 +84,11 @@
void** pyfunct_wrapper,
std::string& retval);
- typedef void* (*SWIGPythonCreateSyntheticProvider) (const std::string python_class_name,
+ typedef void* (*SWIGPythonCreateSyntheticProvider) (const const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp);
- typedef void* (*SWIGPythonCreateOSPlugin) (const std::string python_class_name,
+ typedef void* (*SWIGPythonCreateOSPlugin) (const const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp);
@@ -107,7 +107,7 @@
std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj);
- typedef bool (*SWIGPythonCallModuleInit) (const std::string python_module_name,
+ typedef bool (*SWIGPythonCallModuleInit) (const const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger);
@@ -261,14 +261,14 @@
}
virtual lldb::ScriptInterpreterObjectSP
- CreateSyntheticScriptedProvider (std::string class_name,
+ CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj)
{
return lldb::ScriptInterpreterObjectSP();
}
virtual lldb::ScriptInterpreterObjectSP
- CreateOSPlugin (std::string class_name,
+ CreateOSPlugin (const char *class_name,
lldb::ProcessSP process_sp)
{
return lldb::ScriptInterpreterObjectSP();
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=172647&r1=172646&r2=172647&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Wed Jan 16 13:53:55 2013
@@ -76,11 +76,11 @@
GenerateScriptAliasFunction (StringList &input, std::string& output);
lldb::ScriptInterpreterObjectSP
- CreateSyntheticScriptedProvider (std::string class_name,
+ CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj);
virtual lldb::ScriptInterpreterObjectSP
- CreateOSPlugin (std::string class_name,
+ CreateOSPlugin (const char *class_name,
lldb::ProcessSP process_sp);
virtual lldb::ScriptInterpreterObjectSP
Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=172647&r1=172646&r2=172647&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Wed Jan 16 13:53:55 2013
@@ -267,6 +267,8 @@
{
lldb::SBValue sb_value (valobj_sp);
+ retval.clear();
+
PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &sb_value, SWIGTYPE_p_lldb__SBValue, 0);
if (ValObj_PyObj == NULL)
@@ -323,14 +325,14 @@
SWIGEXPORT void*
LLDBSwigPythonCreateSyntheticProvider
(
- const std::string python_class_name,
+ const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP& valobj_sp
)
{
PyObject* retval = NULL;
- if (python_class_name.empty() || !session_dictionary_name)
+ if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
Py_RETURN_NONE;
// I do not want the SBValue to be deallocated when going out of scope because python
@@ -343,7 +345,7 @@
if (ValObj_PyObj == NULL)
Py_RETURN_NONE;
- const char* python_function_name = python_class_name.c_str();
+ const char* python_function_name = python_class_name;
PyObject *session_dict, *pfunc;
PyObject *pvalue;
@@ -778,14 +780,14 @@
SWIGEXPORT void*
LLDBSWIGPythonCreateOSPlugin
(
- const std::string python_class_name,
+ const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp
)
{
PyObject* retval = NULL;
- if (python_class_name.empty() || !session_dictionary_name)
+ if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
Py_RETURN_NONE;
// I do not want the SBValue to be deallocated when going out of scope because python
@@ -797,7 +799,7 @@
if (SBProc_PyObj == NULL)
Py_RETURN_NONE;
- const char* python_function_name = python_class_name.c_str();
+ const char* python_function_name = python_class_name;
PyObject *session_dict, *pfunc;
PyObject *pvalue;
@@ -875,7 +877,7 @@
SWIGEXPORT bool
LLDBSwigPythonCallModuleInit
(
- const std::string python_module_name,
+ const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger
)
@@ -890,7 +892,7 @@
if (DebuggerObj_PyObj == NULL)
return retval;
- if (!(python_module_name.length()) || !session_dictionary_name)
+ if (python_module_name == NULL || python_module_name[0] == '\0' || !session_dictionary_name)
return retval;
PyObject *session_dict, *pfunc;
@@ -898,7 +900,8 @@
session_dict = FindSessionDictionary (session_dictionary_name);
- std::string python_function_name_string = python_module_name + (".__lldb_init_module");
+ std::string python_function_name_string = python_module_name;
+ python_function_name_string += ".__lldb_init_module";
const char* python_function_name = python_function_name_string.c_str();
if (session_dict != NULL)
Modified: lldb/trunk/source/Core/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatClasses.cpp?rev=172647&r1=172646&r2=172647&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatClasses.cpp (original)
+++ lldb/trunk/source/Core/FormatClasses.cpp Wed Jan 16 13:53:55 2013
@@ -337,7 +337,7 @@
m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (m_interpreter != NULL)
- m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, backend.GetSP());
+ m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
}
TypeSyntheticImpl::FrontEnd::~FrontEnd()
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=172647&r1=172646&r2=172647&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Jan 16 13:53:55 2013
@@ -64,72 +64,65 @@
// on linkage-time resolution because the SWIG stuff and this file
// get built at different times
extern "C" bool
-LLDBSwigPythonBreakpointCallbackFunction
-(
- const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& sb_frame,
- const lldb::BreakpointLocationSP& sb_bp_loc
- );
+LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name,
+ const char *session_dictionary_name,
+ const lldb::StackFrameSP& sb_frame,
+ const lldb::BreakpointLocationSP& sb_bp_loc);
extern "C" bool
-LLDBSwigPythonWatchpointCallbackFunction
-(
- const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& sb_frame,
- const lldb::WatchpointSP& sb_wp
- );
+LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name,
+ const char *session_dictionary_name,
+ const lldb::StackFrameSP& sb_frame,
+ const lldb::WatchpointSP& sb_wp);
extern "C" bool
-LLDBSwigPythonCallTypeScript
-(
- const char *python_function_name,
- void *session_dictionary,
- const lldb::ValueObjectSP& valobj_sp,
- void** pyfunct_wrapper,
- std::string& retval
- );
+LLDBSwigPythonCallTypeScript (const char *python_function_name,
+ void *session_dictionary,
+ const lldb::ValueObjectSP& valobj_sp,
+ void** pyfunct_wrapper,
+ std::string& retval);
extern "C" void*
-LLDBSwigPythonCreateSyntheticProvider
-(
- const std::string python_class_name,
- const char *session_dictionary_name,
- const lldb::ValueObjectSP& valobj_sp
- );
+LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::ValueObjectSP& valobj_sp);
-extern "C" uint32_t LLDBSwigPython_CalculateNumChildren (void *implementor);
-extern "C" void* LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
-extern "C" int LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
-extern "C" void* LLDBSWIGPython_CastPyObjectToSBValue (void* data);
-extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance (void* implementor);
-extern "C" bool LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor);
+extern "C" uint32_t
+LLDBSwigPython_CalculateNumChildren (void *implementor);
-extern "C" bool LLDBSwigPythonCallCommand
-(
- const char *python_function_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger,
- const char* args,
- std::string& err_msg,
- lldb_private::CommandReturnObject& cmd_retobj
- );
+extern "C" void *
+LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
-extern "C" bool LLDBSwigPythonCallModuleInit
-(
- const std::string python_module_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger
- );
+extern "C" int
+LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
-extern "C" void* LLDBSWIGPythonCreateOSPlugin
-(
- const std::string python_class_name,
- const char *session_dictionary_name,
- const lldb::ProcessSP& process_sp
-);
+extern "C" void *
+LLDBSWIGPython_CastPyObjectToSBValue (void* data);
+
+extern "C" bool
+LLDBSwigPython_UpdateSynthProviderInstance (void* implementor);
+
+extern "C" bool
+LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor);
+
+extern "C" bool
+LLDBSwigPythonCallCommand (const char *python_function_name,
+ const char *session_dictionary_name,
+ lldb::DebuggerSP& debugger,
+ const char* args,
+ std::string& err_msg,
+ lldb_private::CommandReturnObject& cmd_retobj);
+
+extern "C" bool
+LLDBSwigPythonCallModuleInit (const char *python_module_name,
+ const char *session_dictionary_name,
+ lldb::DebuggerSP& debugger);
+
+extern "C" void*
+LLDBSWIGPythonCreateOSPlugin (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::ProcessSP& process_sp);
static int
_check_and_flush (FILE *stream)
@@ -1726,10 +1719,9 @@
}
lldb::ScriptInterpreterObjectSP
-ScriptInterpreterPython::CreateOSPlugin (std::string class_name,
- lldb::ProcessSP process_sp)
+ScriptInterpreterPython::CreateOSPlugin (const char *class_name, lldb::ProcessSP process_sp)
{
- if (class_name.empty())
+ if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP();
if (!process_sp)
@@ -1927,10 +1919,10 @@
}
lldb::ScriptInterpreterObjectSP
-ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name,
+ScriptInterpreterPython::CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj)
{
- if (class_name.empty())
+ if (class_name == NULL || class_name[0] == '\0')
return lldb::ScriptInterpreterObjectSP();
if (!valobj.get())
@@ -2591,9 +2583,9 @@
// if we are here, everything worked
// call __lldb_init_module(debugger,dict)
- if (!g_swig_call_module_init (basename,
- m_dictionary_name.c_str(),
- debugger_sp))
+ if (!g_swig_call_module_init (basename.c_str(),
+ m_dictionary_name.c_str(),
+ debugger_sp))
{
error.SetErrorString("calling __lldb_init_module failed");
return false;
More information about the lldb-commits
mailing list