go-delve/delve · error
could not find rodata struct member
Error message
could not find rodata struct member
What it means
Error "could not find rodata struct member" thrown in go-delve/delve.
Source
Thrown at pkg/proc/bininfo.go:1818
err := binary.Write(buf, binary.LittleEndian, &roDataAddr)
if err != nil {
return 0, err
}
// Here we search for the value of `go.func.*` by searching through the raw bytes of the
// runtime.moduledata structure. Since we don't know the value that we are looking for,
// we use a known value, in this case the address of the .rodata section.
// This is because in the layout of the struct, the rodata member is right next to
// the value we need, making the math trivial once we find that member.
// We use `bytes.LastIndex` specifically because the `types` struct member can also
// contain the address of the .rodata section, so this pointer can appear multiple times
// in the raw bytes.
// Yes, this is very ill-advised low-level hackery but it works fine until
// https://github.com/golang/go/issues/58474#issuecomment-1785681472 happens.
// This code path also only runs in stripped binaries, so the whole implementation is
// best effort anyways.
rodata := bytes.LastIndex(moduleData, buf.Bytes()[:ptrsize])
if rodata == -1 {
return 0, errors.New("could not find rodata struct member")
}
// Layout of struct members is:
// type moduledata struct {
// ...
// rodata uintptr
// gofunc uintptr
// ...
// }
// So do some pointer arithmetic to get the value we need.
gofuncval := binary.LittleEndian.Uint64(moduleData[rodata+(1*ptrsize) : rodata+(2*ptrsize)])
return gofuncval, nil
}
func parseModuleData(dataSection []byte, tableAddr uint64) ([]byte, error) {
buf := new(bytes.Buffer)
err := binary.Write(buf, binary.LittleEndian, &tableAddr)
if err != nil {
return nil, errView on GitHub (pinned to a23773e6c3)
When it happens
Trigger: Thrown at pkg/proc/bininfo.go:1818 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/a9333a98cfa4fc1a.
Report an issue: GitHub.