I've looked at scala-debug-adapter a bit now, and it doesn't do very much:
there's some socket stuff and state management, but otherwise it delegates
to the underflying java-debug library which manages the DAP protocol [1].
*That* library does assume use of JDI and supplies JVM-level stuff to DAP
(threads, etc.).

So I think we don't want to rely on the code directly, but could extract
the outer "skeleton" of `DebugServer` [2] to use with Daffodil.

It looks like some of the code from java-debug can be reused without
involving JDI. The java-debug project could be viewed as an implementation
of the DAP communication protocol, coupled with JDI to provide
request/response values to DAP. For example, the `ProtocolServer` [3]
hard-codes the JDI, but there's an `AbstractProtocolServer` which only
handles the DAP communication (as a rough guess).

I think the next step is to play with the library in the prototype repo to
see what is really needed.

.. Adam

[1]
https://github.com/scalacenter/scala-debug-adapter/blob/main/core/src/main/scala/ch/epfl/scala/debugadapter/internal/DebugSession.scala#L35
extends java-debug `ProtocolServer`.
[2]
https://github.com/scalacenter/scala-debug-adapter/blob/main/core/src/main/scala/ch/epfl/scala/debugadapter/DebugServer.scala
[3]
https://github.com/microsoft/java-debug/blob/master/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/ProtocolServer.java#L52

On Thu, Apr 22, 2021 at 1:31 PM John Wass <[email protected]> wrote:

> > dig a bit to see if the DAP-only hooks can be reused without JDI coming
> along for the ride
>
> Cool, that would be good to dig at.  Big win if we can reuse it.
>

Reply via email to