Skip to content

Commit 7898866

Browse files
authored
[lldb-dap] Expose log path in extension settings (#103482)
lldb-dap already supports a log file which can be enabled by setting the `LLDBDAP_LOG` environment variable. With this commit, the log location can be set directly through the VS-Code extension settings. Also, this commit bumps the version number, such that the new VS Code extension gets published to the Marketplace.
1 parent 91ffc12 commit 7898866

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

lldb/tools/lldb-dap/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lldb/tools/lldb-dap/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lldb-dap",
33
"displayName": "LLDB DAP",
4-
"version": "0.2.3",
4+
"version": "0.2.4",
55
"publisher": "llvm-vs-code-extensions",
66
"homepage": "https://lldb.llvm.org",
77
"description": "LLDB debugging from VSCode",
@@ -73,6 +73,11 @@
7373
"scope": "resource",
7474
"type": "string",
7575
"description": "The path to the lldb-dap binary."
76+
},
77+
"lldb-dap.log-path": {
78+
"scope": "resource",
79+
"type": "string",
80+
"description": "The log path for lldb-dap (if any)"
7681
}
7782
}
7883
},

lldb/tools/lldb-dap/src-ts/extension.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,29 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
1414
session: vscode.DebugSession,
1515
packageJSONExecutable: vscode.DebugAdapterExecutable | undefined,
1616
): Promise<vscode.DebugAdapterExecutable | undefined> {
17-
const path = vscode.workspace
18-
.getConfiguration("lldb-dap", session.workspaceFolder)
19-
.get<string>("executable-path");
17+
const config = vscode.workspace
18+
.getConfiguration("lldb-dap", session.workspaceFolder);
19+
const path = config.get<string>("executable-path");
20+
const log_path = config.get<string>("log-path");
21+
22+
let env : { [key: string]: string } = {};
23+
if (log_path) {
24+
env["LLDBDAP_LOG"] = log_path;
25+
}
26+
2027
if (path) {
21-
return new vscode.DebugAdapterExecutable(path, []);
28+
return new vscode.DebugAdapterExecutable(path, [], {env});
29+
} else if (packageJSONExecutable) {
30+
return new vscode.DebugAdapterExecutable(packageJSONExecutable.command, packageJSONExecutable.args, {
31+
...packageJSONExecutable.options,
32+
env: {
33+
...packageJSONExecutable.options?.env,
34+
...env
35+
}
36+
});
37+
} else {
38+
return undefined;
2239
}
23-
return packageJSONExecutable;
2440
},
2541
};
2642
}

0 commit comments

Comments
 (0)