Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

proc: fix loading goroutine labels on Go 1.24 #3879

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions pkg/proc/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,30 @@ func (g *G) Labels() map[string]string {
labelMapType, _ := g.variable.bi.findType("runtime/pprof.labelMap")
if labelMapType != nil {
labelMap := newVariable("", address.Addr, labelMapType, g.variable.bi, g.variable.mem)
labelMap.loadValue(loadFullValue)
labels = map[string]string{}
for i := range labelMap.Children {
if i%2 == 0 {
k := labelMap.Children[i]
v := labelMap.Children[i+1]
labels[constant.StringVal(k.Value)] = constant.StringVal(v.Value)
switch labelMap.Kind {
case reflect.Map:
labelMap.loadValue(loadFullValue)
for i := range labelMap.Children {
if i%2 == 0 {
k := labelMap.Children[i]
v := labelMap.Children[i+1]
labels[constant.StringVal(k.Value)] = constant.StringVal(v.Value)
}
}
case reflect.Struct:
labelMap, _ = labelMap.structMember("list")
if labelMap != nil {
for i := int64(0); i < labelMap.Len; i++ {
v, err := labelMap.sliceAccess(int(i))
if err != nil {
break
}
v.loadValue(loadFullValue)
if len(v.Children) == 2 {
labels[constant.StringVal(v.Children[0].Value)] = constant.StringVal(v.Children[1].Value)
}
}
}
}
}
Expand Down