Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

dap-mode

:ID: BA573DB0-C2B1-4308-9F0A-D849858402DB

# Overview

This package provides a Debug Adapter Protocol interfaces between Emacs and debugger adapters installed on your system.

It depends on various debug servers or VSCode extensions. There’s setup functions for easy install (see below). VSCode extensions are installed in into /spacemacs-dir/.extension/vscode/

# Resources

# Configuration Recipes

These are handy references to have when configuring dap-mode templates in Emacs. Or you can even use them directly in a launch.json file. See below for more on this.

# Configuration

# My dap-mode configuration for Spacemacs

I have elisp functions that define and run debugger templates. I put these in functions in my dotspacemacs. See my dotspacemacs dap functions. The configuration for each template is determined by the debugger being used. See the documentation for the debugger for the options are available. Then I map these functions to custom keys for the modes for which they are relevant.

# chrome debugging

  • Add the breakpoint
  • call my/dap-debug-chrome

# VSCode launch.json

Instead of configuring dap-mode debug templates in emacs-lisp, you can use launch.json file placed in the project root. I think it should go in a .vscode directory as well, but not sure. With a launch.json file in place, just call dap-debug and select the template to run.

# Chrome Debugging

dap-chrome-setup to install debugger-for-chrome.

# Node Debugging

dap-node-setup to install https://github.com/microsoft/vscode-node-debug2

# Issues

The VSCode extension needs to be installed manually now. https://github.com/emacs-lsp/dap-mode/issues/554#issuecomment-1171256089

# Usage

Use dap-breakpoint add and run dap-debug

# Print debugging

  1. Add a breakpoint dap-breakpoint-add
  2. For that breakpoint, turn it into a message logger with dap-breakpoint-log-message. It will no longer break on that line but log instead. Useful for wanting to see what’s going on in loops where it would be annoying to break on each iteration.

    Use curly braces to interpolate things: log var: {var}

# Condition debugging

  • dap-breakpoint-condition: Modify a breakpoint with a conditional expression.
  • dap-breakpoint-hit-condition: Specify a number of hits for a breakpoint for it to break.

# Adding/Watching expressions

  • dap-ui-expressions-add (SPC d e t): Add some expressions for which you want to watch

the value of. It will show in the expressions window.

  • Remove them with dap-ui-expressions-remove.

Search Results