summaryrefslogtreecommitdiff
path: root/dape.el
diff options
context:
space:
mode:
authorChris Narkiewicz <hello@ezaquarii.com>2026-04-06 16:36:53 +0100
committerGitHub <noreply@github.com>2026-04-06 17:36:53 +0200
commit6fab87c15e5b68d9f3c7d0764978f196c53a578e (patch)
treec4bf92dddea86cf1e9ec6481540b133d8a51b58c /dape.el
parent9990a0e4800a87fcc86c1dccea45419facf9788e (diff)
Support for debugging go with gdb (#187)
This PR introduces configuration to debug Go applications with GDB, since Delve is not supported on OpenBSD.
Diffstat (limited to 'dape.el')
-rw-r--r--dape.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/dape.el b/dape.el
index f142f99..4cf16d7 100644
--- a/dape.el
+++ b/dape.el
@@ -233,6 +233,38 @@
:program "a.out"
:args []
:stopAtBeginningOfMainSubprogram nil)
+ ,@(let ((gdb-common
+ `( ensure (lambda (config)
+ (dape-ensure-command config)
+ (let* ((default-directory
+ (or (dape-config-get config 'command-cwd)
+ default-directory))
+ (command (dape-config-get config 'command))
+ (output (shell-command-to-string (format "%s --version" command)))
+ (version (save-match-data
+ (when (string-match "GNU gdb \\(?:(.*) \\)?\\([0-9.]+\\)" output)
+ (string-to-number (match-string 1 output))))))
+ (unless (>= version 14.1)
+ (user-error "Requires gdb version >= 14.1"))))
+ command "gdb"
+ command-args ("--interpreter=dap")
+ :request "launch"
+ :stopAtBeginningOfMainSubprogram nil)))
+ `((go-gdb-test ,@gdb-common
+ modes (go-mode go-ts-mode)
+ command-cwd (file-name-directory (buffer-file-name))
+ compile (format "go test -c -o %s -gcflags='all=-N -l'"
+ (expand-file-name "__test.bin" temporary-file-directory)) ;; compile without optimizations
+ :program (expand-file-name "__test.bin" temporary-file-directory)
+ :args [])
+ (go-gdb ,@gdb-common
+ modes (go-mode go-ts-mode)
+ command-cwd (file-name-directory (buffer-file-name))
+ compile (format "go build -o %s -gcflags='all=-N -l'"
+ (expand-file-name "__binary.bin" temporary-file-directory)) ;; compile without optimizations
+ :request "launch"
+ :program (expand-file-name "__binary.bin" temporary-file-directory)
+ :args [])))
(godot
modes (gdscript-mode)
port 6006