Skip to content

Commit

Permalink
[lldb-dap] Expose log path in extension settings (llvm#103482)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vogelsgesang authored Aug 15, 2024
1 parent 91ffc12 commit 7898866
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lldb/tools/lldb-dap/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lldb/tools/lldb-dap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lldb-dap",
"displayName": "LLDB DAP",
"version": "0.2.3",
"version": "0.2.4",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://lldb.llvm.org",
"description": "LLDB debugging from VSCode",
Expand Down Expand Up @@ -73,6 +73,11 @@
"scope": "resource",
"type": "string",
"description": "The path to the lldb-dap binary."
},
"lldb-dap.log-path": {
"scope": "resource",
"type": "string",
"description": "The log path for lldb-dap (if any)"
}
}
},
Expand Down
26 changes: 21 additions & 5 deletions lldb/tools/lldb-dap/src-ts/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,29 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
session: vscode.DebugSession,
packageJSONExecutable: vscode.DebugAdapterExecutable | undefined,
): Promise<vscode.DebugAdapterExecutable | undefined> {
const path = vscode.workspace
.getConfiguration("lldb-dap", session.workspaceFolder)
.get<string>("executable-path");
const config = vscode.workspace
.getConfiguration("lldb-dap", session.workspaceFolder);
const path = config.get<string>("executable-path");
const log_path = config.get<string>("log-path");

let env : { [key: string]: string } = {};
if (log_path) {
env["LLDBDAP_LOG"] = log_path;
}

if (path) {
return new vscode.DebugAdapterExecutable(path, []);
return new vscode.DebugAdapterExecutable(path, [], {env});
} else if (packageJSONExecutable) {
return new vscode.DebugAdapterExecutable(packageJSONExecutable.command, packageJSONExecutable.args, {
...packageJSONExecutable.options,
env: {
...packageJSONExecutable.options?.env,
...env
}
});
} else {
return undefined;
}
return packageJSONExecutable;
},
};
}
Expand Down

0 comments on commit 7898866

Please sign in to comment.