debugger: add missing targetMutex protection to CreateWatchpoint() (#3973)

as discussed in https://github.com/go-delve/delve/issues/3970#issuecomment-2779013352 ,
CreateWatchpoint() is missing mutex protection. This commit corrects
this oversight
This commit is contained in:
Joël Pepper
2025-04-07 20:43:45 +02:00
committed by GitHub
parent 4dc820ee3c
commit cc4343bff6

View File

@ -989,6 +989,9 @@ func (d *Debugger) findBreakpointByName(name string) *api.Breakpoint {
// CreateWatchpoint creates a watchpoint on the specified expression.
func (d *Debugger) CreateWatchpoint(goid int64, frame, deferredCall int, expr string, wtype api.WatchType) (*api.Breakpoint, error) {
d.targetMutex.Lock()
defer d.targetMutex.Unlock()
p := d.target.Selected
s, err := proc.ConvertEvalScope(p, goid, frame, deferredCall)