
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()
|
|
}
|