No longer pass a StringRef to the Python API

Summary:
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.

Reviewers: stella.stamenova

Reviewed By: stella.stamenova

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49309

llvm-svn: 337030
This commit is contained in:
Raphael Isemann 2018-07-13 18:13:46 +00:00
parent 8e04d937b0
commit d6c062bce1
1 changed files with 3 additions and 2 deletions

View File

@ -753,6 +753,8 @@ static void ReadThreadBytesReceived(void *baton, const void *src,
bool ScriptInterpreterPython::ExecuteOneLine( bool ScriptInterpreterPython::ExecuteOneLine(
llvm::StringRef command, CommandReturnObject *result, llvm::StringRef command, CommandReturnObject *result,
const ExecuteScriptOptions &options) { const ExecuteScriptOptions &options) {
std::string command_str = command.str();
if (!m_valid_session) if (!m_valid_session)
return false; return false;
@ -855,7 +857,7 @@ bool ScriptInterpreterPython::ExecuteOneLine(
if (PyCallable_Check(m_run_one_line_function.get())) { if (PyCallable_Check(m_run_one_line_function.get())) {
PythonObject pargs( PythonObject pargs(
PyRefType::Owned, PyRefType::Owned,
Py_BuildValue("(Os)", session_dict.get(), command)); Py_BuildValue("(Os)", session_dict.get(), command_str.c_str()));
if (pargs.IsValid()) { if (pargs.IsValid()) {
PythonObject return_value( PythonObject return_value(
PyRefType::Owned, PyRefType::Owned,
@ -895,7 +897,6 @@ bool ScriptInterpreterPython::ExecuteOneLine(
// The one-liner failed. Append the error message. // The one-liner failed. Append the error message.
if (result) { if (result) {
std::string command_str = command.str();
result->AppendErrorWithFormat( result->AppendErrorWithFormat(
"python failed attempting to evaluate '%s'\n", command_str.c_str()); "python failed attempting to evaluate '%s'\n", command_str.c_str());
} }