You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb-dap] Separate user and developer documentation (#92428)
The README.md is what users see when they look for the extension in the
Marketplace [1]. Right now, it's a mix of developer documentation (for
us) and user documentation. This commit moves the developer docs into
`docs` and the lldb website and refocuses the README on using the
extension.
[1] https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.lldb-dap
The `lldb-dap` tool (formerly `lldb-vscode`) creates a command line tool that
29
-
implements the [Debug Adapter
30
-
Protocol](https://microsoft.github.io/debug-adapter-protocol/). It can be
31
-
installed as an extension for Visual Studio Code and other IDEs supporting DAP.
3
+
## `lldb-dap` Configurations
4
+
5
+
The extension requires the `lldb-dap` (formerly `lldb-vscode`) binary. It is a
6
+
command line tool that implements the [Debug Adapter
7
+
Protocol](https://microsoft.github.io/debug-adapter-protocol/). It is used to power the Visual Studio Code extension but can also be used with other IDEs and editors that support DAP.
32
8
The protocol is easy to run remotely and also can allow other tools and IDEs to
33
9
get a full featured debugger with a well defined protocol.
34
10
35
-
# Local Installation for Visual Studio Code
36
-
37
-
Installing the plug-in is very straightforward and involves just a few steps.
38
-
39
-
## Pre-requisites
40
-
41
-
- Install a modern version of node (e.g. `v20.0.0`).
42
-
- On VS Code, execute the command `Install 'code' command in PATH`. You need to
43
-
do it only once. This enables the command `code` in the PATH.
44
-
45
-
## Packaging and installation
46
-
47
-
```bash
48
-
cd /path/to/lldb/tools/lldb-dap
49
-
npm install
50
-
npm run package # This also compiles the extension.
51
-
npm run vscode-install
52
-
```
53
-
54
-
On VS Code, set the setting `lldb-dap.executable-path` to the path of your local
55
-
build of `lldb-dap`.
56
-
57
-
And then you are ready!
58
-
59
-
## Updating the extension
60
-
61
-
*Note: It's not necessary to update the extension if there has been changes
62
-
to `lldb-dap`. The extension needs to be updated only if the TypesScript code
63
-
has changed.*
64
-
65
-
Updating the extension is pretty much the same process as installing it from
66
-
scratch. However, VS Code expects the version number of the upgraded extension
67
-
to be greater than the previous one, otherwise the installation step might have
68
-
no effect.
69
-
70
-
```bash
71
-
# Bump version in package.json
72
-
cd /path/to/lldb/tools/lldb-dap
73
-
npm install
74
-
npm run package
75
-
npm run vscode-install
76
-
```
77
-
78
-
Another way upgrade without bumping the extension version is to first uninstall
79
-
the extension, then reload VS Code, and then install it again. This is
80
-
an unfortunate limitation of the editor.
81
-
82
-
```bash
83
-
cd /path/to/lldb/tools/lldb-dap
84
-
npm run vscode-uninstall
85
-
# Then reload VS Code: reopen the IDE or execute the `Developer: Reload Window`
86
-
# command.
87
-
npm run package
88
-
npm run vscode-install
89
-
```
90
-
91
-
## Deploying for Visual Studio Code
92
-
93
-
The easiest way to deploy the extension for execution on other machines requires
94
-
copying `lldb-dap` and its dependencies into a`./bin` subfolder and then create a
95
-
standalone VSIX package.
96
-
97
-
```bash
98
-
cd /path/to/lldb/tools/lldb-dap
99
-
mkdir -p ./bin
100
-
cp /path/to/a/built/lldb-dap ./bin/
101
-
cp /path/to/a/built/liblldb.so ./bin/
102
-
npm run package
103
-
```
104
-
105
-
This will produce the file `./out/lldb-dap.vsix` that can be distributed. In
106
-
this type of installation, users don't need to manually set the path to
107
-
`lldb-dap`. The extension will automatically look for it in the `./bin`
108
-
subfolder.
109
-
110
-
*Note: It's not possible to use symlinks to `lldb-dap`, as the packaging tool
111
-
forcefully performs a deep copy of all symlinks.*
112
-
113
-
*Note: It's possible to use this kind flow for local installations, but it's
114
-
not recommended because updating `lldb-dap` requires rebuilding the extension.*
115
-
116
-
# Formatting the Typescript code
117
-
118
-
This is also very simple, just run:
119
-
120
-
```bash
121
-
npm run format
122
-
```
123
-
124
-
# Configurations
11
+
## Launching & Attaching Configuration
125
12
126
-
Launching to attaching require you to create a [launch configuration](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations). This file
127
-
defines arguments that get passed to `lldb-dap` and the configuration settings
128
-
control how the launch or attach happens.
13
+
Launching to attaching require you to create a [launch configuration](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations).
14
+
This file defines arguments that get passed to `lldb-dap` and the configuration settings control how the launch or attach happens.
129
15
130
-
## Launch Configuration Settings
16
+
###Launch Configuration Settings
131
17
132
18
When you launch a program with Visual Studio Code you will need to create a [launch.json](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations)
133
19
file that defines how your program will be run. The JSON configuration file can contain the following `lldb-dap` specific launch key/value pairs:
@@ -151,7 +37,7 @@ file that defines how your program will be run. The JSON configuration file can
151
37
|**sourceMap** |[string[2]]| | Specify an array of path re-mappings. Each element in the array must be a two element array containing a source and destination pathname.
152
38
|**debuggerRoot** | string| |Specify a working directory to use when launching lldb-dap. If the debug information in your executable contains relative paths, this option can be used so that `lldb-dap` can find source files and object files that have relative paths.
153
39
154
-
## Attaching Settings
40
+
###Attaching Settings
155
41
156
42
When attaching to a process using LLDB you can attach in a few ways
157
43
@@ -177,9 +63,9 @@ The JSON configuration file can contain the following `lldb-dap` specific launch
177
63
|**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends. Commands and command output will be sent to the debugger console when they are executed.
178
64
|**attachCommands** |[string]| | LLDB commands that will be executed after **preRunCommands** which take place of the code that normally does the attach. The commands can create a new target and attach or launch it however desired. This allows custom launch and attach configurations. Core files can use `target create --core /path/to/core` to attach to core files.
179
65
180
-
## Example configurations
66
+
###Example configurations
181
67
182
-
### Launching
68
+
####Launching
183
69
184
70
This will launch `/tmp/a.out` with arguments `one`, `two`, and `three` and
185
71
adds `FOO=1` and `bar` to the environment:
@@ -195,7 +81,7 @@ adds `FOO=1` and `bar` to the environment:
195
81
}
196
82
```
197
83
198
-
### Attach using PID
84
+
####Attach using PID
199
85
200
86
This will attach to a process `a.out` whose process ID is 123:
201
87
@@ -209,7 +95,7 @@ This will attach to a process `a.out` whose process ID is 123:
209
95
}
210
96
```
211
97
212
-
### Attach by Name
98
+
####Attach by Name
213
99
214
100
This will attach to an existing process whose base
215
101
name matches `a.out`. All we have to do is leave the `pid` value out of the
@@ -240,7 +126,7 @@ to be launched you can add the "waitFor" key value pair:
240
126
This will work as long as the architecture, vendor and OS supports waiting
241
127
for processes. Currently MacOS is the only platform that supports this.
242
128
243
-
### Loading a Core File
129
+
####Loading a Core File
244
130
245
131
This loads the coredump file `/cores/123.core` associated with the program
246
132
`/tmp/a.out`:
@@ -255,7 +141,7 @@ This loads the coredump file `/cores/123.core` associated with the program
255
141
}
256
142
```
257
143
258
-
### Connect to a Debug Server on the Current Machine
144
+
####Connect to a Debug Server on the Current Machine
259
145
260
146
This connects to a debug server (e.g. `lldb-server`, `gdbserver`) on
261
147
the current machine, that is debugging the program `/tmp/a.out` and listening
@@ -271,7 +157,7 @@ locally on port `2345`.
271
157
}
272
158
```
273
159
274
-
### Connect to a Debug Server on Another Machine
160
+
####Connect to a Debug Server on Another Machine
275
161
276
162
This connects to a debug server running on another machine with hostname
277
163
`hostnmame`. Which is debugging the program `/tmp/a.out` and listening on
@@ -287,12 +173,12 @@ port `5678` of that other machine.
287
173
}
288
174
```
289
175
290
-
# Custom debugger commands
176
+
##Custom debugger commands
291
177
292
178
The `lldb-dap` tool includes additional custom commands to support the Debug
293
179
Adapter Protocol features.
294
180
295
-
## startDebugging
181
+
###startDebugging
296
182
297
183
Using the command `lldb-dap startDebugging` it is possible to trigger a
298
184
reverse request to the client requesting a child debug session with the
@@ -317,7 +203,7 @@ This will launch a server and then request a child debug session for a client.
317
203
}
318
204
```
319
205
320
-
## repl-mode
206
+
###repl-mode
321
207
322
208
Inspect or adjust the behavior of lldb-dap repl evaluation requests. The
323
209
supported modes are `variable`, `command` and `auto`.
0 commit comments