go-delve/delve · error

qMemoryRegionInfo response wrapped around the address space

Error message

qMemoryRegionInfo response wrapped around the address space or stuck

What it means

When building the memory map, delve walks the address space with repeated qMemoryRegionInfo queries. If the returned region size does not advance the address (addr+mri.size wraps or stays <= addr), the walk would never terminate, so this error is returned.

Source

Thrown at pkg/proc/gdbserial/gdbserver.go:1644

	if err != nil {
		return nil, err
	}
	buf := &bytes.Buffer{}
	buf.Write(op)
	binary.Write(buf, binary.LittleEndian, uint32(offset))
	return buf.Bytes(), nil
}

func (p *gdbProcess) MemoryMap() ([]proc.MemoryMapEntry, error) {
	r := []proc.MemoryMapEntry{}
	addr := uint64(0)
	for addr != ^uint64(0) {
		mri, err := p.conn.memoryRegionInfo(addr)
		if err != nil {
			return nil, err
		}
		if addr+mri.size <= addr {
			return nil, errors.New("qMemoryRegionInfo response wrapped around the address space or stuck")
		}
		if mri.permissions != "" {
			var mme proc.MemoryMapEntry

			mme.Addr = addr
			mme.Size = mri.size
			mme.Read = strings.Contains(mri.permissions, "r")
			mme.Write = strings.Contains(mri.permissions, "w")
			mme.Exec = strings.Contains(mri.permissions, "x")

			r = append(r, mme)
		}
		addr += mri.size
	}
	return r, nil
}

func (p *gdbProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Update lldb-server/rr/stub to a version with correct qMemoryRegionInfo handling.
  2. Test with the native backend (dlv exec --backend=native) to confirm the stub is the problem.
  3. File a bug with the delve project including the stub name/version and wire log (--log-output=dewire).
  4. Work around by using OS tools (e.g. /proc/<pid>/maps, vmmap) to inspect the memory map.
Defensive patterns

Strategy: try-catch

Try / catch

mm, err := p.MemoryMap()
if err != nil && strings.Contains(err.Error(), "qMemoryRegionInfo") {
    // stub misbehaves; fall back to /proc/<pid>/maps or OS tooling
}

Prevention

When it happens

Trigger: Calling gdbProcess.MemoryMap when the debug stub returns a malformed qMemoryRegionInfo packet whose size is 0 or causes uint64 overflow for the queried address.

Common situations: Non-conforming or buggy GDB stubs, lldb-server/rr protocol quirks, or corrupted responses on unusual memory layouts (e.g. top-of-address-space mappings).

Related errors


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