Skip to content

[lldb-dap] Validate server mode support prior to invoking lldb-dap. #130855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ async function getDAPExecutable(
return undefined;
}

async function isServerModeSupported(exe: string): Promise<boolean> {
const { stdout } = await exec(exe, ['--help']);
return /--connection/.test(stdout);
}

/**
* This class defines a factory used to find the lldb-dap binary to use
* depending on the session configuration.
Expand Down Expand Up @@ -145,7 +150,7 @@ export class LLDBDapDescriptorFactory
const dbgArgs = executable?.args ?? [];

const serverMode = config.get<boolean>('serverMode', false);
if (serverMode) {
if (serverMode && await isServerModeSupported(dapPath)) {
const { host, port } = await this.startServer(dapPath, dbgArgs, dbgOptions);
return new vscode.DebugAdapterServer(port, host);
}
Expand Down