Skip to content

Commit 21e09ed

Browse files
compnerdadam-fowler
authored andcommitted
debugger: pass along SDKROOT for the launch of the debugger
This is used by the debugger to locate the Swift module information for the debugger. Without this, we would fail to setup the Swift scratch space in LLDB, which then results in the failure of the debugger and subsequently the DAP. Fixes: #250
1 parent ebba42b commit 21e09ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/debugger/launch.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,18 @@ export function createTestConfiguration(
183183
if (xcTestPath !== runtimePath) {
184184
testEnv.Path = `${xcTestPath};${testEnv.Path}`;
185185
}
186+
const sdkroot = configuration.sdk === "" ? process.env.SDKROOT : configuration.sdk;
187+
if (sdkroot === undefined) {
188+
return null;
189+
}
186190
return {
187191
type: "lldb",
188192
request: "launch",
189193
name: `Test ${ctx.swiftPackage.name}`,
190194
program: `${folder}/.build/debug/${ctx.swiftPackage.name}PackageTests.xctest`,
191195
cwd: folder,
192196
env: testEnv,
197+
preRunCommands: [`settings set target.sdk-path ${sdkroot}`],
193198
preLaunchTask: `swift: Build All${nameSuffix}`,
194199
};
195200
} else {

0 commit comments

Comments
 (0)