-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Always emit diagnostic events to the system log #90913
[lldb] Always emit diagnostic events to the system log #90913
Conversation
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesAlways 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:
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())
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with comment
lldb/source/Core/Debugger.cpp
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This could be constexpr
I think
Always emit diagnostic events to the system log so that they end up in the sysdiagnose on Darwin.
4589130
to
7ed4008
Compare
Always emit diagnostic events to the system log so that they end up in the sysdiagnose on Darwin. (cherry picked from commit f9d91fb)
Always emit diagnostic events to the system log so that they end up in the sysdiagnose on Darwin.