teemperor created this revision.
teemperor added a reviewer: stella.stamenova.
The refactoring patch for DoExecute missed this case of a variadic function
that just silently
accepts a StringRef which it then tries to reinterpret as a C-string.
This should fix the Windows builds.
https://reviews.llvm.org/D49309
Files:
source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
bool ScriptInterpreterPython::ExecuteOneLine(
llvm::StringRef command, CommandReturnObject *result,
const ExecuteScriptOptions &options) {
+ std::string command_str = command.str();
+
if (!m_valid_session)
return false;
@@ -855,7 +857,7 @@
if (PyCallable_Check(m_run_one_line_function.get())) {
PythonObject pargs(
PyRefType::Owned,
- Py_BuildValue("(Os)", session_dict.get(), command));
+ Py_BuildValue("(Os)", session_dict.get(),
command_str.c_str()));
if (pargs.IsValid()) {
PythonObject return_value(
PyRefType::Owned,
@@ -895,7 +897,6 @@
// The one-liner failed. Append the error message.
if (result) {
- std::string command_str = command.str();
result->AppendErrorWithFormat(
"python failed attempting to evaluate '%s'\n", command_str.c_str());
}
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
bool ScriptInterpreterPython::ExecuteOneLine(
llvm::StringRef command, CommandReturnObject *result,
const ExecuteScriptOptions &options) {
+ std::string command_str = command.str();
+
if (!m_valid_session)
return false;
@@ -855,7 +857,7 @@
if (PyCallable_Check(m_run_one_line_function.get())) {
PythonObject pargs(
PyRefType::Owned,
- Py_BuildValue("(Os)", session_dict.get(), command));
+ Py_BuildValue("(Os)", session_dict.get(), command_str.c_str()));
if (pargs.IsValid()) {
PythonObject return_value(
PyRefType::Owned,
@@ -895,7 +897,6 @@
// The one-liner failed. Append the error message.
if (result) {
- std::string command_str = command.str();
result->AppendErrorWithFormat(
"python failed attempting to evaluate '%s'\n", command_str.c_str());
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits