proc: return error when assigning between function variables (#2692)

Fixes #2691
This commit is contained in:
Alessandro Arzilli
2021-10-13 17:44:59 +02:00
committed by GitHub
parent 1893c9769b
commit bdcbcc6836
2 changed files with 22 additions and 0 deletions

View File

@ -5681,3 +5681,18 @@ func TestWatchpointStackBackwardsOutOfScope(t *testing.T) {
}
})
}
func TestSetOnFunctions(t *testing.T) {
// The set command between function variables should fail with an error
// Issue #2691
withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) {
setFunctionBreakpoint(p, t, "main.main")
assertNoError(p.Continue(), t, "Continue()")
scope, err := proc.GoroutineScope(p, p.CurrentThread())
assertNoError(err, t, "GoroutineScope")
err = scope.SetVariable("main.func1", "main.func2")
if err == nil {
t.Fatal("expected error when assigning between function variables")
}
})
}