Skip to content

[lldb-dap] Expose log path in extension settings #103482

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
Aug 15, 2024
Merged
Show file tree
Hide file tree
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
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
Loading