}
func TestDebugCall(t *testing.T) {
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
+
g, after := startDebugCallWorker(t)
defer after()
x1: 42.0,
}
}
+
if _, err := runtime.InjectDebugCall(g, fn, ®s, args, debugCallTKill, false); err != nil {
t.Fatal(err)
}
}
func TestDebugCallLarge(t *testing.T) {
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
+
g, after := startDebugCallWorker(t)
defer after()
}
func TestDebugCallGC(t *testing.T) {
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
+
g, after := startDebugCallWorker(t)
defer after()
}
func TestDebugCallGrowStack(t *testing.T) {
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
+
g, after := startDebugCallWorker(t)
defer after()
// This can deadlock if there aren't enough threads or if a GC
// tries to interrupt an atomic loop (see issue #10958).
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(8))
+
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
defer debug.SetGCPercent(debug.SetGCPercent(-1))
// Test that the runtime refuses call injection at unsafe points.
// This can deadlock if there aren't enough threads.
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(8))
+ // InjectDebugCall cannot be executed while a GC is actively in
+ // progress. Wait until the current GC is done, and turn it off.
+ //
+ // See #49370.
+ runtime.GC()
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
+
ready := make(chan *runtime.G)
var stop uint32
defer atomic.StoreUint32(&stop, 1)
}
func (h *debugCallHandler) inject(info *siginfo, ctxt *sigctxt, gp2 *g) bool {
+ // TODO(49370): This code is riddled with write barriers, but called from
+ // a signal handler. Add the go:nowritebarrierrec annotation and restructure
+ // this to avoid write barriers.
+
switch h.gp.atomicstatus {
case _Grunning:
if getg().m != h.mp {
}
func (h *debugCallHandler) handle(info *siginfo, ctxt *sigctxt, gp2 *g) bool {
- // Sanity check.
+ // TODO(49370): This code is riddled with write barriers, but called from
+ // a signal handler. Add the go:nowritebarrierrec annotation and restructure
+ // this to avoid write barriers.
+
+ // Double-check m.
if getg().m != h.mp {
println("trap on wrong M", getg().m, h.mp)
return false