[Lldb-commits] [PATCH] D105788: [LLDB] Silence warnings from ScriptedProcessPythonInterface.cpp
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 22 09:32:43 PDT 2021
mib updated this revision to Diff 360857.
mib edited the summary of this revision.
mib added a reviewer: teemperor.
mib added a project: LLDB.
mib added a comment.
Herald added a subscriber: JDevlieghere.
Conform `ScriptedProcessPythonInterface` to SWIG python types
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105788/new/
https://reviews.llvm.org/D105788
Files:
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++ 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:
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -63,7 +63,7 @@
}
bool ScriptedProcessPythonInterface::ShouldStop() {
- return GetGenericInteger("shuold_stop");
+ return static_cast<bool>(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<unsigned long long>::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<lldb::pid_t>::max())
? LLDB_INVALID_PROCESS_ID
@@ -288,7 +291,7 @@
}
bool ScriptedProcessPythonInterface::IsAlive() {
- return GetGenericInteger("is_alive");
+ return static_cast<bool>(GetGenericInteger("is_alive"));
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105788.360857.patch
Type: text/x-patch
Size: 3102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210722/c8d718e0/attachment.bin>
More information about the lldb-commits
mailing list