Skip to content

Commit c56df37

Browse files
authored
Add disableASLR to all debug configurations (#1199)
- The original GH Actions change has this option added to build config, but not to other configurations like launch and snippet. - This causes commands that passes through debugger but disregard breakpoints like the run build command to fail in CI. - This would also show up once we have a nightly workflow going. - Both issues described above will be addressed by this PR. Issue: #1198
1 parent a4d7b0c commit c56df37

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/debugger/buildConfig.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { Version } from "../utilities/version";
2626
import { TestLibrary } from "../TestExplorer/TestRunner";
2727
import { TestKind, isDebugging, isRelease } from "../TestExplorer/TestKind";
2828
import { buildOptions } from "../tasks/SwiftTaskProvider";
29+
import { CI_DISABLE_ASLR } from "./lldb";
2930

3031
export class BuildConfigurationFactory {
3132
public static buildAll(
@@ -649,13 +650,7 @@ function getBaseConfig(ctx: FolderContext, expandEnvVariables: boolean) {
649650
args: [],
650651
preLaunchTask: `swift: Build All${nameSuffix}`,
651652
terminal: "console",
652-
// DisableASLR when running in Docker CI https://stackoverflow.com/a/78471987
653-
...(process.env["CI"]
654-
? {
655-
disableASLR: false,
656-
initCommands: ["settings set target.disable-aslr false"],
657-
}
658-
: {}),
653+
...CI_DISABLE_ASLR,
659654
};
660655
}
661656

src/debugger/launch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { stringArrayInEnglish, swiftLibraryPathKey, swiftRuntimeEnv } from "../u
2020
import { DebugAdapter } from "./debugAdapter";
2121
import { getFolderAndNameSuffix } from "./buildConfig";
2222
import configuration from "../configuration";
23+
import { CI_DISABLE_ASLR } from "./lldb";
2324

2425
/**
2526
* Edit launch.json based on contents of Swift Package.
@@ -123,6 +124,7 @@ function createExecutableConfigurations(ctx: FolderContext): vscode.DebugConfigu
123124
args: [],
124125
cwd: folder,
125126
env: swiftRuntimeEnv(true),
127+
...CI_DISABLE_ASLR,
126128
};
127129
return [
128130
{
@@ -162,6 +164,7 @@ export function createSnippetConfiguration(
162164
args: [],
163165
cwd: folder,
164166
env: swiftRuntimeEnv(true),
167+
...CI_DISABLE_ASLR,
165168
};
166169
}
167170

src/debugger/lldb.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ import { execFile, getErrorDescription } from "../utilities/utilities";
2323
import { Result } from "../utilities/result";
2424
import { SwiftToolchain } from "../toolchain/toolchain";
2525

26+
export const CI_DISABLE_ASLR =
27+
// DisableASLR when running in Docker CI https://stackoverflow.com/a/78471987
28+
process.env["CI"]
29+
? {
30+
disableASLR: false,
31+
initCommands: ["settings set target.disable-aslr false"],
32+
}
33+
: {};
34+
2635
/**
2736
* Get LLDB library for given LLDB executable
2837
* @param executable LLDB executable

0 commit comments

Comments
 (0)