Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp-rust: Allow debugging with GDB 14. #4444

Merged
merged 1 commit into from
Apr 28, 2024
Merged
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
6 changes: 3 additions & 3 deletions clients/lsp-rust.el
Original file line number Diff line number Diff line change
Expand Up @@ -1513,8 +1513,8 @@ and run a compilation"
(defun lsp-rust-analyzer-debug (runnable)
"Select and debug a RUNNABLE action."
(interactive (list (lsp-rust-analyzer--select-runnable)))
(unless (featurep 'dap-cpptools)
(user-error "You must require `dap-cpptools'"))
(unless (or (featurep 'dap-cpptools) (featurep 'dap-gdb))
(user-error "You must require `dap-cpptools' or 'dap-gdb'"))
(-let (((&rust-analyzer:Runnable
:args (&rust-analyzer:RunnableArgs :cargo-args :workspace-root? :executable-args)
:label) runnable))
Expand All @@ -1541,7 +1541,7 @@ and run a compilation"
(`() (user-error "No compilation artifacts or obtaining the runnable artifacts failed"))
(`(,spec) spec)
(_ (user-error "Multiple compilation artifacts are not supported")))))
(list :type "cppdbg"
(list :type (if (featurep 'dap-gdb) "gdb" "cppdbg")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is gdb preferred over cppdb? 🤔

Copy link
Contributor Author

@daym daym Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand it:

If the user doesn't do (require 'dap-gdb) in their emacs config file then dap-gdb.el won't be used anyway (even though the file is on disk), right?

So this way should be backward compatible with whatever users have configured now.

On the other hand, if someone adds (require 'dap-gdb) to their emacs config now then lsp-rust will switch over to gdb.

I didn't think of more use cases than that yet.

The only reason I do the (featurep 'dap-gdb) is because I just touched it so I'm very sure it works.

Long term, this entire spot could use some automatic "which debugger features are there, which will actually work, and of those, which one should we prefer for the default debugger profile" policy--but I don't know whether we want that and when and whether it already exists.

:request "launch"
:name label
:args executable-args
Expand Down
Loading