While the Language Server Protocol (LSP) has quickly become an industry standard in the devtools domain and Eclipse IDE promptly got support for it with the Eclipse LSP4J and LSP4E projects, LSP is only targetting the code edition activity. However, code edition is just one activity amongst others for a developer, and some would argue that it's not the main use-case that justifies usage of an IDE over a simple text editor.
One of the most important activity (where IDEs are usually better than other tools) for a developer is debugging: watching a program run, digging hints of what could be wrong, experimenting things against the running application... Similarly to the Language Server Protocol, as part of Visual Studio Code, a JSON-based language and tool agnostic protocol was created to support typical debug interactions and facilitate the binding of a devtool with a debugger. Eclipse LSP4J and LSP4E enabled in early 2018 support for this Debug Adapter Protocol in Eclipse IDE.
Eclipse aCute, providing an IDE for C# and .NET Core, managed to use this Debug Adapter Protocol and the existing integrations with Eclipse IDE to relatively easily and quickly integrate support for netcoredbg, an open-source debugger for .NET Core.
In this presentation, we'll explain how the Debug Adapter Protocol works, how LSP4J can be used to support it in any Java application (either a debugger or a client), how LSP4E can be used to support it out-of-the-box in Eclipse IDE, and we'll use aCute example to show how plugin providers can extend LSP4E and provide the final steps of a good and simple UX.
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Adopting Debug Adapter Protocol in Eclipse IDE: netcoredbg (.NET debugger) case study - EclipseCon Europe 2918
1. Adopting Debug Adapter Protocol in Eclipse IDE
netcoredbg (.NET debugger) case study
Mickael Istria
@mickaelistria
And bits from Tracy Miranda
Jonah Graham
3. Benefits of a Common Debug
Protocol
• Separation of client/server
• Debug adapters are unit testable
• Write in language most suited for the given debugger or
runtime
• Reuse across IDEs & developer tools
• Faster pace with underlying tools
4. Debug Adapter Protocol
● “Language Server Protocol, but for debug”
– message/response/notification
– Json-based (easy to produce/parse in any language)
– Grain of operations focused on debug actions
5. Benefits
● “Language Server Protocol, but for debug”
– IDE and Debug Adapter implemented independently
● Different timing
● Different community
● Different languages
● Different frameworks
● As long as they talk the same protocol
7. State of Debug Adapter Protocol
• Microsoft defined debug protocol. https://microsoft.github.io/debug-adapter-
protocol/
• 26 33 implementations available https://microsoft.github.io/debug-adapter-
protocol/implementors/adapters/
• Older than Language Server Protocol
• Communicates stdin/stdout
• Not JSON-RPC (but JSON)
• Less mature than LSP
• Headline functionality available but lots missing compared to Eclipse
8. LLVM Node .NET Core C/C++ Dart Unity Python ...
Eclipse IDE
VSCode
Visual Studio
Visual Studio Mac
Emacs
Eclipse Theia
...
LLVM
Node
.NET Core
C/C++
Dart
Python
...
Debug Adapter Protocol
M debuggers (32)
N IDEs/Editors (6)
x
M debuggers (32)
N IDEs/Editors (6)
+ Simpler and reusable
Integrations (38)
Complex and specific
Integrations (192)
Eclipse IDE
VSCode
Visual Studio
Visual Studio Mac
Emacs
Eclipse Theia
...
10. Next Steps (from last year)
• Debug Client in Eclipse IDE
• DSP4E
• New project or make part of an existing project?
• Debug Client in Che
• Submit pull request
• Enhance Debug Protocol
• Start supporting additional features
11. Next Steps (from last year)
• Debug Client in Eclipse IDE
• DSP4E
• New project or make part of an existing project?
• Debug Client in Che
• Submit pull request
• Enhance Debug Protocol
• Start supporting additional features
POJO API
Services/Model
In Eclipse LSP4J
UI in Eclipse LSP4E
Che moving to Theia as IDE, contribution to legacy
IDE abandoned
But Theia already supports DAP
Not high priority at the moment
12. DAP vs other debug “protocols”
● GDB/LLDB/... MI
– Very popular
– very well supported in Eclipse IDE (CDT)
– But misses some qualities for a protocol (like a specification)
https://kichwacoders.com/2017/08/02/gdbs-mi-is-not-a-debug-
protocol/
● Still, at the moment in Eclipse IDE,
GDB MI support > DAP support
13. Conclusion (from 2017)
The Debug Protocol provides all the same advantages of
the Language Server Protocol.
While less evolved it shows huge potential provided the
protocol can adapt to accommodate missing functionality.
Going forward it gives us an effective way to maintain
debuggers in Eclipse and future cloud IDEs.
14. Debug launch⊃
Debug connect⊃
● DAP First message describes how to
– Launch the program to debug (arguments, path…), or
– Connect to the program to debug (PID, JMX address...)
● User defined Json configuration
– Launch/connect configuration described in a “freeform” (not
specified, too open) json message
– Launch.json directly edited by end-user in VSCode
Generated through Launch Configuration UI in Eclipse IDE
18. Debug Adapter in Eclipse IDE -
stack
● org.eclipse.acute integrates netcoredbg and implements
C#debug features are a specialization and configutation of…
● org.eclipse.lsp4e.debug maps IDE actions as debug adapter
operations/data.
It uses…
● org.eclipse.lsp4j.debug POJO API that provides model,
services to send and receive messages… (Reusable in any Java
program to build a client or a server).
19. Launch Configurations
● Launch Configurations UI: Manipulate the
ILaunchConfiguration properties
● DSPLaunchDelegate use
ILaunchConfiguration to start debug adapter
(invoking org.eclipse.lsp4j.debug APIs).
20. LSP4E’s Generic UI and
DSPLaunchDelegate
screenshot
+++ Generic/Universal
(for all Debug Adapters)
--- Very technical
21. Under the hood
● DSPLaunchConfiguration builds a specific
Eclipse Debug model (implementing Platform’s
interfaces)
● Eclipse debug UI uses the generic interfaces
● Operations against those generic interfaces cascade
to IDebugProtocolServer read/write
requests/responses/notifications with Debug Adapter
23. This “params”...
● … is extremely important
● … is a free-form unspecified piece of JSon
● … is specific to the Debug Adapter
● … requires to make more user friendly adapter-specific
integration
– Create specific launch type extension
org.eclipse.debug.core.launchConfigurationTypes
– Create specific UI extension org.eclipse.debug.ui.launchConfigurationTabGroups
25. ♩ Tell me more! Tell me more! ♩
● org.eclipse.lsp4e.debug can be used to
implement
– Other Java clients (Netbeans, IJ…) so they can easily integrate
any existing debug adapter
– Java-based debug adapters (Apache Camel over JMX…) so they
can be easily integrated in other DAP-able clients
● Other IDEs (including Eclipse Theia/Che) have a
similar story.
27. Adopting Debug Adapter Protocol in Eclipse IDE
netcoredbg (.NET debugger) case study
Mickael Istria
@mickaelistria
And bits from Tracy Miranda
Jonah Graham
Questions about?