diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go index 006274757e..262f0c5d79 100644 --- a/src/runtime/mprof.go +++ b/src/runtime/mprof.go @@ -543,6 +543,19 @@ func saveblockevent(cycles, rate int64, skip int, which bucketType) { gp := getg() mp := acquirem() // we must not be preempted while accessing profstack + d := dlog() + d.s("g=") + d.hex(uint64(uintptr(unsafe.Pointer(gp)))) + d.s("goid=") + d.u64(gp.goid) + d.s("sched.sp=") + d.hex(uint64(gp.sched.sp)) + d.s("sched.bp=") + d.hex(uint64(gp.sched.bp)) + d.s("curfp=") + d.hex(uint64(getfp())) + d.end() + var nstk int if tracefpunwindoff() || gp.m.hasCgoOnStack() { if gp.m.curg == nil || gp.m.curg == gp { @@ -576,6 +589,7 @@ func saveblockevent(cycles, rate int64, skip int, which bucketType) { // inlining, and save remaining frames as "physical" return addresses. The // consumer should later use CallersFrames or similar to expand inline frames. func fpTracebackPartialExpand(skip int, fp unsafe.Pointer, pcBuf []uintptr) int { + gp := getg() var n int lastFuncID := abi.FuncIDNormal skipOrAdd := func(retPC uintptr) bool { @@ -588,9 +602,24 @@ func fpTracebackPartialExpand(skip int, fp unsafe.Pointer, pcBuf []uintptr) int return n < len(pcBuf) } for n < len(pcBuf) && fp != nil { + d := dlog() + d.s("goid=") + d.u64(gp.goid) + d.s("fp=") + d.p(fp) + d.end() + // end now, the next thing might crash + // return addr sits one word above the frame pointer pc := *(*uintptr)(unsafe.Pointer(uintptr(fp) + goarch.PtrSize)) + d = dlog() + d.s("goid=") + d.u64(gp.goid) + d.s("pc=") + d.pc(pc) + d.end() + if skip > 0 { callPC := pc - 1 fi := findfunc(callPC)