[Lldb-commits] [lldb] [lldb] Always emit diagnostic events to the system log (PR #90913)

via lldb-commits lldb-commits at lists.llvm.org
Thu May 2 16:08:39 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Always emit diagnostic events to the system log so that they end up in the sysdiagnose on Darwin.

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


1 Files Affected:

- (modified) lldb/source/Core/Debugger.cpp (+15) 


``````````diff
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index cac4642873b772..c5ab99fac75d27 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1512,7 +1512,22 @@ void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
                                     std::string message,
                                     std::optional<lldb::user_id_t> debugger_id,
                                     std::once_flag *once) {
+  auto GetSystemLogLevel = [](DiagnosticEventData::Type type) {
+    switch (type) {
+    case DiagnosticEventData::Type::Info:
+      return Host::eSystemLogInfo;
+    case DiagnosticEventData::Type::Warning:
+      return Host::eSystemLogWarning;
+    case DiagnosticEventData::Type::Error:
+      return Host::eSystemLogError;
+    }
+    llvm_unreachable("All cases handled above!");
+  };
+
   auto ReportDiagnosticLambda = [&]() {
+    // Always log diagnostics to the system log.
+    Host::SystemLog(GetSystemLogLevel(type), message);
+
     // The diagnostic subsystem is optional but we still want to broadcast
     // events when it's disabled.
     if (Diagnostics::Enabled())

``````````

</details>


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


More information about the lldb-commits mailing list