Exception when setting watchpoints with multi-location breakpoints#558
Merged
Conversation
Fix an uncaught exception occurring when trying to set a watchpoint while breakpoints with multiple locations exist. The reason is that `GDBDebugSessionBase.getWatchpointList()` expected a `type` field in the MI response to `-break-list`, but that is not present for the location lines that occur for multi-location breakpoints (their type is in their parent breakpoint line), at least with my GDB 9.2 and 11.2.
omarArm
approved these changes
Jun 25, 2026
omarArm
left a comment
Contributor
There was a problem hiding this comment.
Good catch, thanks for fixing this. LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An uncaught exception occurs when trying to set a watchpoint while breakpoints with multiple locations exist. The reason is that
GDBDebugSessionBase.getWatchpointList()expects atypefield in the MI response to-break-list, but that is not present for the location lines that occur for multi-location breakpoints (their type is in their parent breakpoint line), at least with my GDB 9.2 and 11.2:The attached commit fixes that.
Steps to reproduce:
Set a function breakpoint on
staticfunc1(this exists in both count space.c and count_other.c).Launch a debug session like this:
Pause the program. It stops in the infinite loop in
main()in count.c.In the Variables view, right-click on local variable
countand choose Break on Value ChangeActual Result
Output
{}in the Debug Console (of both the client, and, if you are running the adapter in the debugger, the adapter), and no watchpoint is actually set in GDB. If you set a breakpoint in theuncaughtExceptionhandler in debugAdapter.ts, it is hit.Expected Result
No error. Continuing the program makes it stop on the watchpoint immediately. Setting another watchpoint on variable
anotherworks too, and after that the program alternatingly stops on the two respective lines. After deleting one watchpoint, it only stops on the other line. After deleting the second watchpoint, it does not stop anymore.