mib created this revision. mib added reviewers: bulbazord, jingham, JDevlieghere. mib added a project: LLDB. Herald added a project: All. mib requested review of this revision. Herald added a subscriber: lldb-commits.
This patch improves process state change logging messages to include to process plugin name. This is very useful when investigating interactions between different types of process plugins. That comes very handy when investigating bugs related to interactive scripted process debugging. Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D148399 Files: lldb/source/Target/Process.cpp
Index: lldb/source/Target/Process.cpp =================================================================== --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -1053,14 +1053,19 @@ std::lock_guard<std::mutex> guard(m_exit_status_mutex); Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); - LLDB_LOGF( - log, "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)", - status, status, cstr ? "\"" : "", cstr ? cstr : "NULL", cstr ? "\"" : ""); + LLDB_LOGF(log, + "Process::SetExitStatus (plugin = %s status=%i (0x%8.8x), " + "description=%s%s%s)", + GetPluginName().data(), status, status, cstr ? "\"" : "", + cstr ? cstr : "NULL", cstr ? "\"" : ""); // We were already in the exited state if (m_private_state.GetValue() == eStateExited) { - LLDB_LOGF(log, "Process::SetExitStatus () ignoring exit status because " - "state was already set to eStateExited"); + LLDB_LOGF( + log, + "Process::SetExitStatus (plugin = %s) ignoring exit status because " + "state was already set to eStateExited", + GetPluginName().data()); return false; } @@ -1312,8 +1317,9 @@ } Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); - LLDB_LOGF(log, "Process::SetPublicState (state = %s, restarted = %i)", - StateAsCString(new_state), restarted); + LLDB_LOGF(log, + "Process::SetPublicState (plugin = %s, state = %s, restarted = %i)", + GetPluginName().data(), StateAsCString(new_state), restarted); const StateType old_state = m_public_state.GetValue(); m_public_state.SetValue(new_state); @@ -1323,15 +1329,18 @@ if (!StateChangedIsExternallyHijacked()) { if (new_state == eStateDetached) { LLDB_LOGF(log, - "Process::SetPublicState (%s) -- unlocking run lock for detach", - StateAsCString(new_state)); + "Process::SetPublicState (plugin = %s, state = %s) -- " + "unlocking run lock for detach", + GetPluginName().data(), StateAsCString(new_state)); m_public_run_lock.SetStopped(); } else { const bool old_state_is_stopped = StateIsStoppedState(old_state, false); if ((old_state_is_stopped != new_state_is_stopped)) { if (new_state_is_stopped && !restarted) { - LLDB_LOGF(log, "Process::SetPublicState (%s) -- unlocking run lock", - StateAsCString(new_state)); + LLDB_LOGF(log, + "Process::SetPublicState (plugin = %s, state = %s) -- " + "unlocking run lock", + GetPluginName().data(), StateAsCString(new_state)); m_public_run_lock.SetStopped(); } } @@ -1341,10 +1350,14 @@ Status Process::Resume() { Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); - LLDB_LOGF(log, "Process::Resume -- locking run lock"); + LLDB_LOGF(log, "Process::Resume (plugin = %s) -- locking run lock", + GetPluginName().data()); if (!m_public_run_lock.TrySetRunning()) { Status error("Resume request failed - process still running."); - LLDB_LOGF(log, "Process::Resume: -- TrySetRunning failed, not resuming."); + LLDB_LOGF( + log, + "Process::Resume (plugin = %s) -- TrySetRunning failed, not resuming.", + GetPluginName().data()); return error; } Status error = PrivateResume(); @@ -1420,7 +1433,8 @@ Log *log(GetLog(LLDBLog::State | LLDBLog::Process | LLDBLog::Unwind)); bool state_changed = false; - LLDB_LOGF(log, "Process::SetPrivateState (%s)", StateAsCString(new_state)); + LLDB_LOGF(log, "Process::SetPrivateState (plugin = %s, state = %s)", + GetPluginName().data(), StateAsCString(new_state)); std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex()); std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex()); @@ -1461,15 +1475,19 @@ if (!m_mod_id.IsLastResumeForUserExpression()) m_mod_id.SetStopEventForLastNaturalStopID(event_sp); m_memory_cache.Clear(); - LLDB_LOGF(log, "Process::SetPrivateState (%s) stop_id = %u", - StateAsCString(new_state), m_mod_id.GetStopID()); + LLDB_LOGF( + log, + "Process::SetPrivateState (plugin = %s, state = %s, stop_id = %u", + GetPluginName().data(), StateAsCString(new_state), + m_mod_id.GetStopID()); } m_private_state_broadcaster.BroadcastEvent(event_sp); } else { LLDB_LOGF(log, - "Process::SetPrivateState (%s) state didn't change. Ignoring...", - StateAsCString(new_state)); + "Process::SetPrivateState (plugin = %s, state = %s) state didn't " + "change. Ignoring...", + GetPluginName().data(), StateAsCString(new_state)); } }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits