svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
448 stars 25 forks source link

Use of compile is not documented or not working #93

Closed ezaquarii closed 4 months ago

ezaquarii commented 4 months ago

I'm trying to get gdb working woth go and I need to re-compile test before debugging:

(add-to-list 'dape-configs
      '(gdb-go
    modes (go-mode)
    command "gdb"
    command-args ("--interpreter=dap")
    compile "go build"
    :request "launch"
    :program "a.out"
    :args []
    :stopAtBeginningOfMainSubprogram nil)))

When launching dape, it says:

Wrong type argument: stringp, "go build"

I tried to toggle debug on error, but it's not triggered.

How to use cutsom compile method on debug?

svaante commented 4 months ago

What version do of dape do you have?

Your example looks correct. Tried on my machine with success. Have you set dape-compile-fn to any other value the the default 'compile?

ezaquarii commented 4 months ago

Ok, I discovered what was the issue. My config uses (setq dape-cwd-fn 'projectile-project-root). However, this particular project did not have .git directory nor .projectile.el, hence projectile-project-root was nil.

As a result, it was b0rking deep inside compile.

I propose some more intelligent version of default dape-cwd-fn that falls back to default-directory:

(defun dape-projectile-or-default-directory ()
  (unless (projectile-project-root)
    (projectile-project-root)
    default-directory))
ezaquarii commented 4 months ago

Overall, it turned out to be my configuration issue.