Since redhat-developer#1974, a 'capabilities' event changes the capabilities which
DAPClient reads, but what the configuration had sent with the earlier
ones stayed as it was until something else changed:
- function or data breakpoints, which an event enables, were sent only
with the next change of the breakpoints;
- the exception breakpoint filters, and whether their conditions are
sent as filter options, stayed those of the 'initialize' response;
- the instruction breakpoints were never sent to a DAP server which
supports disassembling only after the configuration.
Once the configuration is done, an event now sends again, to the DAP
server which sent it only, what it changed:
- the function or the data breakpoints, when it turns their support on
or off, through the synchronized send of their handler, with the new
BreakpointHandlerBase.sendBreakpoints(server);
- the exception breakpoint filters, when the filters (but for their
'default') or 'supportsExceptionFilterOptions' change: the "Exception
Breakpoints" panel shows them on the EDT, with the user's choices for
the filters which it showed already, and 'setExceptionBreakpoints'
sends the enabled ones;
- the instruction breakpoints, when it turns 'supportsDisassembleRequest'
on: the disassembly breakpoint handler is initialized for the DAP
server, once.
Each step of the configuration keeps the capabilities which it sent
with. An event which arrives before a step changes what the step sends,
and one which arrives after it is applied once the configuration is
done, so that nothing is sent twice and nothing is missed. Line
breakpoints don't depend on the capabilities and are not sent again,
and nothing is sent to a program which runs without debugging.
A follow-up of #1974. Its description lists what it left out: some capabilities are read only once, during the configuration, so a
capabilitiesevent that changed them later had no effect yet.Change
Once the configuration is done, a
capabilitiesevent now sends again what it changed, to the DAP server that sent it only:BreakpointHandlerBase.sendBreakpoints(server), which does nothing for a server the handler wasn't initialized for.default) orsupportsExceptionFilterOptionschange. The Exception Breakpoints panel shows them on the EDT, keeping the user's choices for the filters it already showed, andsetExceptionBreakpointssends the enabled ones.supportsDisassembleRequeston. The disassembly breakpoint handler is then initialized for that server, once.Line breakpoints send their condition, hit condition and log message whatever the capabilities say, so they aren't sent again. Nothing is sent to a program that runs without debugging.
During the configuration, each step keeps the capabilities it sent with:
configurationDone, is applied once the configuration is done.So nothing is sent twice, and nothing is missed. A lock in
DAPClientmakes a step's read-and-send and an event take turns. Both run on LSP4J's reader thread anyway.Questions
How this was checked
DAPClientCapabilitiesEventTest(10 tests) runs end to end: a realDAPDebugProcessandDAPClientagainst a mock debug adapter over a socket. It covers:default, or no check for a debug run. Each test catches its variant.DAPBreakpointHandlerBaseTest.testTheBreakpointsAreSentAgainToAnInitializedDebugAdapterOnlycovers the new method's guard.