mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 12:59:01 +08:00
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:
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user