]> Cypherpunks repositories - gostls13.git/commit
runtime: make runtime.callers walk calling G, not g0
authorAustin Clements <austin@google.com>
Wed, 20 May 2015 15:50:48 +0000 (11:50 -0400)
committerAustin Clements <austin@google.com>
Thu, 21 May 2015 16:06:37 +0000 (16:06 +0000)
commit719efc70eb84b74a93d236f7c7ddca9901f65436
tree903a606dbd269fd673129baf403b80ae1286861b
parent91191e7b7bc8c0e1a6d49c7a9b3adeb1ab39a423
runtime: make runtime.callers walk calling G, not g0

Currently runtime.callers invokes gentraceback with the pc and sp of
the G it is called from, but always passes g0 even if it was called
from a regular g. Right now this has no ill effects because
runtime.callers does not use either callback argument or the
_TraceJumpStack flag, but it makes the code fragile and will break
some upcoming changes.

Fix this by lifting the getg() call outside of the systemstack in
runtime.callers.

Change-Id: I4e1e927961c0e0cd4dcf28693be47df7bae9e122
Reviewed-on: https://go-review.googlesource.com/10292
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/traceback.go