-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[compiler-rt][sanitizer-common] Use os_log for DriverKit as os_log_error is undefined #148848
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
base: main
Are you sure you want to change the base?
[compiler-rt][sanitizer-common] Use os_log for DriverKit as os_log_error is undefined #148848
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Dan Blackwell (DanBlackwell) ChangesFull diff: https://github.com/llvm/llvm-project/pull/148848.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
index bb71af5ad8b6a..2751485af399f 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
@@ -837,22 +837,29 @@ void LogMessageOnPrintf(const char *str) {
void LogFullErrorReport(const char *buffer) {
# if !SANITIZER_GO
- // Log with os_log_error. This will make it into the crash log.
+# if SANITIZER_DRIVERKIT
+# define SANITIZER_OS_LOG os_log
+# else
+# define SANITIZER_OS_LOG os_log_error
+# endif
+
+ // Log with os_log.*. This will make it into the crash log.
if (internal_strncmp(SanitizerToolName, "AddressSanitizer",
sizeof("AddressSanitizer") - 1) == 0)
- os_log_error(OS_LOG_DEFAULT, "Address Sanitizer reported a failure.");
+ SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Address Sanitizer reported a failure.");
else if (internal_strncmp(SanitizerToolName, "UndefinedBehaviorSanitizer",
sizeof("UndefinedBehaviorSanitizer") - 1) == 0)
- os_log_error(OS_LOG_DEFAULT,
+ SANITIZER_OS_LOG(OS_LOG_DEFAULT,
"Undefined Behavior Sanitizer reported a failure.");
else if (internal_strncmp(SanitizerToolName, "ThreadSanitizer",
sizeof("ThreadSanitizer") - 1) == 0)
- os_log_error(OS_LOG_DEFAULT, "Thread Sanitizer reported a failure.");
+ SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Thread Sanitizer reported a failure.");
else
- os_log_error(OS_LOG_DEFAULT, "Sanitizer tool reported a failure.");
+ SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Sanitizer tool reported a failure.");
if (common_flags()->log_to_syslog)
- os_log_error(OS_LOG_DEFAULT, "Consult syslog for more information.");
+ SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Consult syslog for more information.");
+# undef SANITIZER_OS_LOG
// Log to syslog.
// The logging on OS X may call pthread_create so we need the threading
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
8d7ea62
to
11514ea
Compare
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.
Looks good
Looks good, thanks! Do we have |
@@ -837,22 +843,22 @@ void LogMessageOnPrintf(const char *str) { | |||
|
|||
void LogFullErrorReport(const char *buffer) { | |||
# if !SANITIZER_GO | |||
// Log with os_log_error. This will make it into the crash log. | |||
// Log with os_log.*. This will make it into the crash log. |
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.
We should probably keep the old comment if os_log()
doesn't make it into the crash log.
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.
I've updated this to say // When logging with os_log_error this will make it into the crash log.
, being as DriverKit doesn't call os_log_error
.
496cc35
to
7f1ee4d
Compare
Unfortunately not :/ |
DriverKit doesn't define
os_log_error
, so fails to build. Fallback toos_log
if on DriverKit.rdar://140295247