{"record":{"id":"e6ac9e5bff45fca2","repo":"go-delve/delve","slug":"locationcovers-does-not-support-dwarfv5","errorCode":null,"errorMessage":"LocationCovers does not support DWARFv5","messagePattern":"LocationCovers does not support DWARFv5","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/bininfo.go","lineNumber":1379,"sourceCode":"func (bi *BinaryInfo) LocationCovers(entry *dwarf.Entry, attr dwarf.Attr) ([][2]uint64, error) {\n\ta := entry.Val(attr)\n\tif a == nil {\n\t\treturn nil, fmt.Errorf(\"attribute %s not found\", attr)\n\t}\n\tif _, isblock := a.([]byte); isblock {\n\t\treturn [][2]uint64{{0, ^uint64(0)}}, nil\n\t}\n\n\toff, ok := a.(int64)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"attribute %s of unsupported type %T\", attr, a)\n\t}\n\tcu := bi.Images[0].findCompileUnitForOffset(entry.Offset)\n\tif cu == nil {\n\t\treturn nil, errors.New(\"could not find compile unit\")\n\t}\n\tif cu.Version >= 5 && cu.image.loclist5 != nil {\n\t\treturn nil, errors.New(\"LocationCovers does not support DWARFv5\")\n\t}\n\n\timage := cu.image\n\tbase := cu.lowPC\n\tif image == nil || image.loclist2.Empty() {\n\t\treturn nil, errors.New(\"malformed executable\")\n\t}\n\n\tr := [][2]uint64{}\n\tvar e loclist.Entry\n\timage.loclist2.Seek(int(off))\n\tfor image.loclist2.Next(&e) {\n\t\tif e.BaseAddressSelection() {\n\t\t\tbase = e.HighPC\n\t\t\tcontinue\n\t\t}\n\t\tr = append(r, [2]uint64{e.LowPC + base, e.HighPC + base})\n\t}","sourceCodeStart":1361,"sourceCodeEnd":1397,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/bininfo.go#L1361-L1397","documentation":"LocationCovers only implements DWARF v2-v4 location list parsing (via loclist2). When the owning compile unit is DWARF version 5 and the image has a loclist5 section, Delve refuses to run the legacy parser and returns this error instead of producing wrong ranges. It is an explicit capability limitation, not corruption.","triggerScenarios":"Calling LocationCovers for a symbol whose compile unit was emitted as DWARF v5 (Go 1.11+ defaults / GNU -gdwarf-5) with .debug_loclists present.","commonSituations":"Debugging binaries built with recent GCC/Clang -gdwarf-5 or newer Go toolchains; tooling built on pkg/proc that calls LocationCovers on modern binaries.","solutions":["Rebuild the target with an older DWARF version (e.g. gcc -gdwarf-4, or older Go toolchain)","Use Delve APIs that support DWARFv5 (regular variable evaluation) instead of LocationCovers","Upgrade Delve to a version with DWARFv5 loclist support if available","Downgrade the compiler's debug flags: -gdwarf-4 / GO's -gcflags=dwarf=false alternatives"],"exampleFix":"// before\ngcc -gdwarf-5 -c app.c   // LocationCovers fails\n// after\ngcc -gdwarf-4 -c app.c   // legacy loclists, LocationCovers works","handlingStrategy":"fallback","validationCode":"// detect DWARF version of the relevant CU before calling LocationCovers\nif cu.Version >= 5 {\n    // skip LocationCovers, use DWARFv5-aware range computation\n}","typeGuard":null,"tryCatchPattern":"ranges, err := LocationCovers(...)\nif err != nil && strings.Contains(err.Error(), \"DWARFv5\") {\n    // fallback: rebuild target with -gdwarf-4 or use another API\n}","preventionTips":["Build targets with -gdwarf-4 when legacy loclist tooling is required","Check CU version (cu.Version) before invoking legacy loclist APIs","Prefer Delve APIs that support DWARFv5 for modern toolchains"],"tags":["dwarf","dwarf5","loclists","compatibility"],"backgroundTag":"dwarf5-not-supported","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}