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.
This commit is contained in:
parent
10406f96d5
commit
df5812bf2d
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user