diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h @@ -51,7 +51,7 @@ bool IsAlive() override; protected: - size_t GetGenericInteger(llvm::StringRef method_name); + unsigned long long GetGenericInteger(llvm::StringRef method_name); Status GetStatusFromMethod(llvm::StringRef method_name); private: diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp @@ -63,7 +63,7 @@ } bool ScriptedProcessPythonInterface::ShouldStop() { - return GetGenericInteger("shuold_stop"); + return static_cast(GetGenericInteger("shuold_stop")); } Status ScriptedProcessPythonInterface::Stop() { @@ -134,21 +134,24 @@ return Status("Returned object is null."); } -size_t +unsigned long long ScriptedProcessPythonInterface::GetGenericInteger(llvm::StringRef method_name) { Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); + unsigned long long invalid_address = + std::numeric_limits::max(); + if (!m_object_instance_sp) - return LLDB_INVALID_ADDRESS; + return invalid_address; if (!m_object_instance_sp) - return LLDB_INVALID_ADDRESS; + return invalid_address; PythonObject implementor(PyRefType::Borrowed, (PyObject *)m_object_instance_sp->GetValue()); if (!implementor.IsAllocated()) - return LLDB_INVALID_ADDRESS; + return invalid_address; PythonObject pmeth( PyRefType::Owned, @@ -158,12 +161,12 @@ PyErr_Clear(); if (!pmeth.IsAllocated()) - return LLDB_INVALID_ADDRESS; + return invalid_address; if (PyCallable_Check(pmeth.get()) == 0) { if (PyErr_Occurred()) PyErr_Clear(); - return LLDB_INVALID_ADDRESS; + return invalid_address; } if (PyErr_Occurred()) @@ -181,9 +184,9 @@ if (py_return.get()) { auto size = py_return.AsUnsignedLongLong(); - return (size) ? *size : LLDB_INVALID_ADDRESS; + return (size) ? *size : invalid_address; } - return LLDB_INVALID_ADDRESS; + return invalid_address; } lldb::MemoryRegionInfoSP @@ -280,7 +283,7 @@ } lldb::pid_t ScriptedProcessPythonInterface::GetProcessID() { - size_t pid = GetGenericInteger("get_process_id"); + unsigned long long pid = GetGenericInteger("get_process_id"); return (pid >= std::numeric_limits::max()) ? LLDB_INVALID_PROCESS_ID @@ -288,7 +291,7 @@ } bool ScriptedProcessPythonInterface::IsAlive() { - return GetGenericInteger("is_alive"); + return static_cast(GetGenericInteger("is_alive")); } #endif