proc: Implement target.Interface for gdbserver backend

This commit is contained in:
aarzilli
2017-02-10 15:11:40 +01:00
committed by Derek Parker
parent c1879472a1
commit c8d9352522
24 changed files with 3078 additions and 294 deletions

View File

@ -6,24 +6,40 @@ import (
"syscall"
"testing"
"time"
"runtime"
protest "github.com/derekparker/delve/pkg/proc/test"
)
func TestIssue419(t *testing.T) {
if testBackend == "lldb" && runtime.GOOS == "darwin" {
// debugserver bug?
return
}
// SIGINT directed at the inferior should be passed along not swallowed by delve
withTestProcess("issue419", t, func(p *Process, fixture protest.Fixture) {
withTestProcess("issue419", t, func(p IProcess, fixture protest.Fixture) {
_, err := setFunctionBreakpoint(p, "main.main")
assertNoError(err, t, "SetBreakpoint()")
assertNoError(Continue(p), t, "Continue()")
go func() {
for {
time.Sleep(500 * time.Millisecond)
if p.Running() {
time.Sleep(2 * time.Second)
err := syscall.Kill(p.pid, syscall.SIGINT)
if p.Pid() <= 0 {
// if we don't stop the inferior the test will never finish
p.RequestManualStop()
p.Kill()
t.Fatalf("Pid is zero or negative: %d", p.Pid())
return
}
err := syscall.Kill(p.Pid(), syscall.SIGINT)
assertNoError(err, t, "syscall.Kill")
return
}
}
}()
err := Continue(p)
err = Continue(p)
if _, exited := err.(ProcessExitedError); !exited {
t.Fatalf("Unexpected error after Continue(): %v\n", err)
}