mirror of
				https://github.com/go-delve/delve.git
				synced 2025-11-04 06:32:16 +08:00 
			
		
		
		
	Instead of fighting against the normal flow, just signal a SIGTRAP and let the existing flow handle it, as long as we set the halt flag correctly the system should halt.
		
			
				
	
	
		
			20 lines
		
	
	
		
			182 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			182 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package main
 | 
						|
 | 
						|
import "fmt"
 | 
						|
 | 
						|
func loop() {
 | 
						|
	i := 0
 | 
						|
	for {
 | 
						|
		i++
 | 
						|
		if (i % 100000) == 0 {
 | 
						|
			fmt.Println(i)
 | 
						|
		}
 | 
						|
	}
 | 
						|
	fmt.Println(i)
 | 
						|
}
 | 
						|
 | 
						|
func main() {
 | 
						|
	fmt.Println("past main")
 | 
						|
	loop()
 | 
						|
}
 |