*x = 1
 }
 
-func debugCallTKill(tid int) {
-       syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP)
+func debugCallTKill(tid int) error {
+       return syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP)
 }
 
 func TestDebugCall(t *testing.T) {
 
 //
 // On success, InjectDebugCall returns the panic value of fn or nil.
 // If fn did not panic, its results will be available in args.
-func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int)) (interface{}, error) {
+func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int) error) (interface{}, error) {
        if gp.lockedm == 0 {
                return nil, plainError("goroutine not locked to thread")
        }
 
        defer func() { testSigtrap = nil }()
        testSigtrap = h.inject
-       tkill(tid)
+       if err := tkill(tid); err != nil {
+               return nil, err
+       }
        // Wait for completion.
        notetsleepg(&h.done, -1)
        if len(h.err) != 0 {