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
This commit is contained in:
Pavel Labath
2017-02-05 00:44:54 +00:00
parent 978fdb75a4
commit 3b7e1981b2
18 changed files with 142 additions and 226 deletions

View File

@@ -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;