代码拉取完成,页面将自动刷新
package proc
type goroutineCache struct {
partialGCache map[int64]*G
allGCache []*G
allgentryAddr, allglenAddr uint64
}
func (gcache *goroutineCache) init(bi *BinaryInfo) {
var err error
exeimage := bi.Images[0]
rdr := exeimage.DwarfReader()
if rdr == nil {
return
}
gcache.allglenAddr, _ = rdr.AddrFor("runtime.allglen", exeimage.StaticBase, bi.Arch.PtrSize())
rdr.Seek(0)
gcache.allgentryAddr, err = rdr.AddrFor("runtime.allgs", exeimage.StaticBase, bi.Arch.PtrSize())
if err != nil {
// try old name (pre Go 1.6)
gcache.allgentryAddr, _ = rdr.AddrFor("runtime.allg", exeimage.StaticBase, bi.Arch.PtrSize())
}
}
func (gcache *goroutineCache) getRuntimeAllg(bi *BinaryInfo, mem MemoryReadWriter) (uint64, uint64, error) {
if gcache.allglenAddr == 0 || gcache.allgentryAddr == 0 {
return 0, 0, ErrNoRuntimeAllG
}
allglen, err := readUintRaw(mem, gcache.allglenAddr, int64(bi.Arch.PtrSize()))
if err != nil {
return 0, 0, err
}
allgptr, err := readUintRaw(mem, gcache.allgentryAddr, int64(bi.Arch.PtrSize()))
if err != nil {
return 0, 0, err
}
return allgptr, allglen, nil
}
func (gcache *goroutineCache) addGoroutine(g *G) {
if gcache.partialGCache == nil {
gcache.partialGCache = make(map[int64]*G)
}
gcache.partialGCache[g.ID] = g
}
// Clear clears the cached contents of the cache for runtime.allgs.
func (gcache *goroutineCache) Clear() {
gcache.partialGCache = nil
gcache.allGCache = nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。