Skip to content

Commit 8225938

Browse files
authored
[lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (llvm#112260)
Remove support for ASL (Apple System Log) which has been deprecated since macOS 10.12. Fixes the following warnings: warning: 'asl_new' is deprecated: first deprecated in macOS 10.12 - os_log(3) has replaced asl(3) warning: 'asl_set' is deprecated: first deprecated in macOS 10.12 - os_log(3) has replaced asl(3) warning: 'asl_vlog' is deprecated: first deprecated in macOS 10.12 - os_log(3) has replaced asl(3)
1 parent 6539481 commit 8225938

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

lldb/tools/debugserver/source/debugserver.cpp

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -759,35 +759,6 @@ static int ConnectRemote(RNBRemote *remote, const char *host, int port,
759759
return 1;
760760
}
761761

762-
// ASL Logging callback that can be registered with DNBLogSetLogCallback
763-
void ASLLogCallback(void *baton, uint32_t flags, const char *format,
764-
va_list args) {
765-
if (format == NULL)
766-
return;
767-
static aslmsg g_aslmsg = NULL;
768-
if (g_aslmsg == NULL) {
769-
g_aslmsg = ::asl_new(ASL_TYPE_MSG);
770-
char asl_key_sender[PATH_MAX];
771-
snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.%s-%s",
772-
DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR);
773-
::asl_set(g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
774-
}
775-
776-
int asl_level;
777-
if (flags & DNBLOG_FLAG_FATAL)
778-
asl_level = ASL_LEVEL_CRIT;
779-
else if (flags & DNBLOG_FLAG_ERROR)
780-
asl_level = ASL_LEVEL_ERR;
781-
else if (flags & DNBLOG_FLAG_WARNING)
782-
asl_level = ASL_LEVEL_WARNING;
783-
else if (flags & DNBLOG_FLAG_VERBOSE)
784-
asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_INFO;
785-
else
786-
asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_DEBUG;
787-
788-
::asl_vlog(NULL, g_aslmsg, asl_level, format, args);
789-
}
790-
791762
// FILE based Logging callback that can be registered with
792763
// DNBLogSetLogCallback
793764
void FileLogCallback(void *baton, uint32_t flags, const char *format,
@@ -948,16 +919,8 @@ int main(int argc, char *argv[]) {
948919
// Set up DNB logging by default. If the user passes different log flags or a
949920
// log file, these settings will be modified after processing the command line
950921
// arguments.
951-
auto log_callback = OsLogger::GetLogFunction();
952-
if (log_callback) {
953-
// if os_log() support is available, log through that.
922+
if (auto log_callback = OsLogger::GetLogFunction())
954923
DNBLogSetLogCallback(log_callback, nullptr);
955-
DNBLog("debugserver will use os_log for internal logging.");
956-
} else {
957-
// Fall back to ASL support.
958-
DNBLogSetLogCallback(ASLLogCallback, nullptr);
959-
DNBLog("debugserver will use ASL for internal logging.");
960-
}
961924
DNBLogSetLogMask(/*log_flags*/ 0);
962925

963926
g_remoteSP = std::make_shared<RNBRemote>();

0 commit comments

Comments
 (0)