[llvm-branch-commits] [lldb] release/23.x: [lldb] Gate `PolicyStack::Current()` log behind verbose (#209527) (PR #211029)
Douglas Yung via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jul 22 07:00:37 PDT 2026
https://github.com/dyung updated https://github.com/llvm/llvm-project/pull/211029
>From 69873d3d1985f34fd16a3c5af89a00f9fc4df1fc Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Tue, 14 Jul 2026 10:54:58 -0700
Subject: [PATCH] [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)
---
lldb/source/Utility/Policy.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
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