From 3b7e1981b2f66e0677f964a3e9cf30ce2d7d3f84 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 5 Feb 2017 00:44:54 +0000 Subject: Remove LIBLLDB_LOG_VERBOSE category Summary: Per discussion in D28616, having two ways two request logging (log enable lldb XXX verbose && log enable -v lldb XXX) is confusing. This removes the first option and standardizes all code to use the second one. I've added a LLDB_LOGV macro as a shorthand for if(log && log->GetVerbose()) and switched most of the affected log statements to use that (I've only left a couple of cases that were doing complex computations in an if(log) block). Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D29510 llvm-svn: 294113 --- .../Python/ScriptInterpreterPython.cpp | 36 ++++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 357b48e53c4..56ddae14bcb 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -142,14 +142,9 @@ public: ~InitializePythonRAII() { if (m_was_already_initialized) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT | - LIBLLDB_LOG_VERBOSE)); - - if (log) { - log->Printf("Releasing PyGILState. Returning to state = %slocked\n", - m_was_already_initialized == PyGILState_UNLOCKED ? "un" - : ""); - } + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", + m_was_already_initialized == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_gil_state); } else { // We initialized the threads in this function, just unlock the GIL. @@ -174,15 +169,12 @@ private: void InitializeThreadsPrivate() { if (PyEval_ThreadsInitialized()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT | - LIBLLDB_LOG_VERBOSE)); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); m_was_already_initialized = true; m_gil_state = PyGILState_Ensure(); - if (log) { - log->Printf("Ensured PyGILState. Previous state = %slocked\n", - m_gil_state == PyGILState_UNLOCKED ? "un" : ""); - } + LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked\n", + m_gil_state == PyGILState_UNLOCKED ? "un" : ""); return; } @@ -212,12 +204,10 @@ ScriptInterpreterPython::Locker::Locker(ScriptInterpreterPython *py_interpreter, } bool ScriptInterpreterPython::Locker::DoAcquireLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT | - LIBLLDB_LOG_VERBOSE)); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); m_GILState = PyGILState_Ensure(); - if (log) - log->Printf("Ensured PyGILState. Previous state = %slocked\n", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", + m_GILState == PyGILState_UNLOCKED ? "un" : ""); // 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 @@ -239,11 +229,9 @@ bool ScriptInterpreterPython::Locker::DoInitSession(uint16_t on_entry_flags, } bool ScriptInterpreterPython::Locker::DoFreeLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT | - LIBLLDB_LOG_VERBOSE)); - if (log) - log->Printf("Releasing PyGILState. Returning to state = %slocked\n", - m_GILState == PyGILState_UNLOCKED ? "un" : ""); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", + m_GILState == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_GILState); m_python_interpreter->DecrementLockCount(); return true; -- cgit v1.2.3