proc: bugfix: Next and normal calls to deferred function

When a deferred function is called directly Next and StepOut should not
step into it.

Fixes #582
This commit is contained in:
aarzilli
2016-07-14 09:43:39 +02:00
parent fb8388ab2e
commit 8d58262020
4 changed files with 123 additions and 6 deletions

View File

@ -1907,3 +1907,30 @@ func TestTestvariables2Prologue(t *testing.T) {
}
})
}
func TestNextDeferReturnAndDirectCall(t *testing.T) {
// Next should not step into a deferred function if it is called
// directly, only if it is called through a panic or a deferreturn.
// Here we test the case where the function is called by a deferreturn
testnext("defercall", []nextTest{
{9, 10},
{10, 11},
{11, 12},
{12, 13},
{13, 5},
{5, 6},
{6, 7},
{7, 13},
{13, 28}}, "main.callAndDeferReturn", t)
}
func TestNextPanicAndDirectCall(t *testing.T) {
// Next should not step into a deferred function if it is called
// directly, only if it is called through a panic or a deferreturn.
// Here we test the case where the function is called by a panic
testnext("defercall", []nextTest{
{15, 16},
{16, 17},
{17, 18},
{18, 5}}, "main.callAndPanic2", t)
}