Skip to content

Commit 39cda11

Browse files
committed
Deserialize all modules with the default resilience strategy when in LLDB
This turns all resilient types into fixed layouts thus allowing LLDB to query their size. The long-term plan is to use remote mirrors for this unformation instead of swift IRGen, but the library is not yet up to the task. rdar://problem/36663932
1 parent e64d810 commit 39cda11

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ FileUnit *SerializedModuleLoader::loadAST(
200200
isFramework, loadedModuleFile,
201201
&extendedInfo);
202202
if (loadInfo.status == serialization::Status::Valid) {
203-
M.setResilienceStrategy(extendedInfo.getResilienceStrategy());
203+
// In LLDB always use the default resilience strategy, so IRGen can query
204+
// the size of resilient types.
205+
if (!Ctx.LangOpts.DebuggerSupport)
206+
M.setResilienceStrategy(extendedInfo.getResilienceStrategy());
204207

205208
// We've loaded the file. Now try to bring it into the AST.
206209
auto fileUnit = new (Ctx) SerializedASTFile(M, *loadedModuleFile,

test/DebugInfo/resilience.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
// RUN: %empty-directory(%t)
2+
//
3+
// Compile the external swift module.
24
// RUN: %target-swift-frontend -g -emit-module -enable-resilience \
35
// RUN: -emit-module-path=%t/resilient_struct.swiftmodule \
46
// RUN: -module-name=resilient_struct %S/../Inputs/resilient_struct.swift
5-
// RUN: %target-swift-frontend -g -I %t -emit-ir -enable-resilience %s \
6-
// RUN: | %FileCheck %s
7+
//
8+
// RUN: %target-swift-frontend -g -I %t -emit-ir -enable-resilience %s -o - \
9+
// RUN: | %FileCheck %s
10+
//
11+
// RUN: %target-swift-frontend -g -I %t -emit-sil -enable-resilience %s -o - \
12+
// RUN: | %FileCheck %s --check-prefix=CHECK-SIL
13+
// RUN: %target-swift-frontend -g -I %t -emit-sil -enable-resilience %s -o - \
14+
// RUN: -debugger-support | %FileCheck %s --check-prefix=CHECK-LLDB
715
import resilient_struct
816

917
func use<T>(_ t: T) {}
@@ -23,3 +31,9 @@ public func f() {
2331
// FIXME-NOT: size:
2432
// CHECK: =
2533
}
34+
35+
// CHECK-SIL: // f()
36+
// CHECK-LLDB: // f()
37+
// CHECK-SIL: %0 = alloc_stack $Size, let, name "s1"
38+
// CHECK-LLDB: %0 = metatype $@thin Size.Type
39+
// CHECK-LLDB: debug_value %{{.*}} : $Size, let, name "s1"

0 commit comments

Comments
 (0)