Loading...
libkern/coreanalytics/coreanalytics_shim.cpp xnu-12377.121.6 xnu-8796.121.2
--- xnu/xnu-12377.121.6/libkern/coreanalytics/coreanalytics_shim.cpp
+++ xnu/xnu-8796.121.2/libkern/coreanalytics/coreanalytics_shim.cpp
@@ -52,12 +52,12 @@
 	if (dict) {
 		service = IOService::waitForMatchingService(dict.get());
 	} else {
-		os_log_with_startup_serial(OS_LOG_DEFAULT, "No service matching %s\n", kCoreAnalyticsMatchingClassName);
+		os_log_with_startup_serial(OS_LOG_DEFAULT, "No service matching %s", kCoreAnalyticsMatchingClassName);
 	}
 	if (service) {
 		return service.detach();
 	} else {
-		os_log_with_startup_serial(OS_LOG_DEFAULT, "Unable to match CoreAnalyticsHub\n");
+		os_log_with_startup_serial(OS_LOG_DEFAULT, "Unable to match CoreAnalyticsHub");
 		return nullptr;
 	}
 }
@@ -170,11 +170,13 @@
 	static constexpr uint64_t kDelayBetweenRetries = 1000; // microseconds
 	core_analytics_serialized_event_t serialized;
 	if (!core_analytics_hub_functions) {
+		os_log_with_startup_serial(OS_LOG_DEFAULT, "Dropping attempt to send a CoreAnalytics event before CoreAnalyticsHub has registered.");
 		return EAGAIN;
 	}
 
 	ret = core_analytics_serialize_event(event_spec, event, &serialized);
 	if (ret != 0) {
+		os_log_with_startup_serial(OS_LOG_DEFAULT, "Unable to serialize CoreAnalytics event: %d", ret);
 		return ret;
 	}
 	for (size_t i = 0; i < kMaxRetries; i++) {
@@ -183,8 +185,10 @@
 			break;
 		} else {
 			if (i != kMaxRetries - 1) {
+				os_log_with_startup_serial(OS_LOG_DEFAULT, "Unable to send CoreAnalytics event. Delaying for %llu u.s. to see if the queue drains.", kDelayBetweenRetries);
 				delay(kDelayBetweenRetries);
 			} else {
+				os_log_with_startup_serial(OS_LOG_DEFAULT, "Unable to send CoreAnalytics event. Giving up.");
 				ret = EAGAIN;
 				break;
 			}
@@ -200,5 +204,5 @@
 		panic("CoreAnalyticsHub is out of sync with xnu. CoreAnalyticsHub table version: %d. xnu table version: %d", fns->version, CORE_ANALYTICS_FUNCTIONS_TABLE_VERSION);
 	}
 	core_analytics_hub_functions = fns;
-	os_log_with_startup_serial(OS_LOG_DEFAULT, "Registered CoreAnalyticsHub functions with xnu.\n");
-}
+	os_log_with_startup_serial(OS_LOG_DEFAULT, "Registered CoreAnalyticsHub functions with xnu.");
+}