[Lldb-commits] [lldb] [lldb][Debugger] Register 'testing.XXX' settings with Debugger (PR #185897)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 11 08:17:56 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

<details>
<summary>Changes</summary>

The `testing.XXX` settings (added in https://github.com/llvm/llvm-project/pull/177279 and currently just `testing.inject-variable-location-error`) are supposed to only exist in asserts builds. However, we never added it as a global property to the `Debugger`, so the setting wasn't actually usable, in any build.

The one test that did use it [skipped the test on error](https://github.com/llvm/llvm-project/blob/230e4656170e3764db28b54d91153a1117290171/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py#L286-L288) as a way to mimick "only run test in asserts mode". However, this just meant the test never ran.

This patch registers the property and adds a test that ensures an asserts-LLDB does allow access to it from the CLI.

---
Full diff: https://github.com/llvm/llvm-project/pull/185897.diff


2 Files Affected:

- (modified) lldb/source/Core/Debugger.cpp (+6) 
- (added) lldb/test/Shell/Settings/TestTestingSettings.test (+7) 


``````````diff
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 05c2ed13374ae..1dad6983eecda 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1015,6 +1015,12 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
         "Settings specify to the debugger's command interpreter.", true,
         m_command_interpreter_up->GetValueProperties());
   }
+#ifndef NDEBUG
+  m_collection_sp->AppendProperty(
+      "testing", "Testing-only settings.", /*is_global=*/true,
+      TestingProperties::GetGlobalTestingProperties().GetValueProperties());
+#endif
+
   if (log_callback)
     m_callback_handler_sp =
         std::make_shared<CallbackLogHandler>(log_callback, baton);
diff --git a/lldb/test/Shell/Settings/TestTestingSettings.test b/lldb/test/Shell/Settings/TestTestingSettings.test
new file mode 100644
index 0000000000000..f8fab476b46a6
--- /dev/null
+++ b/lldb/test/Shell/Settings/TestTestingSettings.test
@@ -0,0 +1,7 @@
+# REQUIRES: asserts
+#
+# Tests that the global 'testing.XXX' settings are available when building with asserts.
+#
+# RUN: %lldb -o 'settings show testing.inject-variable-location-error' -b | FileCheck %s
+#
+# CHECK: testing.inject-variable-location-error (boolean) = false

``````````

</details>


https://github.com/llvm/llvm-project/pull/185897


More information about the lldb-commits mailing list