[Lldb-commits] [lldb] Fix lldb-dap pickProcess command for selecting process for debugger attachment (PR #75342)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 13 06:14:20 PST 2023
https://github.com/Dodzey created https://github.com/llvm/llvm-project/pull/75342
Hi,
I see that the documentation for lldb-dap refers to a ${command.pickMyProcess} which can be used for interactive process selection within the VS Code IDE. It appears that this functionality no longer works, perhaps due to internal changes in VS Code.
I can get interactive process selection if I add the following snippet to the lldp-dap extension package.json:
```
"variables": {
"pickProcess": "extension.pickNativeProcess"
},
```
However, referencing extension.pickNativeProcess here is only valid if the Microsoft VSCode CPPTools extension is installed, as that is the extension that registers a native process picker under the name 'extension.pickNativeProcess' I'm not sure if it's desirable behaviour for the lldb-dap extension to be dependent on the presence of the Microsoft CPPTools extension?
It appears (although I am not familiar with VSCode extension development) that any solution to this that was fully integrated in the lldp-dap extension would require typescript source to be added to the extension in order to register a private native process picker under a custom name - something like `extension.lldb-dap.pickNativeProcess`. I would assume that this implementation would look very similar, if not identical to the command currently exposed by the Microsoft CPPTools extension.
In the PR I have included the minimal changes required to seemingly make the process picker work when the Microsoft VSCode CPPTools extension is also installed.
What are the recommendations on how we could proceed here?
Thanks!
>From fbfc8a6d17f3cb4a7e2b583cb985b27d2cc597f3 Mon Sep 17 00:00:00 2001
From: Dodzey <Dodzey at users.noreply.github.com>
Date: Wed, 13 Dec 2023 13:57:28 +0000
Subject: [PATCH 1/2] Add variable mapping for pickProcess command
---
lldb/tools/lldb-dap/package.json | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lldb/tools/lldb-dap/package.json b/lldb/tools/lldb-dap/package.json
index ebb1103d695e17..7b77b32f890a6f 100644
--- a/lldb/tools/lldb-dap/package.json
+++ b/lldb/tools/lldb-dap/package.json
@@ -124,6 +124,9 @@
"swift"
]
},
+ "variables": {
+ "pickProcess": "extension.pickNativeProcess"
+ },
"program": "./bin/lldb-dap",
"windows": {
"program": "./bin/lldb-dap.exe"
>From 6b79c1937875f0171e259d6eea7c397e5cfd69f4 Mon Sep 17 00:00:00 2001
From: Dodzey <Dodzey at users.noreply.github.com>
Date: Wed, 13 Dec 2023 13:58:14 +0000
Subject: [PATCH 2/2] Update README.md
---
lldb/tools/lldb-dap/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md
index 00ceb0bedc40a4..d341a136293a87 100644
--- a/lldb/tools/lldb-dap/README.md
+++ b/lldb/tools/lldb-dap/README.md
@@ -125,7 +125,7 @@ The JSON configuration file can contain the following `lldb-dap` specific launch
|**type** |string |Y| Must be "lldb-dap".
|**request** |string |Y| Must be "attach".
|**program** |string | | Path to the executable to attach to. This value is optional but can help to resolve breakpoints prior the attaching to the program.
-|**pid** |number | | The process id of the process you wish to attach to. If **pid** is omitted, the debugger will attempt to attach to the program by finding a process whose file name matches the file name from **porgram**. Setting this value to `${command:pickMyProcess}` will allow interactive process selection in the IDE.
+|**pid** |number | | The process id of the process you wish to attach to. If **pid** is omitted, the debugger will attempt to attach to the program by finding a process whose file name matches the file name from **program**. Setting this value to `${command:pickProcess}` will allow interactive process selection in the IDE.
|**stopOnEntry** |boolean| | Whether to stop program immediately after launching.
|**waitFor** |boolean | | Wait for the process to launch.
|**initCommands** |[string]| | LLDB commands executed upon debugger startup prior to creating the LLDB target. Commands and command output will be sent to the debugger console when they are executed.
More information about the lldb-commits
mailing list