================
@@ -115,41 +123,71 @@ export class LLDBDapDescriptorFactory
}
const configEnvironment =
config.get<{ [key: string]: string }>("environment") || {};
- const dapPath = await getDAPExecutable(session);
+ const dapPath = (await getDAPExecutable(session)) ?? executable?.command;
+
+ if (!dapPath) {
+ LLDBDapDescriptorFactory.showLLDBDapNotFoundMessage();
+ return undefined;
+ }
+
+ if (!(await isExecutable(dapPath))) {
+ LLDBDapDescriptorFactory.showLLDBDapNotFoundMessage(dapPath);
+ return;
+ }
+
const dbgOptions = {
env: {
...executable?.options?.env,
...configEnvironment,
...env,
},
};
- if (dapPath) {
- if (!(await isExecutable(dapPath))) {
- LLDBDapDescriptorFactory.showLLDBDapNotFoundMessage(dapPath);
- return undefined;
- }
- return new vscode.DebugAdapterExecutable(dapPath, [], dbgOptions);
- } else if (executable) {
- if (!(await isExecutable(executable.command))) {
-
LLDBDapDescriptorFactory.showLLDBDapNotFoundMessage(executable.command);
- return undefined;
- }
- return new vscode.DebugAdapterExecutable(
- executable.command,
- executable.args,
- dbgOptions,
- );
+ const dbgArgs = executable?.args ?? [];
+
+ const serverMode = config.get<boolean>('serverMode', false);
+ if (serverMode) {
+ const { host, port } = await this.startServer(dapPath, dbgArgs,
dbgOptions);
+ return new vscode.DebugAdapterServer(port, host);
}
- return undefined;
+
+ return new vscode.DebugAdapterExecutable(dapPath, dbgArgs, dbgOptions);
+ }
+
+ startServer(dapPath: string, args: string[], options:
child_process.CommonSpawnOptions): Promise<{ host: string, port: number }> {
+ if (this.server) return this.server;
----------------
vogelsgesang wrote:
afaict, this does not work correctly in combination with #126803. We might end
up reusing the wrong lldb-dap binary
Not sure what this means for us, though... We also can't just kill the old
server when we receive a different lldb-dap path, because we could have two
separate debugging sessions running at the same time, each one using a
different server binary. I guess the most robust solution would be to use a
`Map` to associate each lldb-dap path with its own `Promise<{ process:
child_process.ChildProcess, host: string, port: number }>`?
https://github.com/llvm/llvm-project/pull/128957
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits