This document will help you to configure [[doom-package:dap-mode]] [[https://emacs-lsp.github.io/dap-mode/page/configuration/#native-debug-gdblldb][Native Debug(GDB/LLDB)]] as
DAP expects [[https://github.com/Microsoft/ptvsd][ptvsd]] by default as the Python debugger, but [[https://github.com/microsoft/debugpy][debugpy]] is recommended.
See [[*Configuration][Configuration]].
*installing ptvsd:*
#+begin_src sh
pip3 install ptvsd --user
#+end_src
*install debugpy:*
#+begin_src sh
pip3 install debugpy --user
#+end_src
#+begin_src emacs-lisp
;; in $DOOMDIR/config.el
(after! dap-mode
(setq dap-python-debugger 'debugpy))
#+end_src
*** C, C++, Rust, Golang
Needs [[https://github.com/llvm/llvm-project/tree/main/lldb/tools/lldb-vscode][lldb-vscode]]. Install LLDB from your package manager.
*Fedora:*
#+begin_src sh
dnf install lldb
#+end_src
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
#+end_quote
- ~M-x +debugger/start~
- ~M-x +debugger/start-last~
- ~M-x +debugger/quit~
** Realgud
1. Call ~dap-gdb-lldb-setup~ function.
2. Use ~dap-debug-edit-template~ to configure debugging settings for your
project. [[github:WebFreak001/code-debug/blob/master/package.json#L72][Available settings can be inspected here.]] Call ~eval-buffer~ to save
your settings. *Don't save the file!*
3. Call ~dap-debug~, select a configuration and start debugging.
** dap-mode with ~+lsp~
Intuitive and powerful debugging.
- Breakpoints
- REPL
- *local variable view:* Allows you to browse variables in the current stack
frame.
- *expressions:* Add expressions to either watch variables or generic
expressions.
** Keybindings
#+begin_src emacs-lisp
(map! :map dap-mode-map
:leader
:prefix ("d" . "dap")
;; basics
:desc "dap next" "n" #'dap-next
:desc "dap step in" "i" #'dap-step-in
:desc "dap step out" "o" #'dap-step-out
:desc "dap continue" "c" #'dap-continue
:desc "dap hydra" "h" #'dap-hydra
:desc "dap debug restart" "r" #'dap-debug-restart
:desc "dap debug" "s" #'dap-debug
;; debug
:prefix ("dd" . "Debug")
:desc "dap debug recent" "r" #'dap-debug-recent
:desc "dap debug last" "l" #'dap-debug-last
;; eval
:prefix ("de" . "Eval")
:desc "eval" "e" #'dap-eval
:desc "eval region" "r" #'dap-eval-region
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
:desc "add expression" "a" #'dap-ui-expressions-add