Table of Contents
- Extending DAP with new Debug servers
- What’s next
Note: dap-mode works only against lsp.el interface.
The project is in it’s early stage but although it is not extensively tested it is considered stable enough to be used. The API considered unstable until 1.0 release is out. It is tested against Java, Python, Ruby, Elixir and LLDB (C/C++/Objective-C/Swift).
The main entry points are
dap-debug-edit-template. The first
one asks for a registered debug template and starts the configuration using
the default values for that particular configuration. The later creates a
debug template which could be customized before running.
- Pause & Continue
- Step In/Out/Over
- Multiple simultaneous debug sessions
- Evaluating statements
- Debug/Run configurations
|Toggle breakpoint at line|
|Delete breakpoint at line|
|Add java breakpoint at line|
|Set/unset breakpoint condition|
|Set/unset breakpoint hit condition|
|Set/unset breakpoint log message|
|Eval region string|
|Eval symbol at point|
|Debug step in|
|Debug step out|
|Cancel current debug session|
|Switch active stack frame|
|Switch active thread|
|Switch active session|
|Generate run command|
|Create and run new configuration using the available templates|
|Debug previous configuration|
|Select configuration to run from the previously started command|
|Go output buffer|
|Show active/terminated sessions view|
|Show locals view|
|Show breakpoints view|
|DAP UI REPL|
|Inspect symbol at point|
The sessions view is showed after invoking
dap-ui-sessions . It represents
the list of the active sessions.
|Select object at point||<return>|
|Remove terminated session from the list of running sessions|
|Toggle node expand state||<tab>|
Locals can be viewed after invoking
Breakpoints can be viewed after invoking
|Go to breakpoint under cursor||<return>|
|Delete breakpoint under cursor||d|
|Delete selected breakpoints||D|
|Mark breakpoint under point||m|
|Unmark breakpoint under point||u|
|Unmark breakpoint under point||U|
DAP debug REPL
DAP provides a debug shell to execute command when the program has hit
breakpoints. The REPL has the same features as standart emacs shell (e. g.
C-p/n navigation through history, etc.) in addition to
DAP mode configuration
(dap-mode 1) (dap-ui-mode 1)
After enabling DAP mode on emacs side follow the language specific settings.
Latest version of LSP Java will automatically discover if
present and it will download and install the required server side
components. If you have already downloaded a
Eclispe JDT Server you will
have to force server update via
lsp-java-update-server. In order to enable lsp java you will have to require
|Run test method|
|Debug test method|
|Run test class|
|Debug test class|
- Make sure you have installed and configured lsp-python.
- install latest version of ptvsd.
pip install "ptvsd>=4.2"
- Then add the following line in your config:
This will add the python related configuration to
- Download and extract VSCode Ruby Extension . Make sure that
nodeis either “node” if nodejs is on the path or path to nodejs and
path-to-main-jsis full path
./out/debugger/main.jswhich is part of the downloaded VScode package.
- Follow the instructions on installing
rdebug-idefrom Ruby Debug Installation
- Put in your emacs configuration.
LLDB is a debugger that supports, among others, C, C++, Objective-C and Swift.
- Clone and follow the instructions to compile lldb-vscode from https://github.com/llvm-mirror/lldb/tree/master/tools/lldb-vscode
- Put in your emacs configuration.
Note: For proper Swift support, you need to compile LLDB from https://github.com/apple/swift-lldb and put the compiled LLDB library/framework in the “extensions” folder.
Make sure that you have properly configured
Elixir and that you have Elixir LS
binaries on the path and put in your emacs configuration.
Then when you do
dap-debug-edit-template and select Elixir which will
generate runnable debug configuration. For more details on supported settings
by the Elixir Debug Server refer to it’s documentation.
Extending DAP with new Debug servers
There are two methods that are used for registering remote extensions:
dap-register-debug-provider- register a method to call for populating startup parameters. It should either populate
:hostin case of TCP Debug Adapter Server or
:dap-server-pathwhen STD out must be used for Debug Adapter Server communication.
dap-register-debug-templateregister a debug template which will be available when
dap-debugis called. The debug template must specify
:typekey which will be used to determine the provider to be called to populate missing fields.
For full example you may check
(dap-register-debug-provider "programming-language-name" (lambda (conf) (plist-put conf :debugPort 1234) (plist-put conf :host "localhost") conf)) (dap-register-debug-template "Example Configuration" (list :type "java" :request "launch" :args "" :name "Run Configuration"))
If you notice a bug, open an issue on Github Issues.
- Daniel Martin - LLDB integration.