diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2025-08-04 09:35:36 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2025-08-04 09:37:37 -0700 |
commit | 8f77fa7026de9f544778063fd9fe900d0804b863 (patch) | |
tree | 960b26b42670e77e09f6b9c087efae933796c8f8 /lldb/source/Plugins/ScriptInterpreter/Python | |
parent | 5a80274cae3c5d19cf5058550139cb857513ae02 (diff) | |
download | llvm-8f77fa7026de9f544778063fd9fe900d0804b863.zip llvm-8f77fa7026de9f544778063fd9fe900d0804b863.tar.gz llvm-8f77fa7026de9f544778063fd9fe900d0804b863.tar.bz2 |
[lldb] Simplify Python Locker log messages (NFC)
Eliminate the `log` variable by inlining the GetLog call and use
"locked" and "unlocked" directly, as requested by Ismail in #151780.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index fc4df81..adc172c 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -145,15 +145,15 @@ public: m_was_already_initialized = true; m_gil_state = PyGILState_Ensure(); LLDB_LOGV(GetLog(LLDBLog::Script), - "Ensured PyGILState. Previous state = {0}locked\n", - m_gil_state == PyGILState_UNLOCKED ? "un" : ""); + "Ensured PyGILState. Previous state = {0}", + m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked"); } ~InitializePythonRAII() { if (m_was_already_initialized) { - Log *log = GetLog(LLDBLog::Script); - LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", - m_gil_state == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), + "Releasing PyGILState. Returning to state = {0}", + m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked"); PyGILState_Release(m_gil_state); } else { // We initialized the threads in this function, just unlock the GIL. @@ -328,10 +328,9 @@ ScriptInterpreterPythonImpl::Locker::Locker( } bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() { - Log *log = GetLog(LLDBLog::Script); m_GILState = PyGILState_Ensure(); - LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), "Ensured PyGILState. Previous state = {0}", + m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked"); // we need to save the thread state when we first start the command because // we might decide to interrupt it while some action is taking place outside @@ -352,9 +351,9 @@ bool ScriptInterpreterPythonImpl::Locker::DoInitSession(uint16_t on_entry_flags, } bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() { - Log *log = GetLog(LLDBLog::Script); - LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(GetLog(LLDBLog::Script), + "Releasing PyGILState. Returning to state = {0}", + m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked"); PyGILState_Release(m_GILState); m_python_interpreter->DecrementLockCount(); return true; |