2018-11-25 16:50:46 +00:00
|
|
|
#+TITLE: DAP layer
|
|
|
|
|
2019-05-02 21:49:30 +00:00
|
|
|
#+TAGS: layer|tool
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2018-11-25 16:50:46 +00:00
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#features][Features:]]
|
2019-04-21 20:04:25 +00:00
|
|
|
- [[#layer-installation][Layer installation]]
|
2018-11-25 16:50:46 +00:00
|
|
|
- [[#configuration][Configuration]]
|
2019-09-30 01:30:53 +00:00
|
|
|
- [[#dap-configuration-in-supported-layers][DAP configuration in supported layers]]
|
2019-08-20 17:57:53 +00:00
|
|
|
- [[#variables][Variables]]
|
2019-09-30 01:30:53 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2019-09-30 06:25:48 +00:00
|
|
|
- [[#declared-prefixes][Declared prefixes]]
|
|
|
|
- [[#transient-state][Transient state]]
|
|
|
|
- [[#startstop][Start/Stop]]
|
|
|
|
- [[#breakpoints][Breakpoints]]
|
|
|
|
- [[#navigation][Navigation]]
|
|
|
|
- [[#evaluation-and-repl][Evaluation and REPL]]
|
|
|
|
- [[#inspection][Inspection]]
|
2018-11-25 16:50:46 +00:00
|
|
|
- [[#references][References]]
|
|
|
|
|
|
|
|
* Description
|
2018-12-05 03:03:03 +00:00
|
|
|
Experimental integrated visual debugger using [[https://code.visualstudio.com/docs/extensionAPI/api-debugging][Debug Adapter Protocol]].
|
|
|
|
|
|
|
|
[[https://code.visualstudio.com/docs/extensionAPI/api-debugging][Debug Adapter Protocol]] is a wire protocol for communication between client and
|
|
|
|
Debug Server. It similar to the [[https://github.com/Microsoft/language-server-protocol][LSP]] but providers integration with debug
|
|
|
|
server.
|
2018-11-25 16:50:46 +00:00
|
|
|
|
|
|
|
** Features:
|
2018-12-05 03:03:03 +00:00
|
|
|
Fully featured IDE-like debugger providing:
|
|
|
|
- Launch/Attach
|
|
|
|
- Breakpoints
|
|
|
|
- Exceptions
|
|
|
|
- Pause & Continue
|
|
|
|
- Step In/Out/Over
|
|
|
|
- Callstacks
|
|
|
|
- Threads
|
|
|
|
- Multiple simultaneous debug sessions
|
|
|
|
- Evaluating statements
|
|
|
|
- Debug/Run configurations
|
|
|
|
- Debug REPL
|
|
|
|
|
2019-04-21 19:00:24 +00:00
|
|
|
* Layer installation
|
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =dap= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
file.
|
|
|
|
|
2018-11-25 16:50:46 +00:00
|
|
|
* Configuration
|
2019-09-30 01:30:53 +00:00
|
|
|
** DAP configuration in supported layers
|
2020-05-16 21:32:30 +00:00
|
|
|
By default ~dap~ layer registers global key binding defined under ~SPC d~. If you
|
2020-04-14 16:32:25 +00:00
|
|
|
want to have debug bindings under major mode leader you may do the following:
|
2019-09-30 01:30:53 +00:00
|
|
|
|
|
|
|
For instance the =java= layer:
|
|
|
|
|
2019-11-08 16:03:53 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defun java/pre-init-dap-mode ()
|
2021-03-18 05:17:22 +00:00
|
|
|
(when (eq java-backend 'lsp)
|
|
|
|
(add-to-list 'spacemacs--dap-supported-modes 'java-mode))
|
2020-05-16 21:32:30 +00:00
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-dap))
|
2019-11-08 16:03:53 +00:00
|
|
|
#+END_SRC
|
2019-09-30 01:30:53 +00:00
|
|
|
|
2020-05-16 21:32:30 +00:00
|
|
|
See the =java= layer for further example on how to setup =dap-mode= correctly
|
2018-12-05 03:03:03 +00:00
|
|
|
|
2019-08-20 17:57:53 +00:00
|
|
|
** Variables
|
|
|
|
|
|
|
|
| Variable name | Default | Description |
|
|
|
|
|----------------------------+---------+------------------------------|
|
|
|
|
| =dap-enable-mouse-support= | t | Enable/disable mouse support |
|
|
|
|
|
2019-09-30 01:30:53 +00:00
|
|
|
* Key bindings
|
2019-09-30 06:25:48 +00:00
|
|
|
** Declared prefixes
|
2018-12-05 03:03:03 +00:00
|
|
|
The following prefixes have been declared:
|
2018-11-25 16:50:46 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| prefix | name |
|
|
|
|
|-----------+-------------------|
|
|
|
|
| ~SPC d~ | debug |
|
|
|
|
| ~SPC d b~ | breakpoints |
|
2020-05-16 21:32:30 +00:00
|
|
|
| ~SPC d d~ | debugging |
|
2020-04-14 16:32:25 +00:00
|
|
|
| ~SPC d e~ | eval |
|
|
|
|
| ~SPC d I~ | inspect |
|
2020-05-16 21:32:30 +00:00
|
|
|
| ~SPC d w~ | debug windows |
|
2020-04-14 16:32:25 +00:00
|
|
|
| ~SPC d S~ | context switching |
|
|
|
|
| ~SPC d T~ | toggles |
|
2018-11-25 16:50:46 +00:00
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Transient state
|
2019-09-29 16:36:08 +00:00
|
|
|
Most of the DAP functions can be easily repeated using the built-in DAP
|
|
|
|
transient state which can be initiate with ~SPC m d .~.
|
|
|
|
|
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+-----------------------|
|
|
|
|
| ~SPC m d .~ | debug transient state |
|
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Start/Stop
|
2018-11-25 16:50:46 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+----------------------------|
|
|
|
|
| ~SPC d A~ | abandon all process |
|
|
|
|
| ~SPC d a~ | abandon current session |
|
|
|
|
| ~SPC d d d~ | start debugging |
|
|
|
|
| ~SPC d d e~ | edit debug template |
|
|
|
|
| ~SPC d d l~ | debug last configuration |
|
|
|
|
| ~SPC d d r~ | debug recent configuration |
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Breakpoints
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+---------------------------------|
|
|
|
|
| ~SPC d b b~ | toggle a breakpoint |
|
|
|
|
| ~SPC d b c~ | change breakpoint condition |
|
|
|
|
| ~SPC d b l~ | change breakpoint log condition |
|
|
|
|
| ~SPC d b h~ | change breakpoint hit count |
|
|
|
|
| ~SPC d b a~ | add a breakpoint |
|
|
|
|
| ~SPC d b d~ | delete a breakpoint |
|
|
|
|
| ~SPC d b D~ | clear all breakpoints |
|
|
|
|
| ~SPC d w b~ | list breakpoints |
|
2018-11-25 16:50:46 +00:00
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Navigation
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+-------------------------------|
|
|
|
|
| ~SPC d c~ | continue |
|
|
|
|
| ~SPC d i~ | step in |
|
|
|
|
| ~SPC d o~ | step out |
|
|
|
|
| ~SPC d s~ | next step |
|
|
|
|
| ~SPC d r~ | restart frame |
|
|
|
|
| ~SPC d S f~ | switch frame |
|
|
|
|
| ~SPC d S s~ | switch session |
|
|
|
|
| ~SPC d S t~ | switch thread |
|
|
|
|
| ~SPC d w o~ | goto output buffer if present |
|
|
|
|
| ~SPC d w s~ | list sessions |
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Evaluation and REPL
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+---------------------|
|
|
|
|
| ~SPC d '_~ | Run debug REPL |
|
|
|
|
| ~SPC d e e~ | eval |
|
|
|
|
| ~SPC d e r~ | eval region |
|
|
|
|
| ~SPC d e t~ | eval value at point |
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2019-09-30 06:25:48 +00:00
|
|
|
** Inspection
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2020-04-14 16:32:25 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+-------------------------------------------|
|
|
|
|
| ~SPC d I i~ | inspect |
|
|
|
|
| ~SPC d I r~ | inspect region |
|
|
|
|
| ~SPC d I t~ | inspect value at point |
|
|
|
|
| ~SPC d v~ | inspect value at point |
|
|
|
|
| ~SPC d w l~ | list local variables |
|
|
|
|
| ~SPC d T m~ | toggle mouse support for value inspection |
|
2019-09-29 16:36:08 +00:00
|
|
|
|
2018-11-25 16:50:46 +00:00
|
|
|
* References
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[https://github.com/yyoncho/dap-mode][dap-mode repo]]
|
|
|
|
- [[https://github.com/emacs-lsp/lsp-mode][lsp-mode repo]]
|