this post was submitted on 20 Oct 2023
1 points (100.0% liked)

Emacs

314 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

https://github.com/svaante/dape#

Given that eglot has been part of the core emacs, I believe this is a long lasting wish for a lot of emacsers that has finally been fulfilled. (a stand alone DAP implementation that does not rely on LSP-mode)

you are viewing a single comment's thread
view the rest of the comments
[–] mickeyp@alien.top 1 points 1 year ago (1 children)

I saw this on the mailing list, and it looks very promising. It's always nice to have more choice in this space. I did also play around with it quite a bit and I do have some feedback to the author (and anybody who would want to play around with it):

Expect to debug the dape debugger. I wanted to check it out with a bespoke software project I'm building for a client and I figured this would be a fine way to test it. I've never played around with DAP and friends before (ipdb is fine for me, thanks) so it was a bit of a learning curve as the documentation is sparse, even moreso the magic flags and parameters you need to paw off to dape and -- down the road -- the actual DAP client/server. This... this is bad and needs a lot more handholding. I struggled, and I've done Python and Emacs for two decades. And I simply could not, no matter what I did, get the microsoft adapter and dape.el to play nice with the client-server attachment facility in the dape protocol, and dape.el didn't help me much here in terms of why


nor, for that matter, did the Microsoft-provided DAP debug adapter you use. Error handling in the DAP client/server seems poor or not designed, surprise surprise, for anything but VSCode or whatever.

I could, after a fair bit of wrangling, get it to work by starting the process for me and then have it hook into whatever it needs to do to work. That does seem to work. I never did get attachment to work, rendering it useless in a webapp or even for my usual workflow of throwing down a breakpoint() and having ipdb (or whatever) pick up from there.

Other problems I've encountered is a weird way that it stores configuration options once you've told dape to connect to stuff. The UX around that needs work before it's plug-and-play.

The other criticism is that it does not, and this might be a DAP thing and not a dape thing, work with the default GDB-like shorthands (c for continue, etc.). Maybe that's just how it is; but it's little things like that.

Being able to see all the relevant variables, a la the GDB multi-window support in Emacs, is also nice. Which makes me wonder why we can't just reuse that, as there's surely man-years of work to make that stable and effective.

Still, an impressive effort, and I'm surprised how little code dape actually is. I'm sure it'll improve quickly once people start giving feedback.

[–] svaante@alien.top 1 points 1 year ago (2 children)

Expect to debug the dape debugger

Did you use the debugpy adapter with the following configuration from the readme? (add-to-list 'dape-configs `(debugpy modes (python-ts-mode python-mode) command "python3" command-args ("-m" "debugpy.adapter") :type "executable" :request "launch" :cwd dape-cwd-fn :program dape-find-file-buffer-default))

I have tested this quite often at my day job so I am a bit surprised you bumped into issues. But thats not to say that Dape will contain warts until there is enough feedback and testing. It would be great if you could dump the contents of the dape-debug buffer into an issue on github!

DAP has some issues as well, extremely loose specification, the overwhelming majority is tested with vscode and a lot of cruff is hidden inside in the plugins for vscode. I was close to putting it in the bin at several points.

Other problems I've encountered is a weird way that it stores configuration options once you've told dape to connect to stuff. The UX around that needs work before it's plug-and-play.

Usability feedback is appreciated, the dape command tries to do a lot of stuff, maybe to much.

It models the way one would use a command line tool. For example if we run dape debugpy it executes the configuration above with all of the plist entries as the default command line arguments. If we want to overwrite any "argument" or add an "argument", lets say we wanted to run the python file with some enviroment variable then call dape with debugpy :env (:ENV "MY_ENV").

The other part is actually evaluating all of the symbols and functions in the config and adds the result into history for ease of access.

Being able to see all the relevant variables, a la the GDB multi-window support in Emacs, is also nice. Which makes me wonder why we can't just reuse that, as there's surely man-years of work to make that stable and effective.

I am regretting not looking into this when I started, even though I kinda like having one "big" buffer with all of the information, using the tried and true GUD interface would meld better with one of the goals of package of being closer to emacs. So I am looking into the possibilities.

Still, an impressive effort, and I'm surprised how little code dape actually is. I'm sure it'll improve quickly once people start giving feedback.

Thank you, it would not have been possible for me to get this far without Wireshark. A little reverse engineering is always fun :) And thanks for your feedback!

[–] mickeyp@alien.top 1 points 1 year ago

Did you use the debugpy adapter with the following configuration from the readme?

Of course.

DAP has some issues as well, extremely loose specification, the overwhelming majority is tested with vscode and a lot of cruff is hidden inside in the plugins for vscode. I was close to putting it in the bin at several points.

Yes, indeed.

[–] FreeAd7233@alien.top 1 points 1 year ago

I just tried the example configuration (for python) from github and the dap works perfectly fine to me, everything works as expected except the only one thing: post-run cleanup.

I do notice that there are some leak problems: the debugpy process will not exit even when the debug session terminated, keeping high CPU usage even after emacs exits.

It is a tricky problem and not easily reproduce, I will try to dive into this problem more to make it as reproducible as possible.

Besides, the go debugger (delve) works perfectly to me with the example configuration.