netcoredbg icon indicating copy to clipboard operation
netcoredbg copied to clipboard

Missed set StoppedEvent#hitBreakpointIds of StoppedEvent (DAP)

Open VISTALL opened this issue 1 year ago • 7 comments

Hello. There no information about active breakpoint on StoppedEvent (DAP) https://github.com/Samsung/netcoredbg/blob/83214c3993c052a0ccb8854b913e028c5e365bc6/src/protocols/vscodeprotocol.cpp#L162

But in other protocols - breakpoint info exists (https://github.com/Samsung/netcoredbg/blob/83214c3993c052a0ccb8854b913e028c5e365bc6/src/protocols/miprotocol.cpp#L411)

event.breakpoint.id

VISTALL avatar Dec 25 '24 17:12 VISTALL

In case of DAP (see https://microsoft.github.io/debug-adapter-protocol/specification) this is optional field, plus, we don't have stop event multiple breakpoint IDs related code implemented for now. This feature still in our "TODO" list, but I have no idea when we will implement it.

viewizard avatar Dec 25 '24 18:12 viewizard

Yeah, optional - but its better for IDE it helps find correct paused breakpoint. I tested it with my patch https://github.com/consulo/netcoredbg/commit/6e4b9cba0d2bb42f1a8f7bb14e478c9bbf4c98fc

Works as expected, but not sure about implementation - need my tests

VISTALL avatar Dec 25 '24 18:12 VISTALL

But you code have wrong logic. In case, for example, code line will have 2 breakpoints with conditions and both conditions will be "true" (or ... different types of breakpoints map to the same location, multiple source breakpoints get collapsed to the same instruction by the compiler/runtime, multiple function breakpoints with different function names map to the same location, ...), wrong (not full) data will be provided in this filed. This why we don't provide it at all. In case this field not provided, IDE will care about all it need with source path and line number or other data (as it usually do).

viewizard avatar Dec 25 '24 18:12 viewizard

In this case MI protocol have same issue - its ignore multiple breakpoints

VISTALL avatar Dec 25 '24 18:12 VISTALL

Why MI should care about multiple breakpoints? MI stop event have only one breakpoint ID (first breakpoint that triggered thread for stop).

viewizard avatar Dec 25 '24 18:12 viewizard

Both of protocol implementation, implement EmitStoppedEvent(StoppedEvent) and convert StoppedEvent to the single protocol event.

Also StoppedEvent have only one Breakpoint breakpoint. It's impossible provide info about other breakpoints in this case.

VISTALL avatar Dec 25 '24 18:12 VISTALL

Correct, no way for "simple fix" for this case with current code. This is why previously I wrote, that we don't have implemented related code for now. Code that find all related active breakpoints for line and interface changes for multiple breakpoints support in stop event should be added first.

viewizard avatar Dec 25 '24 19:12 viewizard