Dape - Debug Adapter Protocol for Emacs
Dape is a tool designed to enhance debugging experience in Emacs. It serves as a client for the Debug Adapter Protocol, resembling the Language Server Protocol but focusing on debugging instead of code completions. This protocol provides a standard interface that connects with various debuggers, making it versatile for developers.
Features
Dape comes packed with several beneficial features:
- Batteries Included Support: Offers configurations through
dape-configs
for various programming languages. - Log and Conditional Breakpoints: Enables you to set breakpoints that either log information or are conditionally triggered.
- Variable Handling: Includes tools like variable explorer, watch, and hover features using
eldoc
for enhanced inspection of variable values. - REPL Support: Facilitates interaction with the debugged program.
- User-friendly Interface: Mimics
gdb-mi.el
, including a memory editor usinghexl
. - Integration with Compile Tools: Seamlessly works with existing Emacs compile functionalities.
- Minimal Dependencies: Requires no external dependencies beyond core Emacs components.
Configuration
Dape offers predefined configurations suitable for different programming languages, detailed in dape-configs
. For added flexibility, individual users can create custom configurations to suit their specific project needs.
Example Configuration
To utilize Dape, users can install it using emacs-lisp
instructions, which include enabling global bindings for breakpoints and setting buffer window arrangements. Users can choose between right
or gud
style for informational buffers.
Differences with dap-mode
While similar to dap-mode
, Dape differentiates itself by opting not to use launch.json
files. Instead, it offers configurations within Emacs itself and encourages the use of dir-locals
and dape-command
. It eschews special variables, opting for functions and resolved variables before the session begins.
Supported Debug Adapters
Dape supports a wide array of debug adapters, making it adaptable for many programming languages:
- JavaScript: Utilizes
vscode-js-*
with installation instructions available on GitHub. - Go, C, C++, and Rust: Compatible with
dlv
,GDB
,codelldb
, and other tools. - Python, Dart, C#, Ruby, Java, PHP, OCaml, Bash: Supports adapters like
debugpy
,flutter
,netcoredbg
,rdbg
, and others. - Additional Adapters: New configurations are readily welcome from the community.
Contribution and Performance
Dape follows GNU Emacs's copyright assignment policy for contributions. Performance can be enhanced by adjusting Emacs's gc-cons-threshold
and read-process-output-max
settings, with expert recommendations for different operating systems.
Bugs and Issues
Before reporting issues, users are encouraged to activate debugging and share relevant logs. The most stable version is available on ELPA, with the master
branch primarily for development.
Acknowledgements
Special thanks to João Távora for their invaluable input on jsonrpc, which has significantly contributed to Dape's development.
Overall, Dape represents a robust debugging solution for Emacs users, marrying modern debugging protocols with the classic Emacs environment, and providing a user-friendly and powerful tool for developers.