[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@bennani.ma>
(cherry picked from commit c7a0afe5049a3d4789f34a8d746c6a45d73557b4)
This commit is contained in:
Med Ismail Bennani authored and Douglas Yung committed 2026-07-22 14:00:22 +00:00
1 parent 37532c319a
commit 69873d3d19
1 file changed
+8 -3
+8 -3
View File
@@ -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;
}