const mainLine = 21
want := []evDesc{
{trace.EventStateTransition, "Goroutine Running->Runnable", []frame{
- {"main.main", mainLine + 82},
+ {"runtime.Gosched", 0},
+ {"main.main", mainLine + 87},
}},
{trace.EventStateTransition, "Goroutine NotExist->Runnable", []frame{
{"main.main", mainLine + 11},
}},
{trace.EventStateTransition, "Goroutine Waiting->Runnable", []frame{
{"runtime.chansend1", 0},
- {"main.main", mainLine + 84},
+ {"main.main", mainLine + 89},
}},
{trace.EventStateTransition, "Goroutine Running->Waiting", []frame{
{"runtime.chansend1", 0},
}},
{trace.EventStateTransition, "Goroutine Waiting->Runnable", []frame{
{"runtime.chanrecv1", 0},
- {"main.main", mainLine + 85},
+ {"main.main", mainLine + 90},
}},
{trace.EventStateTransition, "Goroutine Running->Waiting", []frame{
{"runtime.selectgo", 0},
}},
{trace.EventStateTransition, "Goroutine Waiting->Runnable", []frame{
{"runtime.selectgo", 0},
- {"main.main", mainLine + 86},
+ {"main.main", mainLine + 91},
}},
{trace.EventStateTransition, "Goroutine Running->Waiting", []frame{
{"sync.(*Mutex).Lock", 0},
{trace.EventStateTransition, "Goroutine Waiting->Runnable", []frame{
{"sync.(*WaitGroup).Add", 0},
{"sync.(*WaitGroup).Done", 0},
- {"main.main", mainLine + 91},
+ {"main.main", mainLine + 96},
}},
{trace.EventStateTransition, "Goroutine Running->Waiting", []frame{
{"sync.(*Cond).Wait", 0},
{"runtime.GOMAXPROCS", 0},
{"main.main", 0},
}},
+ {trace.EventStateTransition, "Goroutine Running->Runnable", []frame{
+ {"main.syncPreemptPoint", 0},
+ {"main.main.func12", 0},
+ }},
}
if !stress {
// Only check for this stack if !stress because traceAdvance alone could
nstk += 1 + fpTracebackPCs(unsafe.Pointer(gp.syscallbp), pcBuf[2:])
} else {
pcBuf[1] = gp.sched.pc
- nstk += 1 + fpTracebackPCs(unsafe.Pointer(gp.sched.bp), pcBuf[2:])
+ if gp.syncSafePoint {
+ // We're stopped in morestack, which is an odd state because gp.sched.bp
+ // refers to our parent frame, since we haven't had the chance to push our
+ // frame pointer to the stack yet. If we just start walking from gp.sched.bp,
+ // we'll skip a frame as a result. Luckily, we can find the PC we want right
+ // at gp.sched.sp on non-LR platforms, and we have it directly on LR platforms.
+ // See issue go.dev/issue/68090.
+ if usesLR {
+ pcBuf[2] = gp.sched.lr
+ } else {
+ pcBuf[2] = *(*uintptr)(unsafe.Pointer(gp.sched.sp))
+ }
+ nstk += 2 + fpTracebackPCs(unsafe.Pointer(gp.sched.bp), pcBuf[3:])
+ } else {
+ nstk += 1 + fpTracebackPCs(unsafe.Pointer(gp.sched.bp), pcBuf[2:])
+ }
}
}
}