Class EpsilonDebugAdapter

java.lang.Object
org.eclipse.epsilon.eol.dap.EpsilonDebugAdapter
All Implemented Interfaces:
org.eclipse.lsp4j.debug.services.IDebugProtocolServer

public class EpsilonDebugAdapter extends Object implements org.eclipse.lsp4j.debug.services.IDebugProtocolServer

Implements the Debug Adapter Protocol for Epsilon scripts. Only supports attaching to existing modules.

For details about DAP, see Microsoft's website.

  • Field Details

    • STOP_AT_EVERY_STATEMENT

      public static final String STOP_AT_EVERY_STATEMENT
      If this key is set to "true" upon attaching, line breakpoints (without an explicit column) will stop at each statement instead of just the first one.
      See Also:
    • FIRST_THREAD_ID

      public static final int FIRST_THREAD_ID
      See Also:
  • Constructor Details

    • EpsilonDebugAdapter

      public EpsilonDebugAdapter()
  • Method Details

    • createStream

      protected PrintStream createStream(IEolContext context, String category)
    • attachTo

      protected EpsilonDebugAdapter.ThreadState attachTo(IEolModule module)
    • connect

      public void connect(org.eclipse.lsp4j.debug.services.IDebugProtocolClient client)
    • initialize

      public CompletableFuture<org.eclipse.lsp4j.debug.Capabilities> initialize(org.eclipse.lsp4j.debug.InitializeRequestArguments args)
      Specified by:
      initialize in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • attach

      public CompletableFuture<Void> attach(Map<String,Object> args)
      Specified by:
      attach in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • threads

      public CompletableFuture<org.eclipse.lsp4j.debug.ThreadsResponse> threads()
      Specified by:
      threads in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • evaluate

      public CompletableFuture<org.eclipse.lsp4j.debug.EvaluateResponse> evaluate(org.eclipse.lsp4j.debug.EvaluateArguments args)
      Specified by:
      evaluate in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • stackTrace

      public CompletableFuture<org.eclipse.lsp4j.debug.StackTraceResponse> stackTrace(org.eclipse.lsp4j.debug.StackTraceArguments args)
      Specified by:
      stackTrace in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • resolveStackFrameLocation

      protected org.eclipse.lsp4j.jsonrpc.messages.Tuple.Two<ModuleElement,org.eclipse.lsp4j.debug.Source> resolveStackFrameLocation(IModule module, Frame sf)
    • scopes

      public CompletableFuture<org.eclipse.lsp4j.debug.ScopesResponse> scopes(org.eclipse.lsp4j.debug.ScopesArguments args)
      Specified by:
      scopes in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • variables

      public CompletableFuture<org.eclipse.lsp4j.debug.VariablesResponse> variables(org.eclipse.lsp4j.debug.VariablesArguments args)
      Specified by:
      variables in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • terminate

      public CompletableFuture<Void> terminate(org.eclipse.lsp4j.debug.TerminateArguments args)
      Specified by:
      terminate in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • disconnect

      public CompletableFuture<Void> disconnect(org.eclipse.lsp4j.debug.DisconnectArguments args)
      Specified by:
      disconnect in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • setExceptionBreakpoints

      public CompletableFuture<org.eclipse.lsp4j.debug.SetExceptionBreakpointsResponse> setExceptionBreakpoints(org.eclipse.lsp4j.debug.SetExceptionBreakpointsArguments args)
      Specified by:
      setExceptionBreakpoints in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • setBreakpoints

      public CompletableFuture<org.eclipse.lsp4j.debug.SetBreakpointsResponse> setBreakpoints(org.eclipse.lsp4j.debug.SetBreakpointsArguments args)
      Specified by:
      setBreakpoints in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • updateResponseBreakpointFromResult

      protected void updateResponseBreakpointFromResult(String sourcePath, org.eclipse.lsp4j.debug.Breakpoint bp, BreakpointResult result)
    • removeAllBreakpoints

      protected void removeAllBreakpoints(String sourcePath)
    • continue_

      public CompletableFuture<org.eclipse.lsp4j.debug.ContinueResponse> continue_(org.eclipse.lsp4j.debug.ContinueArguments args)
      Specified by:
      continue_ in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • stepIn

      public CompletableFuture<Void> stepIn(org.eclipse.lsp4j.debug.StepInArguments args)
      Specified by:
      stepIn in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • next

      public CompletableFuture<Void> next(org.eclipse.lsp4j.debug.NextArguments args)
      Specified by:
      next in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • stepOut

      public CompletableFuture<Void> stepOut(org.eclipse.lsp4j.debug.StepOutArguments args)
      Specified by:
      stepOut in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • createSource

      protected org.eclipse.lsp4j.debug.Source createSource(BreakpointResult result, String sourcePath)
    • createSource

      protected org.eclipse.lsp4j.debug.Source createSource(ModuleElement resolvedModule)
      Creates a DAP Source object from a module element. It will prefer using files if available (as they will probably be the same as those in the IDE), but it will fall back to URIs if there is no file to refer back to.
    • populateSourceFromMappings

      protected void populateSourceFromMappings(org.eclipse.lsp4j.debug.Source bpSource, URI moduleURI, Path path)
    • mapUriToSourcePath

      protected void mapUriToSourcePath(String uri, org.eclipse.lsp4j.debug.Source bpSource)
    • sendExited

      protected void sendExited(int exitCode)
    • sendTerminated

      protected void sendTerminated()
    • sendOutput

      protected void sendOutput(IEolContext context, String category, String output)
    • sendStopped

      protected void sendStopped(int threadId, String reason)
    • sendThreadEvent

      protected void sendThreadEvent(int threadId, String reason)
    • getModule

      public IEolModule getModule()
    • setModule

      public void setModule(IEolModule module)
    • setOnAttach

      public void setOnAttach(Runnable onAttach)
    • getUriToPathMappings

      public Map<URI,Path> getUriToPathMappings()
      Mappings from module URIs to filesystem paths. Useful when debugging code that is loaded from a non-file URI. When populating it, users must ensure that URIs referring to a folder have a trailing slash.
    • suspend

      protected void suspend(int threadId, ModuleElement ast, SuspendReason reason) throws InterruptedException
      Throws:
      InterruptedException
    • resumeAllThreads

      protected void resumeAllThreads()