File tree Expand file tree Collapse file tree 5 files changed +22
-3
lines changed Expand file tree Collapse file tree 5 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 2222#include " swift/Runtime/Config.h"
2323#include < os/signpost.h>
2424
25- extern const char *__progname;
25+ extern " C" const char *__progname;
26+
27+ // This function may not be present when building at desk, and isn't really
28+ // needed there, so just skip it in that case.
29+ #if SWIFT_BNI_OS_BUILD
30+ extern " C" bool _os_trace_lazy_init_completed_4swift (void );
31+ #endif
2632
2733namespace swift {
2834namespace runtime {
@@ -40,6 +46,15 @@ static inline bool shouldEnableTracing() {
4046 return true ;
4147}
4248
49+ static inline bool tracingReady () {
50+ #if SWIFT_BNI_OS_BUILD
51+ if (!_os_trace_lazy_init_completed_4swift ())
52+ return false ;
53+ #endif
54+
55+ return true ;
56+ }
57+
4358} // namespace trace
4459} // namespace runtime
4560} // namespace swift
Original file line number Diff line number Diff line change 1717#if SWIFT_STDLIB_CONCURRENCY_TRACING
1818
1919#include " TracingSignpost.h"
20- #include " swift/Runtime/TracingCommon.h"
2120#include < stdio.h>
2221
2322#define SWIFT_LOG_CONCURRENCY_SUBSYSTEM " com.apple.swift.concurrency"
Original file line number Diff line number Diff line change 2323#include " swift/Basic/Lazy.h"
2424#include " swift/Runtime/Casting.h"
2525#include " swift/Runtime/HeapObject.h"
26+ #include " swift/Runtime/TracingCommon.h"
2627#include < inttypes.h>
2728#include < os/log.h>
2829#include < os/signpost.h>
@@ -79,6 +80,8 @@ void setupLogs(void *unused);
7980// optimized out.
8081#define ENSURE_LOGS (...) \
8182 do { \
83+ if (!runtime::trace::tracingReady ()) \
84+ return __VA_ARGS__; \
8285 swift::once (LogsToken, setupLogs, nullptr ); \
8386 if (!TracingEnabled) \
8487 return __VA_ARGS__; \
Original file line number Diff line number Diff line change 1515// ===----------------------------------------------------------------------===//
1616
1717#include " Tracing.h"
18- #include " swift/Runtime/TracingCommon.h"
1918
2019#if SWIFT_STDLIB_TRACING
2120
Original file line number Diff line number Diff line change 2020#include " llvm/ADT/StringRef.h"
2121#include " swift/ABI/Metadata.h"
2222#include " swift/Demangling/Demangler.h"
23+ #include " swift/Runtime/TracingCommon.h"
2324
2425#if SWIFT_STDLIB_TRACING
2526#include < os/signpost.h>
@@ -49,6 +50,8 @@ void setupLogs(void *unused);
4950// optimized out.
5051#define ENSURE_LOG (log ) \
5152 do { \
53+ if (!tracingReady ()) \
54+ return {}; \
5255 swift::once (LogsToken, setupLogs, nullptr ); \
5356 if (!TracingEnabled) \
5457 return {}; \
You can’t perform that action at this time.
0 commit comments