type newFunc struct {
id uint64
name, file string
+ startLine int64
}
newFuncs := make([]newFunc, 0, 8)
if funcID == 0 {
funcID = uint64(len(b.funcs)) + 1
b.funcs[frame.Function] = int(funcID)
- newFuncs = append(newFuncs, newFunc{funcID, frame.Function, frame.File})
+ newFuncs = append(newFuncs, newFunc{
+ id: funcID,
+ name: frame.Function,
+ file: frame.File,
+ startLine: int64(runtime_FrameStartLine(&frame)),
+ })
}
b.pbLine(tagLocation_Line, funcID, int64(frame.Line))
}
b.pb.int64Opt(tagFunction_Name, b.stringIndex(fn.name))
b.pb.int64Opt(tagFunction_SystemName, b.stringIndex(fn.name))
b.pb.int64Opt(tagFunction_Filename, b.stringIndex(fn.file))
+ b.pb.int64Opt(tagFunction_StartLine, fn.startLine)
b.pb.endMessage(tagProfile_Function, start)
}
import (
"context"
+ "runtime"
"unsafe"
)
+// runtime_FrameStartLine is defined in runtime/symtab.go.
+func runtime_FrameStartLine(f *runtime.Frame) int
+
// runtime_expandFinalInlineFrame is defined in runtime/symtab.go.
func runtime_expandFinalInlineFrame(stk []uintptr) []uintptr
return
}
+// runtime_FrameStartLine returns the start line of the function in a Frame.
+//
+//go:linkname runtime_FrameStartLine runtime/pprof.runtime_FrameStartLine
+func runtime_FrameStartLine(f *Frame) int {
+ return f.startLine
+}
+
// runtime_expandFinalInlineFrame expands the final pc in stk to include all
// "callers" if pc is inline.
//