aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2020-04-15 15:38:00 -0400
committerAustin Clements <austin@google.com>2020-04-29 21:29:11 +0000
commit3633d2c545cf21c2803103e1036f17f19b4ae6fa (patch)
tree553534fde5b03bcf11b4fb0747efad61a1d15e82 /src/runtime/runtime2.go
parentb3863fbbc2fe1dbf516111992854aa9178d01410 (diff)
downloadgo-3633d2c545cf21c2803103e1036f17f19b4ae6fa.tar.gz
go-3633d2c545cf21c2803103e1036f17f19b4ae6fa.zip
runtime: perform debug call injection on a new goroutine
Currently, when a debugger injects a call, that call happens on the goroutine where the debugger injected it. However, this requires significant runtime complexity that we're about to remove. To prepare for this, this CL switches to a different approach that leaves the interrupted goroutine parked and runs the debug call on a new goroutine. When the debug call returns, it resumes the original goroutine. This should be essentially transparent to debuggers. It follows the exact same call injection protocol and ensures the whole protocol executes indivisibly on a single OS thread. The only difference is that the current G and stack now change part way through the protocol. For #36365. Change-Id: I68463bfd73cbee06cfc49999606410a59dd8f653 Reviewed-on: https://go-review.googlesource.com/c/go/+/229299 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 15e24c8175..89a2419110 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -980,6 +980,7 @@ const (
waitReasonWaitForGCCycle // "wait for GC cycle"
waitReasonGCWorkerIdle // "GC worker (idle)"
waitReasonPreempted // "preempted"
+ waitReasonDebugCall // "debug call"
)
var waitReasonStrings = [...]string{
@@ -1009,6 +1010,7 @@ var waitReasonStrings = [...]string{
waitReasonWaitForGCCycle: "wait for GC cycle",
waitReasonGCWorkerIdle: "GC worker (idle)",
waitReasonPreempted: "preempted",
+ waitReasonDebugCall: "debug call",
}
func (w waitReason) String() string {