[llvm-branch-commits] [lldb] 69873d3 - [lldb] Gate `PolicyStack::Current()` log behind verbose (#209527)

Douglas Yung via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 22 07:00:36 PDT 2026


Author: Med Ismail Bennani
Date: 2026-07-22T14:00:22Z
New Revision: 69873d3d1985f34fd16a3c5af89a00f9fc4df1fc

URL: https://github.com/llvm/llvm-project/commit/69873d3d1985f34fd16a3c5af89a00f9fc4df1fc
DIFF: https://github.com/llvm/llvm-project/commit/69873d3d1985f34fd16a3c5af89a00f9fc4df1fc.diff

LOG: [lldb] Gate `PolicyStack::Current()` log behind verbose (#209527)

`Process::GetState()` calls `PolicyStack::Get().Current()` on every
prompt redraw, so the previous unconditional LLDB_LOG at the read site
fired on every keypress once `log enable lldb process` was on, drowning
out any other process log output. Keep the dump for when it's actually
wanted, but only fire it if the log is set to verbose.

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
(cherry picked from commit c7a0afe5049a3d4789f34a8d746c6a45d73557b4)

Added: 
    

Modified: 
    lldb/source/Utility/Policy.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Utility/Policy.cpp b/lldb/source/Utility/Policy.cpp
index 301f7ee36e897..4d1999aaf7b92 100644
--- a/lldb/source/Utility/Policy.cpp
+++ b/lldb/source/Utility/Policy.cpp
@@ -25,10 +25,15 @@ PolicyStack &PolicyStack::Get() {
 
 Policy PolicyStack::Current() const {
   Policy p = m_stack.back();
+  // `Current()` is called on every read of the current policy (e.g. every
+  // `Process::GetState()`, itself called on every prompt redraw), so log
+  // only when verbose is set to avoid drowning out the process log.
   if (Log *log = GetLog(LLDBLog::Process)) {
-    StreamString s;
-    p.Dump(s);
-    LLDB_LOG(log, "{0}", s.GetData());
+    if (log->GetVerbose()) {
+      StreamString s;
+      p.Dump(s);
+      LLDB_LOG(log, "{0}", s.GetData());
+    }
   }
   return p;
 }


        


More information about the llvm-branch-commits mailing list