Author: John Harrison Date: 2025-03-12T10:43:09-07:00 New Revision: f62e168d3f1ddbeff408d8f7ff1dd0fc0cd70029
URL: https://github.com/llvm/llvm-project/commit/f62e168d3f1ddbeff408d8f7ff1dd0fc0cd70029 DIFF: https://github.com/llvm/llvm-project/commit/f62e168d3f1ddbeff408d8f7ff1dd0fc0cd70029.diff LOG: [lldb-dap] Validate server mode support prior to invoking lldb-dap. (#130855) This should ensure the extension only uses server mode if the binary supports the feature, otherwise it will fallback to the existing behavior. Fixes #130854 Added: Modified: lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts Removed: ################################################################################ diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts index 1f76fe31b00ad..c2244dcbde8f2 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts @@ -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. @@ -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); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits