This extension provides native code debugging in Visual Studio Code via the LLDB debugger engine.
- Visual Studio Code 1.1.0.
- LLDB with Python scripting support. Make sure it's on you PATH.
Please refer to Installing LLDB section for installation instructions.
Verify installation by running
lldb --version
.
TL;DR: Press F9 to set breakpoints, press F5 to launch.
See VS Code Debugging page for general instructions.
Create a new launch configuration with one of the following sets of parameters:
parameter | type | req | |
---|---|---|---|
name |
string | Y | Launch configuration name. |
type |
string | Y | Set to "lldb". |
request |
string | Y | Set to "launch". |
program |
string | Y | Path to debuggee executable. |
args |
list of strings | Command line parameters. | |
cwd |
string | Working directory. | |
env |
dictionary | Additional environment variables. | |
stdio |
string, list or dictionary | Debuggee's stdio configureation (see below). | |
stopOnEntry |
boolean | Whether to stop debuggee immediately after launching. | |
initCommands |
list of strings | LLDB commands executed upon debugger startup. | |
preRunCommands |
list of strings | LLDB commands executed just before launching the program. | |
sourceLanguages |
list of strings | A list of source languages used in the program. This is used only for setting exception breakpoints, since they tend to be language-specific. |
parameter | type | req | |
---|---|---|---|
name |
string | Y | Launch configuration name. |
type |
string | Y | Set to "lldb". |
request |
string | Y | Set to "launch". |
program |
string | Y | Path to debuggee executable. |
pid |
number | The process id to attach to. pid may be omitted, in which case the debugger will attempt to locate an already running instance of the program. |
|
stopOnEntry |
boolean | Whether to stop debuggee immediately after attaching. | |
initCommands |
list of strings | LLDB commands executed upon debugger startup. | |
preRunCommands |
list of strings | LLDB commands executed just before attaching. | |
sourceLanguages |
list of strings | A list of source languages used in the program. This is used only for setting exception breakpoints, since they tend to be language-specific. |
The stdio configuration specifies the connections established for debuggee stdio streams. Each stream's configuration value may be one of the following:
null
: Debugger captures the stream. Output tostdout
andstderr
is sent to debugger console;stdin
is always empty."/some/path"
: Connects stream to a file, a pipe or a TTY (not supported on Windows). Hint: to find out the TTY device name for a terminal window, entertty
command."*"
: Creates a new terminal window and connects stream to that terminal. On Windows, debuggee is always launched in a new window, however stdio streams may still be configured as described above.
When the stdio
parameter is assigned a single value, all three streams are configured identically.
It is possible to configure them independently: "stdio": ["*", null, "/tmp/my.log"]
will connect stdin to a new terminal, send stdout to debugger console, and stderr - to a log file.
You may also use dictionary syntax: "stdio": { "stdin": "*", "stdout": null, "stderr": "/tmp/my.log" }
VS Code UI does not support all the bells and whistles that the underlying LLDB engine does. To access advanced features
you may enter LLDB commands directly into the debugger console window.
If you would like to evaluate an expression instead, prefix it with '?
'.
Note that any debugger state changes that you make directly through LLDB commands will not be reflected in the UI and will not be persisted across debug sessions.
- On Debian-derived distros (e.g. Ubuntu), run
sudo apt-get install lldb-x.y
, where x.y is LLDB version. See this page for more info.
- Download and install XCode.
- Install XCode Command Line Tools by running
xcode-select --install
No binary downloads are available at this time. You are gonna have to build your own. Sorry :(