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 22
22
#include " swift/Runtime/Config.h"
23
23
#include < os/signpost.h>
24
24
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
26
32
27
33
namespace swift {
28
34
namespace runtime {
@@ -40,6 +46,15 @@ static inline bool shouldEnableTracing() {
40
46
return true ;
41
47
}
42
48
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
+
43
58
} // namespace trace
44
59
} // namespace runtime
45
60
} // namespace swift
Original file line number Diff line number Diff line change 17
17
#if SWIFT_STDLIB_CONCURRENCY_TRACING
18
18
19
19
#include " TracingSignpost.h"
20
- #include " swift/Runtime/TracingCommon.h"
21
20
#include < stdio.h>
22
21
23
22
#define SWIFT_LOG_CONCURRENCY_SUBSYSTEM " com.apple.swift.concurrency"
Original file line number Diff line number Diff line change 23
23
#include " swift/Basic/Lazy.h"
24
24
#include " swift/Runtime/Casting.h"
25
25
#include " swift/Runtime/HeapObject.h"
26
+ #include " swift/Runtime/TracingCommon.h"
26
27
#include < inttypes.h>
27
28
#include < os/log.h>
28
29
#include < os/signpost.h>
@@ -79,6 +80,8 @@ void setupLogs(void *unused);
79
80
// optimized out.
80
81
#define ENSURE_LOGS (...) \
81
82
do { \
83
+ if (!runtime::trace::tracingReady ()) \
84
+ return __VA_ARGS__; \
82
85
swift::once (LogsToken, setupLogs, nullptr ); \
83
86
if (!TracingEnabled) \
84
87
return __VA_ARGS__; \
Original file line number Diff line number Diff line change 15
15
// ===----------------------------------------------------------------------===//
16
16
17
17
#include " Tracing.h"
18
- #include " swift/Runtime/TracingCommon.h"
19
18
20
19
#if SWIFT_STDLIB_TRACING
21
20
Original file line number Diff line number Diff line change 20
20
#include " llvm/ADT/StringRef.h"
21
21
#include " swift/ABI/Metadata.h"
22
22
#include " swift/Demangling/Demangler.h"
23
+ #include " swift/Runtime/TracingCommon.h"
23
24
24
25
#if SWIFT_STDLIB_TRACING
25
26
#include < os/signpost.h>
@@ -49,6 +50,8 @@ void setupLogs(void *unused);
49
50
// optimized out.
50
51
#define ENSURE_LOG (log ) \
51
52
do { \
53
+ if (!tracingReady ()) \
54
+ return {}; \
52
55
swift::once (LogsToken, setupLogs, nullptr ); \
53
56
if (!TracingEnabled) \
54
57
return {}; \
You can’t perform that action at this time.
0 commit comments