• Keith Randall's avatar
    runtime: get map of args of unstarted goroutines like we do for defers · 38c129b4
    Keith Randall authored
    Normally, reflect.makeFuncStub records the context value at a known
    point in the stack frame, so that the runtime can get the argument map
    for reflect.makeFuncStub from that known location.
    
    This doesn't work for defers or goroutines that haven't started yet,
    because they haven't allocated a frame or run an instruction yet. The
    argument map must be extracted from the context value. We already do
    this for defers (the non-nil ctxt arg to getArgInfo), we just need to
    do it for unstarted goroutines as well.
    
    When we traceback a goroutine, remember the context value from
    g.sched.  Use it for the first frame we find.
    
    (We never need it for deeper frames, because we normally don't stop at
     the start of reflect.makeFuncStub, as it is nosplit. With this CL we
     could allow makeFuncStub to no longer be nosplit.)
    
    Fixes #25897
    
    Change-Id: I427abf332a741a80728cdc0b8412aa8f37e7c418
    Reviewed-on: https://go-review.googlesource.com/c/go/+/180258Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
    38c129b4
issue25897b.go 651 Bytes