pkg/proc: support watchpoint on nil interface (#3924)

This commit is contained in:
Derek Parker
2025-02-28 02:02:35 -08:00
committed by GitHub
parent 2880422885
commit 1df310a2e3
4 changed files with 73 additions and 21 deletions

View File

@ -649,13 +649,10 @@ func (t *Target) SetWatchpoint(logicalID int, scope *EvalScope, expr string, wty
if xv.Kind == reflect.Interface {
// For interfaces, we want to watch the data they point to
// Read the interface to get the data pointer
_, data, isnil := xv.readInterface()
_, data, _ := xv.readInterface()
if xv.Unreadable != nil {
return nil, fmt.Errorf("error reading interface %q: %v", expr, xv.Unreadable)
}
if isnil {
return nil, fmt.Errorf("can not watch nil interface %q", expr)
}
if data == nil {
return nil, fmt.Errorf("invalid interface %q", expr)
}