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)

  • JDRiverRun@alien.topB
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    How would you attach a DAP python debugger to a running instance of (i)Python? Is there some import debugpy; debugpy.start() command or similar?

    • FreeAd7233@alien.topOPB
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 months ago

      I believe this is out of the scope of the DAP protocol, I believe even VSCode cannot do it based on my understanding.

      If you want to debug a running session, just use ipdb or pdb.

    • svaante@alien.topB
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 months ago

      There is

      In python:

      import debugpy
      debugpy.listen(5678) # debugpy will open 5678
      

      Then add the following configuration to dape

      (add-to-list 'dape-configs
      `(debugpy-attach
        modes ()
        host "localhost"
        port ,(lambda () (read-number "Port: "))
        :type "debugpy"
        :request "attach"))
      

      Supposedly there is a way to attach by pid with python3 -m debugpy --listen localhost:5678 --pid 12345, but that failed, both on osx and linux.