mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 10:47:27 +08:00 
			
		
		
		
	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:
		| @ -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) { | func TestStepOutDefer(t *testing.T) { | ||||||
| 	protest.AllowRecording(t) | 	protest.AllowRecording(t) | ||||||
| 	withTestProcess("testnextdefer", t, func(p *proc.Target, fixture protest.Fixture) { | 	withTestProcess("testnextdefer", t, func(p *proc.Target, fixture protest.Fixture) { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Suzy Mueller
					Suzy Mueller