Skip to content

Commit 4f43ce9

Browse files
committed
[Concurrency] Add a debug variable that holds the current version of the concurrency library.
This allows lldb to know which version of the internals layout it needs to use. rdar://135886268
1 parent 380f319 commit 4f43ce9

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

include/swift/ABI/Actor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
#include "swift/ABI/HeapObject.h"
2121
#include "swift/ABI/MetadataValues.h"
2222

23+
// lldb knows about some of these internals. If you change things that lldb
24+
// knows about (or might know about in the future, as a future lldb might be
25+
// inspecting a process running an older Swift runtime), increment
26+
// _swift_concurrency_debug_internal_layout_version and add a comment describing
27+
// the new version.
28+
2329
namespace swift {
2430

2531
/// The default actor implementation. This is the layout of both

include/swift/ABI/Task.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class TaskOptionRecord;
4343
class TaskGroup;
4444
class ContinuationAsyncContext;
4545

46+
// lldb knows about some of these internals. If you change things that lldb
47+
// knows about (or might know about in the future, as a future lldb might be
48+
// inspecting a process running an older Swift runtime), increment
49+
// _swift_concurrency_debug_internal_layout_version and add a comment describing
50+
// the new version.
51+
4652
extern FullMetadata<DispatchClassMetadata> jobHeapMetadata;
4753

4854
/// A schedulable job.

stdlib/public/Concurrency/Debug.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ const void *const _swift_concurrency_debug_task_future_wait_resume_adapter;
4949
SWIFT_EXPORT_FROM(swift_Concurrency)
5050
bool _swift_concurrency_debug_supportsPriorityEscalation;
5151

52+
/// The current version of internal data structures that lldb may decode.
53+
/// The version numbers used so far are:
54+
/// 1 - The initial version number when this variable was added, in swift 6.1.
55+
SWIFT_EXPORT_FROM(swift_Concurrency)
56+
uint32_t _swift_concurrency_debug_internal_layout_version;
57+
5258
} // namespace swift
5359

5460
#endif

stdlib/public/Concurrency/Task.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ const void *const swift::_swift_concurrency_debug_asyncTaskSlabMetadata =
8787
bool swift::_swift_concurrency_debug_supportsPriorityEscalation =
8888
SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION;
8989

90+
uint32_t swift::_swift_concurrency_debug_internal_layout_version = 1;
91+
9092
void FutureFragment::destroy() {
9193
auto queueHead = waitQueue.load(std::memory_order_acquire);
9294
switch (queueHead.getStatus()) {

0 commit comments

Comments
 (0)