About using the debuggers #16
mortang2410
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I am new to Doom Emacs, though I had used Emacs beore years ago. I see that using the various debuggers in Doom Emacs is somewhat confusing (at least for me I suppose). The included documentation for
:tools debugger
is rather sparse with unwritten parts. It mentions bothdap-mode
andDAPE
, which are two different things. So I am sharing some of what I have figured out through trial and error, and I hope people could tell me whatever I get wrong. More tips would also be appreciated. Hopefully it will help others, and the documentation will be filled out soon.debug-on-entry
for a function to debug and then run/eval any elisp expression. Unfortunately debugger doesn't correspond with source (edebug uses source). Also don't turn on debugger mode on the source file (it is for the debugger backtrace buffer). In the debugger backtrace buffer, pressd
orj
to continue. We canbacktrace-toggle-locals
to show locals of a specific function / context. For some limited symbols we can usebacktrace-help-follow-symbol
to jump to source.edebug-instrument-defun-on
for functions you want to monitor. Then run/eval any expression withgR
. edebug works like debug above, but also shows which line of code in the source you're on. Pressn
in the source file to make one more step. Pressd
in the source file to see backtrace buffer, wherebacktrace-toggle-locals
also works. Pressq
in source file to quit edebug.+lsp ::
is a deprecated flag along withdap-mode
anddap-ui
, and that it requires:tools lsp
(not compatible with Eglot). I am not sure what this means, but I suspect thatdap-mode
anddap-ui
should no longer be used. And the:tools debugger
perhaps used to be:tools debugger + lsp
(but is no longer). Nowadays we enable bothdebugger
andlsp
under:tools
ininit.el
.lsp-mode
. Only one can be active at a time for any programming language. Check doom docs for each language to see how to choose which with flags.dape
withM-x
in a C file, and you will be asked for the "adapter" command. Example: assuming the compile command iscc -g main.c -o main.out
(output with debug symbols), a correctly formatted adapter command islldb-dap :program "/Users/John/programming/C_testing/main.out" :cwd "/Users/John/programming/C_testing/"
where you provide the correct :program and :cwd (current working directory). Remember to set breakpoints withdape-breakpoint-toggle
.Beta Was this translation helpful? Give feedback.
All reactions