-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detecting which breakpoint caused a Stopped event #178
Comments
@logancollins Your request makes sense. But please be aware that a BTW, you can already "simulate" a |
Thank you for considering! I agree that making the parameter optional makes sense for backwards compatibility. If there were a corresponding Also, sorry—I should've been more clear on the actions. They are not actions that are happening within the language being debugged. They are purely within the IDE's UI, so the debuggee has no access to invoke them in any way. But, this is a nice workaround for doing so with the language itself! |
Suggestion if we decide to add this -- multiple breakpoints can be hit at the same time, so I would suggest something like:
Visual Studio currently uses this as a protocol extension for the same purpose. |
+1 to having breakpointIds. Vimspector has client-side emulation of temporary breakpoints (for "run-to-cursor" functionality) and currently guesses if the breakpoint hit was the "run to cursor" breakpoint based purely on matching the line number of the stopped event. having an ID to link these would make it a lot more robust. |
@gregg-miskelly But in order to come up with a good description for the new property I need some help with the semantics of the multiplicity of "hitBreakpointIds". |
This would happen if there were multiple breakpoint requests which wound up mapping to the same instruction. Examples:
|
@gregg-miskelly thanks a lot, that was helpful. Here is my proposal for what gets added to the /**
* Ids of the breakpoints that triggered the event. In most cases there will
* be only a single breakpoint but here are some examples for multiple
* breakpoints:
* - 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.
*/
hitBreakpointIds?: number[]; |
LGTM |
This would also solve my initial request perfectly! |
The feature is now available in the |
The feature is now available in the final 1.46.0 version of the vscode-debugadapter-node npm modules. |
Background: I'm attempting to implement actions that are run by the IDE when specific breakpoints are hit; Actions that are a bit more complex than the protocol provides (which is fine… these actions are purely IDE-specific and aren't really the concern of the adapter). They are actions like "show a specific view when a specific function breakpoint is hit" or "play a specific sound".
With the
Stopped
event, thereason
field can denote that a thread stopped because of abreakpoint
,function breakpoint
, etc. However, I have been running into difficulty planning the best way to know which breakpoint the debugger hit with any accuracy.Once the
Stopped
event arrives, it is possible to request theThread
that stopped, then its individual stack frames (and then even scopes). Then you can begin to correlate on which source line debugging stopped to aBreakpoint
object that was returned from the adapter. But this only works as long as the adapter was able to provide theline
parameter. This is likely to be returned for source breakpoints, but function breakpoints seem to be another matter (as not all adapters would likely be able to accurately resolve line / column information for a function purely by name when adding them.)If this indeed is not directly possible right now, I'd like to propose something like a
breakpointId
attribute of theStopped
event, based on the IDs returned from theSetBreakpoints
orSetFunctionBreakpoints
requests. This way, the IDE can know exactly which resolved breakpoint was hit by the debug adapter. As far as my limited knowledge goes, this would still determine whether a source or function breakpoints was hit, as well.It's also possible that I've entirely overlooked something in the protocol definition that makes this more clear or concrete. If so, I'd be very thankful for any clarification!
The text was updated successfully, but these errors were encountered: