proc/native, proc/gdbserial: StepInstruction without goroutine

proc.Process.StepInstruction should work even if there is no goroutine
selected.
This commit is contained in:
aarzilli
2017-06-23 14:22:26 +02:00
committed by Derek Parker
parent e9e0830054
commit 5c2673a632
3 changed files with 50 additions and 22 deletions

View File

@ -19,6 +19,7 @@ import (
"testing"
"time"
"github.com/derekparker/delve/pkg/dwarf/frame"
"github.com/derekparker/delve/pkg/proc"
"github.com/derekparker/delve/pkg/proc/gdbserial"
"github.com/derekparker/delve/pkg/proc/native"
@ -2954,3 +2955,29 @@ func TestIssue877(t *testing.T) {
}
})
}
func TestIssue893(t *testing.T) {
// Test what happens when next is called immediately after launching the
// executable, acceptable behaviors are: (a) no error, (b) no source at PC
// error.
protest.AllowRecording(t)
withTestProcess("increment", t, func(p proc.Process, fixture protest.Fixture) {
err := proc.Next(p)
if err == nil {
return
}
if _, ok := err.(*frame.NoFDEForPCError); ok {
return
}
assertNoError(err, t, "Next")
})
}
func TestStepInstructionNoGoroutine(t *testing.T) {
protest.AllowRecording(t)
withTestProcess("increment", t, func(p proc.Process, fixture protest.Fixture) {
// Call StepInstruction immediately after launching the program, it should
// work even though no goroutine is selected.
assertNoError(p.StepInstruction(), t, "StepInstruction")
})
}