提交 b5cf5845 编写于 作者: A aarzilli 提交者: Derek Parker

proc/gdbserial: backward continue should stop at start of process

ContinueOnce didn't detect the way RR signals that it has reached the
start of the process and would never finish.

Fixes #1376
上级 f72c48c0
......@@ -697,6 +697,14 @@ continueLoop:
// process so we must stop here.
case 0x91, 0x92, 0x93, 0x94, 0x95, 0x96: /* TARGET_EXC_BAD_ACCESS */
break continueLoop
// Signal 0 is returned by rr when it reaches the start of the process
// in backward continue mode.
case 0:
if p.conn.direction == proc.Backward {
break continueLoop
}
default:
// any other signal is always propagated to inferior
}
......
package gdbserial_test
import (
"flag"
"fmt"
"os"
"os/exec"
......@@ -8,12 +9,17 @@ import (
"runtime"
"testing"
"github.com/derekparker/delve/pkg/logflags"
"github.com/derekparker/delve/pkg/proc"
"github.com/derekparker/delve/pkg/proc/gdbserial"
protest "github.com/derekparker/delve/pkg/proc/test"
)
func TestMain(m *testing.M) {
var logConf string
flag.StringVar(&logConf, "log", "", "configures logging")
flag.Parse()
logflags.Setup(logConf != "", logConf)
os.Exit(protest.RunTestsWithFixtures(m))
}
......@@ -251,3 +257,16 @@ func TestCheckpoints(t *testing.T) {
}
})
}
func TestIssue1376(t *testing.T) {
// Backward Continue should terminate when it encounters the start of the process.
protest.AllowRecording(t)
withTestRecording("continuetestprog", t, func(p *gdbserial.Process, fixture protest.Fixture) {
bp := setFunctionBreakpoint(p, t, "main.main")
assertNoError(proc.Continue(p), t, "Continue (forward)")
_, err := p.ClearBreakpoint(bp.Addr)
assertNoError(err, t, "ClearBreakpoint")
assertNoError(p.Direction(proc.Backward), t, "Switching to backward direction")
assertNoError(proc.Continue(p), t, "Continue (backward)")
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册