Skip to content

Commit bfdcd94

Browse files
tell the user if lldb-dap doesn't exist when a debug session is started
1 parent 7d64c21 commit bfdcd94

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,19 @@ export class LLDBDapConfigurationProvider
3838
);
3939
}
4040

41-
if (
42-
"debugAdapterPort" in debugConfiguration &&
43-
("debugAdapterExecutable" in debugConfiguration ||
44-
"debugAdapterArgs" in debugConfiguration)
45-
) {
46-
return showErrorWithConfigureButton(
47-
"The debugAdapterPort property is incompatible with debugAdapterExecutable and debugAdapterArgs. Please update your launch configuration.",
48-
);
49-
}
50-
51-
// Server mode needs to be handled here since DebugAdapterDescriptorFactory
52-
// will show an unhelpful error if it returns undefined. We'd rather show a
53-
// nicer error message here and allow stopping the debug session gracefully.
54-
const config = vscode.workspace.getConfiguration("lldb-dap", folder);
55-
if (config.get<boolean>("serverMode", false)) {
41+
// Check if we're going to launch a debug session or use an existing process
42+
if ("debugAdapterPort" in debugConfiguration) {
43+
if (
44+
"debugAdapterExecutable" in debugConfiguration ||
45+
"debugAdapterArgs" in debugConfiguration
46+
) {
47+
return showErrorWithConfigureButton(
48+
"The debugAdapterPort property is incompatible with debugAdapterExecutable and debugAdapterArgs. Please update your launch configuration.",
49+
);
50+
}
51+
} else {
52+
// Always try to create the debug adapter executable as this will show the user errors
53+
// if there are any.
5654
const executable = await createDebugAdapterExecutable(
5755
folder,
5856
debugConfiguration,
@@ -61,7 +59,15 @@ export class LLDBDapConfigurationProvider
6159
if (!executable) {
6260
return undefined;
6361
}
64-
if (await isServerModeSupported(executable.command)) {
62+
63+
// Server mode needs to be handled here since DebugAdapterDescriptorFactory
64+
// will show an unhelpful error if it returns undefined. We'd rather show a
65+
// nicer error message here and allow stopping the debug session gracefully.
66+
const config = vscode.workspace.getConfiguration("lldb-dap", folder);
67+
if (
68+
config.get<boolean>("serverMode", false) &&
69+
(await isServerModeSupported(executable.command))
70+
) {
6571
const serverInfo = await this.server.start(
6672
executable.command,
6773
executable.args,

0 commit comments

Comments
 (0)