go-delve/delve · error

LocationCovers does not support DWARFv5

Error message

LocationCovers does not support DWARFv5

What it means

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.

Solutions

  1. Rebuild the target with an older DWARF version (e.g. gcc -gdwarf-4, or older Go toolchain)
  2. Use Delve APIs that support DWARFv5 (regular variable evaluation) instead of LocationCovers
  3. Upgrade Delve to a version with DWARFv5 loclist support if available
  4. Downgrade the compiler's debug flags: -gdwarf-4 / GO's -gcflags=dwarf=false alternatives

Example fix

// before
gcc -gdwarf-5 -c app.c   // LocationCovers fails
// after
gcc -gdwarf-4 -c app.c   // legacy loclists, LocationCovers works
Defensive patterns

Strategy: fallback

Validate before calling

// detect DWARF version of the relevant CU before calling LocationCovers
if cu.Version >= 5 {
    // skip LocationCovers, use DWARFv5-aware range computation
}

Try / catch

ranges, err := LocationCovers(...)
if err != nil && strings.Contains(err.Error(), "DWARFv5") {
    // fallback: rebuild target with -gdwarf-4 or use another API
}

Prevention

When it happens

Trigger: Calling LocationCovers for a symbol whose compile unit was emitted as DWARF v5 (Go 1.11+ defaults / GNU -gdwarf-5) with .debug_loclists present.

Common situations: Debugging binaries built with recent GCC/Clang -gdwarf-5 or newer Go toolchains; tooling built on pkg/proc that calls LocationCovers on modern binaries.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/e6ac9e5bff45fca2. Report an issue: GitHub.

Appendix: source

Thrown at pkg/proc/bininfo.go:1379

func (bi *BinaryInfo) LocationCovers(entry *dwarf.Entry, attr dwarf.Attr) ([][2]uint64, error) {
	a := entry.Val(attr)
	if a == nil {
		return nil, fmt.Errorf("attribute %s not found", attr)
	}
	if _, isblock := a.([]byte); isblock {
		return [][2]uint64{{0, ^uint64(0)}}, nil
	}

	off, ok := a.(int64)
	if !ok {
		return nil, fmt.Errorf("attribute %s of unsupported type %T", attr, a)
	}
	cu := bi.Images[0].findCompileUnitForOffset(entry.Offset)
	if cu == nil {
		return nil, errors.New("could not find compile unit")
	}
	if cu.Version >= 5 && cu.image.loclist5 != nil {
		return nil, errors.New("LocationCovers does not support DWARFv5")
	}

	image := cu.image
	base := cu.lowPC
	if image == nil || image.loclist2.Empty() {
		return nil, errors.New("malformed executable")
	}

	r := [][2]uint64{}
	var e loclist.Entry
	image.loclist2.Seek(int(off))
	for image.loclist2.Next(&e) {
		if e.BaseAddressSelection() {
			base = e.HighPC
			continue
		}
		r = append(r, [2]uint64{e.LowPC + base, e.HighPC + base})
	}

View on GitHub (pinned to a23773e6c3)