[lldb] Fix process LLDB_LOG typo (nfci)
authorMed Ismail Bennani <ismail@bennani.ma>
Wed, 17 May 2023 08:38:14 +0000 (01:38 -0700)
committerMed Ismail Bennani <ismail@bennani.ma>
Mon, 22 May 2023 23:14:00 +0000 (16:14 -0700)
This patch fixes the log commands by replacing the LLDB_LOG macro by the
LLDB_LOGF macro. This is necessary in order to format argument with printf.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
lldb/source/Target/Process.cpp

index 9e9b1da..0aefeeb 100644 (file)
@@ -1056,13 +1056,13 @@ bool Process::SetExitStatus(int status, const char *cstr) {
   std::lock_guard<std::mutex> guard(m_exit_status_mutex);
 
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s status=%i (0x%8.8x), description=%s%s%s)",
+  LLDB_LOGF(log, "(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_LOG(log,
+    LLDB_LOGF(log,
              "(plugin = %s) ignoring exit status because state was already set "
              "to eStateExited",
              GetPluginName().data());
@@ -1317,7 +1317,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
   }
 
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s, state = %s, restarted = %i)",
+  LLDB_LOGF(log, "(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);
@@ -1327,7 +1327,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
   // program to run.
   if (!StateChangedIsExternallyHijacked()) {
     if (new_state == eStateDetached) {
-      LLDB_LOG(log,
+      LLDB_LOGF(log,
                "(plugin = %s, state = %s) -- unlocking run lock for detach",
                GetPluginName().data(), StateAsCString(new_state));
       m_public_run_lock.SetStopped();
@@ -1335,7 +1335,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
       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_LOG(log, "(plugin = %s, state = %s) -- unlocking run lock",
+          LLDB_LOGF(log, "(plugin = %s, state = %s) -- unlocking run lock",
                    GetPluginName().data(), StateAsCString(new_state));
           m_public_run_lock.SetStopped();
         }
@@ -1346,10 +1346,10 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
 
 Status Process::Resume() {
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s) -- locking run lock", GetPluginName().data());
+  LLDB_LOGF(log, "(plugin = %s) -- locking run lock", GetPluginName().data());
   if (!m_public_run_lock.TrySetRunning()) {
     Status error("Resume request failed - process still running.");
-    LLDB_LOG(log, "(plugin = %s) -- TrySetRunning failed, not resuming.",
+    LLDB_LOGF(log, "(plugin = %s) -- TrySetRunning failed, not resuming.",
              GetPluginName().data());
     return error;
   }
@@ -1423,7 +1423,7 @@ void Process::SetPrivateState(StateType new_state) {
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process | LLDBLog::Unwind));
   bool state_changed = false;
 
-  LLDB_LOG(log, "(plugin = %s, state = %s)", GetPluginName().data(),
+  LLDB_LOGF(log, "(plugin = %s, state = %s)", GetPluginName().data(),
            StateAsCString(new_state));
 
   std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex());
@@ -1465,14 +1465,14 @@ void Process::SetPrivateState(StateType new_state) {
       if (!m_mod_id.IsLastResumeForUserExpression())
         m_mod_id.SetStopEventForLastNaturalStopID(event_sp);
       m_memory_cache.Clear();
-      LLDB_LOG(log, "(plugin = %s, state = %s, stop_id = %u",
+      LLDB_LOGF(log, "(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_LOG(log, "(plugin = %s, state = %s) state didn't change. Ignoring...",
+    LLDB_LOGF(log, "(plugin = %s, state = %s) state didn't change. Ignoring...",
              GetPluginName().data(), StateAsCString(new_state));
   }
 }