Skip to content

Commit 4589130

Browse files
committed
[lldb] Always emit diagnostic events to the system log
Always emit diagnostic events to the system log so that they end up in the sysdiagnose on Darwin.
1 parent a7e9e3e commit 4589130

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lldb/source/Core/Debugger.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,22 @@ void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
15121512
std::string message,
15131513
std::optional<lldb::user_id_t> debugger_id,
15141514
std::once_flag *once) {
1515+
auto GetSystemLogLevel = [](DiagnosticEventData::Type type) {
1516+
switch (type) {
1517+
case DiagnosticEventData::Type::Info:
1518+
return Host::eSystemLogInfo;
1519+
case DiagnosticEventData::Type::Warning:
1520+
return Host::eSystemLogWarning;
1521+
case DiagnosticEventData::Type::Error:
1522+
return Host::eSystemLogError;
1523+
}
1524+
llvm_unreachable("All cases handled above!");
1525+
};
1526+
15151527
auto ReportDiagnosticLambda = [&]() {
1528+
// Always log diagnostics to the system log.
1529+
Host::SystemLog(GetSystemLogLevel(type), message);
1530+
15161531
// The diagnostic subsystem is optional but we still want to broadcast
15171532
// events when it's disabled.
15181533
if (Diagnostics::Enabled())

0 commit comments

Comments
 (0)