
It seems newer MacOS kernels are sending mach exceptions for watchpoints which contain the hardware register number as opposed to the address which triggered the exception. Also, ARM64 seems to have switched to sending _EXC_I386_SGL as medata[0] for this exception type.
30 lines
399 B
Go
30 lines
399 B
Go
package main
|
|
|
|
import (
|
|
"math/rand"
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
var globalvar1 int
|
|
|
|
func demo(id int, wait *sync.WaitGroup) {
|
|
for i := 0; i < 100; i++ {
|
|
sleep := rand.Intn(10) + 1
|
|
globalvar1 = globalvar1 + 1
|
|
time.Sleep(time.Duration(sleep) * time.Millisecond)
|
|
}
|
|
|
|
wait.Done()
|
|
}
|
|
|
|
func main() {
|
|
wait := new(sync.WaitGroup)
|
|
wait.Add(1)
|
|
wait.Add(1)
|
|
go demo(1, wait)
|
|
go demo(2, wait)
|
|
|
|
wait.Wait()
|
|
}
|