runtime: record parent goroutine ID, and print it in stack traces

Fixes #38651

Change-Id: Id46d684ee80e208c018791a06c26f304670ed159
Reviewed-on: https://go-review.googlesource.com/c/go/+/435337
Run-TryBot: Nick Ripley <nick.ripley@datadoghq.com>
Reviewed-by: Ethan Reesor <ethan.reesor@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Nick Ripley 2022-09-28 14:44:56 -04:00 committed by Gopher Robot
parent 81eda3a339
commit 51225f6fc6
7 changed files with 44 additions and 6 deletions

View file

@ -540,6 +540,10 @@ func Getg() *G {
return getg()
}
func Goid() uint64 {
return getg().goid
}
func GIsWaitingOnMutex(gp *G) bool {
return readgstatus(gp) == _Gwaiting && gp.waitreason.isMutexWait()
}