mirror of
https://github.com/go-delve/delve.git
synced 2025-11-03 13:57:33 +08:00
proc/native, proc/gdbserial: StepInstruction without goroutine
proc.Process.StepInstruction should work even if there is no goroutine selected.
This commit is contained in:
@ -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")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user