Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Debugging (DAP)

Mitos has experimental support for the Debug Adapter Protocol (DAP) for setting breakpoints, stepping through code, and inspecting variables. Install a debug adapter separately and configure it for the language you want to debug.

Configure an adapter

Debug adapters are configured per language in languages.toml. Some languages already have an adapter and launch templates configured. For example, Rust uses lldb-dap by default; its executable must be available on PATH.

To configure or override an adapter, add a language entry to your user languages.toml. This example matches the built-in Rust binary template:

[[language]]
name = "rust"

[language.debugger]
name = "lldb-dap"
transport = "stdio"
command = "lldb-dap"

[[language.debugger.templates]]
name = "binary"
request = "launch"
completion = [{ name = "binary", completion = "filename" }]
args = { program = "{0}" }

Each template defines a launch or attach request and adapter-specific arguments. completion defines the input prompts; {0}, {1}, and so on are replaced with the supplied values. Mitos sets the debug target’s cwd to the editor’s current working directory.

See the debugger configuration reference for TCP transport, attach templates, and the complete list of fields. Project-local configuration in .mitos/languages.toml is subject to workspace trust.

Start a session

  1. Build the program you want to debug, with debug information enabled.
  2. Open a source file in Mitos. Its language determines which adapter and templates are used.
  3. Press Space G b on a line to toggle a breakpoint.
  4. Press Space G l, choose a template, and fill in its prompts.
  5. When execution pauses, step through the code or inspect variables using the commands below.

G is uppercase. Press the keys in sequence. The debug menu stays active after a command; while it is active, use the suffix keys such as n or c directly. Press Esc to leave the menu.

You can also start a template from the command line. For a Rust binary built with cargo build, for example:

:debug-start binary target/debug/my-program

Replace my-program with your executable’s name. To connect to an already running TCP debug adapter, use :debug-remote <ip>:<port> <template> [parameters...], for example :debug-remote 127.0.0.1:4711 binary target/debug/my-program.

Debugging commands

These bindings are available in normal and select mode:

KeysAction
Space G lSelect a template and start debugging
Space G bToggle breakpoints on selected lines
Space G cContinue execution
Space G hPause execution
Space G nStep over
Space G iStep in
Space G oStep out
Space G vList variables
Space G s tSwitch thread
Space G s fSwitch stack frame
Space G rRestart the session
Space G tEnd the session
Space G Ctrl-cEdit the breakpoint condition on the current line
Space G Ctrl-lEdit the breakpoint log message on the current line
Space G e / Space G EEnable / disable exception breakpoints

Use :debug-eval <expression> to evaluate an expression in the current debug context. Supported expressions and debugging capabilities depend on the adapter.

Troubleshooting

  • No debug adapter available for language: check the current file’s language and its [language.debugger] configuration.
  • Failed to start debug client: check the adapter’s executable path, arguments, and transport.
  • No debug config with given name: use a template name defined in [[language.debugger.templates]].
  • Workspace is not trusted: use :workspace-trust to allow debugging in a workspace you trust. See workspace trust.