runtime: in getTraceback, set gp->m before gogo
Currently, when collecting a traceback for another goroutine,
getTraceback calls gogo(gp) switching to gp, which will resume in
mcall, which will call gtraceback, which will set up gp->m. There
is a gap between setting the current running g to gp and setting
gp->m. If a profiling signal arrives in between, sigtramp will
see a non-nil gp with a nil m, and will seg fault. Fix this by
setting up gp->m first.
Fixes golang/go#29448.
Reviewed-on: https://go-review.googlesource.com/c/156038
From-SVN: r267658