Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,36 @@ Configure debug adapter port under "Editor" > "Editor Settings" > "Debug Adapter
** Dart - flutter
See for installation https://docs.flutter.dev/get-started/install

** C# - netcoredbg
** C# - netcoredb

netcoredbg is an open-source debugger for .NET that implements the Debug
Adapter Protocol.

See https://github.com/Samsung/netcoredbg for installation

Example configuration:

#+begin_src emacs-lisp
(add-to-list 'dape-configs
`(netcoredbg
modes (csharp-mode csharp-ts-mode)
ensure dape-ensure-command
command "netcoredbg"
command-args ("--interpreter=vscode")
normalize-path-separator 'windows ;; Required for proper breakpoint binding
:type "coreclr"
:request "launch"
:cwd dape-cwd
:program dape-cwd
:stopAtEntry nil))
#+end_src

*Note:* The =normalize-path-separator= option is important for netcoredbg on
Windows. netcoredbg requires exact path matching between source files and PDB
symbol files. Since PDB files store paths with backslashes (=\=), but Emacs
uses forward slashes (=/=), this option ensures paths are converted to the
format expected by the debugger.

** Ruby - rdbg
Install with ~gem install debug~.

Expand Down
23 changes: 21 additions & 2 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
ensure dape-ensure-command
command "netcoredbg"
command-args ["--interpreter=vscode"]
normalize-path-separator 'windows
:request "launch"
:cwd dape-cwd
:program (if-let* ((dlls
Expand Down Expand Up @@ -446,6 +447,11 @@ Symbol keys (Used by dape):
stderr output from debugged program.
- prefix-local: Path prefix for Emacs file access.
- prefix-remote: Path prefix for debugger file access.
- normalize-path-separator: Normalize path separators when sending to adapter.
When set to `'windows', converts forward slashes to backslashes.
When set to `'unix', converts backslashes to forward slashes.
nil (default) means no normalization. Useful for adapters like
netcoredbg that require exact path matching with symbol files.
- host: Host of the debug adapter.
- port: Port of the debug adapter.
- modes: List of modes where the configuration is active in `dape'
Expand Down Expand Up @@ -494,6 +500,10 @@ Functions and symbols:
((const :tag "Working directory for command" command-cwd) (choice string symbol))
((const :tag "Path prefix for Emacs file access" prefix-local) string)
((const :tag "Path prefix for debugger file access" prefix-remote) string)
((const :tag "Normalize path separators" normalize-path-separator)
(choice (const :tag "No normalization" nil)
(const :tag "Convert to backslashes (Windows)" 'windows)
(const :tag "Convert to forward slashes (Unix)" 'unix)))
((const :tag "Host of debug adapter" host) string)
((const :tag "Port of debug adapter" port) natnum)
((const :tag "Compile cmd" compile) string)
Expand Down Expand Up @@ -1043,9 +1053,18 @@ See `dape--file-name-1'."
(dape--file-name-1 conn filename nil))

(defun dape--file-name-remote (conn filename)
"Return FILENAME string for adapter configured by CONN.
"Return translate FILENAME to remote format by CONN.
Normalizes path separators according to `normalize-path-separator' config option.
See `dape--file-name-1'."
(dape--file-name-1 conn filename 'remote))
(let* ((result (dape--file-name-1 conn filename 'remote))
(config (dape--config conn))
(normalize (plist-get config 'normalize-path-separator)))
(if (and result normalize)
(pcase normalize
('windows (replace-regexp-in-string "/" "\\\\" result))
('unix (replace-regexp-in-string "\\\\" "/" result))
(_ result))
result)))

(defun dape--capable-p (conn thing)
"Return non-nil if CONN capable of THING."
Expand Down