svaante / dape

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

how to pass arguments to dape? #74

Closed wybryk-ananasa closed 6 months ago

wybryk-ananasa commented 6 months ago

I would like to debug simple c++ with dape, but I have no idea how to pass arguments to dape. I was trying something like this:

(global-set-key (kbd "C-1") (lambda ()
                              (interactive)
                              (dape '(type "codelldb-cc"
                                      command-cwd "~/emacs"
                                      request "launch"
                                      program "test"
                                      cwd "."))))

Can anybody give me a simple example how to run it?

svaante commented 6 months ago

Call the dape command then codelldb-cc :args ["first-arg" "second-arg"]' :program "a.out"

wybryk-ananasa commented 6 months ago

Can I store config in variable and call dape like this?

(defvar config "codelldb...")
(dape config)
svaante commented 6 months ago

The recommended way is to (setq dape-command '(codelldb-cc :args ["my-arg"]) in dir locals. Then execute the dape command and the contents of dape-command will be inserted into the minibuffer. You can always do dape-restart to run the last configuration again.

wybryk-ananasa commented 6 months ago

Thanks for explanation!