未验证 提交 df5812bf 编写于 作者: S Suzy Mueller 提交者: GitHub

pkg/proc: add tests for next interrupted by bp (#2632)

Adds tests that make sure that when a next request
is interrupted by a breakpoint, the stepping breakpoints
are cleared.
上级 10406f96
......@@ -2545,6 +2545,40 @@ func TestStepConcurrentPtr(t *testing.T) {
})
}
func TestStepOutBreakpoint(t *testing.T) {
protest.AllowRecording(t)
withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) {
bp := setFileBreakpoint(p, t, fixture.Source, 13)
assertNoError(p.Continue(), t, "Continue()")
p.ClearBreakpoint(bp.Addr)
// StepOut should be interrupted by a breakpoint on the same goroutine.
setFileBreakpoint(p, t, fixture.Source, 14)
assertNoError(p.StepOut(), t, "StepOut()")
assertLineNumber(p, t, 14, "wrong line number")
if p.Breakpoints().HasSteppingBreakpoints() {
t.Fatal("has internal breakpoints after hitting breakpoint on same goroutine")
}
})
}
func TestNextBreakpoint(t *testing.T) {
protest.AllowRecording(t)
withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) {
bp := setFileBreakpoint(p, t, fixture.Source, 34)
assertNoError(p.Continue(), t, "Continue()")
p.ClearBreakpoint(bp.Addr)
// Next should be interrupted by a breakpoint on the same goroutine.
setFileBreakpoint(p, t, fixture.Source, 14)
assertNoError(p.Next(), t, "Next()")
assertLineNumber(p, t, 14, "wrong line number")
if p.Breakpoints().HasSteppingBreakpoints() {
t.Fatal("has internal breakpoints after hitting breakpoint on same goroutine")
}
})
}
func TestStepOutDefer(t *testing.T) {
protest.AllowRecording(t)
withTestProcess("testnextdefer", t, func(p *proc.Target, fixture protest.Fixture) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册