mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-31 14:15:12 +00:00
[Darwin] Switch to new logging api for sanitizers
Switch to new logging api added in [[ https://developer.apple.com/documentation/os/os_log_error | macOS 10.12 ]] that is more memory safe and enables us to label the log messages in the future. Falls back to old API if ran on older OS versions. Commited by Dan Liew on behalf of Emily Shi. rdar://25181524 Reviewed By: delcypher, yln Differential Revision: https://reviews.llvm.org/D95977
This commit is contained in:
parent
8d4cd2da1f
commit
039567b664
@ -62,6 +62,7 @@ extern "C" {
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach/vm_statistics.h>
|
||||
#include <malloc/malloc.h>
|
||||
#include <os/log.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
@ -770,7 +771,11 @@ static BlockingMutex syslog_lock(LINKER_INITIALIZED);
|
||||
void WriteOneLineToSyslog(const char *s) {
|
||||
#if !SANITIZER_GO
|
||||
syslog_lock.CheckLocked();
|
||||
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s);
|
||||
if (GetMacosAlignedVersion() >= MacosVersion(10, 12)) {
|
||||
os_log_error(OS_LOG_DEFAULT, "%{public}s", s);
|
||||
} else {
|
||||
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user