aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_debug_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-11-06 15:11:20 -0800
committerBrad Fitzpatrick <bradfitz@golang.org>2019-11-08 18:39:41 +0000
commit0c8f6cc07c33f99b300c1337c9ccd76bf7e69910 (patch)
tree8f778b41b71021d3d3a5ec453c2423f0fb61a879 /src/runtime/export_debug_test.go
parent7714dcacbca1961543fbad0c8bc2a2afc7baaaee (diff)
downloadgo-0c8f6cc07c33f99b300c1337c9ccd76bf7e69910.tar.xz
runtime: if InjectDebugCall sees "not at safe point", keep trying
Fixes #35376 Change-Id: Ib95ad336425e73cc4d412dafed0ba5e0a8130bd2 Reviewed-on: https://go-review.googlesource.com/c/go/+/205718 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/runtime/export_debug_test.go')
-rw-r--r--src/runtime/export_debug_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/export_debug_test.go b/src/runtime/export_debug_test.go
index 7deddd52ea..7ae12f6da3 100644
--- a/src/runtime/export_debug_test.go
+++ b/src/runtime/export_debug_test.go
@@ -20,7 +20,7 @@ import (
//
// 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) error) (interface{}, error) {
+func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int) error, returnOnUnsafePoint bool) (interface{}, error) {
if gp.lockedm == 0 {
return nil, plainError("goroutine not locked to thread")
}
@@ -64,6 +64,12 @@ func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int) error) (in
notetsleepg(&h.done, -1)
if h.err != "" {
switch h.err {
+ case "call not at safe point":
+ if returnOnUnsafePoint {
+ // This is for TestDebugCallUnsafePoint.
+ return nil, h.err
+ }
+ fallthrough
case "retry _Grunnable", "executing on Go runtime stack":
// These are transient states. Try to get out of them.
if i < 100 {