Debugging in emacs (doom)

Hi,

since a week I try to setup the debugger for emacs (MacOS Arm) and as I do not have so much experiences with lisp I do not know what I am doing wrong.

I have try to follow the following ressources without success:

My current configuration (config.el):

(require 'dap-gdb-lldb)
(setq dap-auto-configure-features '(sessions locals controls tooltip))

Path to lldb

which lldb
/opt/homebrew/opt/llvm/bin/lldb

Path to lldb-mi:

which lldb-mi
/usr/local/bin/lldb-mi

Path to rust-lldb:

which rust-lldb
/Users/pascal/.cargo/bin/rust-lldb

Path to rust-analyser:

which rust-analyzer
/opt/homebrew/bin/rust-analyzer

The problem:

I can start the debugger with the standard configuration and go line by line(1) but I am not able to see the values of the variables.

(1) some times this does not work and some time I jump from line 2 to 4 for example.

I have tried to put this configuration in the config.el but when I start the the debugger with dap-debug emacs show me the following message:

dap-debug: Have you loaded the ‘lldb’ specific dap package? 

source: https://github.com/rksm/emacs-rust-config/blob/ec562f005152fabba0447ce64687cbb572a7d49b/init.el#L145C1-L168C16

(use-package exec-path-from-shell
  :ensure
  :init (exec-path-from-shell-initialize))


(when (executable-find "lldb-mi")
  (use-package dap-mode
    :ensure
    :config
    (dap-ui-mode)
    (dap-ui-controls-mode 1)


    (require 'dap-lldb)
    (require 'dap-gdb-lldb)
    ;; installs .extension/vscode
    (dap-gdb-lldb-setup)
    (dap-register-debug-template
     "Rust::LLDB Run Configuration"
     (list :type "lldb"
           :request "launch"
           :name "LLDB::Run"
           :gdbpath "rust-lldb"
           ;; uncomment if lldb-mi is not in PATH
           ;; :lldbmipath "path/to/lldb-mi"
           ))))

Thank you for your support!

1 Like

I found the solution!

I was missing dap-codelldb.

Now I get the value of the variables :

I have configured the dap-mode as follow in the file config.el:

(after! dap-mode
  (require 'dap-codelldb)

  (setq dap-auto-configure-features '(sessions locals controls tooltip))

   (dap-register-debug-template
   "LLDB::Run Rust"
   (list :type "lldb"
         :request "launch"
         :name "LLDB::Run"
         :miDebuggerPath "~/.cargo/bin/rust-lldb"
         :target nil
         :cwd nil
         :program "~/my_app/target/debug/my_app"
         ))
  )
2 Likes