internal/trace: clarify which StateTransition events have stacks

Clarify that EvGoDestroy, EvGoSyscallEnd and EvGoSyscallEndBlocked do
not have a stack trace by removing the code that tries to assign an
empty stack.

Change-Id: I6a6a696479ac7f753b3c6f6f48d8b9b67f6e3b95
Reviewed-on: https://go-review.googlesource.com/c/go/+/694621
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Felix Geisendörfer 2025-07-06 17:16:10 +02:00 committed by Gopher Robot
parent f63e12d0e0
commit d2b3c1a504

View file

@ -625,7 +625,6 @@ func (e Event) StateTransition() StateTransition {
s = goStateTransition(GoID(e.base.args[0]), GoRunnable, GoRunning)
case tracev2.EvGoDestroy:
s = goStateTransition(e.ctx.G, GoRunning, GoNotExist)
s.Stack = e.Stack() // This event references the resource the event happened on.
case tracev2.EvGoDestroySyscall:
s = goStateTransition(e.ctx.G, GoSyscall, GoNotExist)
case tracev2.EvGoStop:
@ -646,10 +645,8 @@ func (e Event) StateTransition() StateTransition {
s.Stack = e.Stack() // This event references the resource the event happened on.
case tracev2.EvGoSyscallEnd:
s = goStateTransition(e.ctx.G, GoSyscall, GoRunning)
s.Stack = e.Stack() // This event references the resource the event happened on.
case tracev2.EvGoSyscallEndBlocked:
s = goStateTransition(e.ctx.G, GoSyscall, GoRunnable)
s.Stack = e.Stack() // This event references the resource the event happened on.
case tracev2.EvGoStatus, tracev2.EvGoStatusStack:
packedStatus := e.base.args[2]
from, to := packedStatus>>32, packedStatus&((1<<32)-1)