go-delve/delve · warning

parent pointer unreadable: %w

Error message

parent pointer unreadable: %w

What it means

While loading a pointer variable, Delve could not dereference the pointer because the parent pointer's value itself was unreadable (e.g. its target address could not be read from memory). To keep the UI consistent (pointers always show a `*` child), Delve still creates a child variable and attaches this wrapped error as the child's `Unreadable` marker.

Source

Thrown at pkg/proc/variables.go:1325

	t := v.RealType.(*godwarf.PtrType)
	v.Len = 1

	var child *Variable
	if v.Unreadable == nil {
		ptrval, err := readUintRaw(v.mem, v.Addr, t.ByteSize)
		if err == nil {
			child = v.newVariable("", ptrval, t.Type, DereferenceMemory(v.mem))
		} else {
			// We failed to read the pointer value; mark v as unreadable.
			v.Unreadable = err
		}
	}

	if v.Unreadable != nil {
		// Pointers get a child even if their value can't be read, to
		// maintain backwards compatibility.
		child = v.newVariable("", 0 /* addr */, t.Type, DereferenceMemory(v.mem))
		child.Unreadable = fmt.Errorf("parent pointer unreadable: %w", v.Unreadable)
	}

	v.Children = []Variable{*child}
	v.Value = constant.MakeUint64(v.Children[0].Addr)
}

func loadValues(vars []*Variable, cfg LoadConfig) {
	for i := range vars {
		vars[i].loadValueInternal(0, cfg)
	}
}

// Extracts the value of the variable at the given address.
func (v *Variable) loadValue(cfg LoadConfig) {
	v.loadValueInternal(0, cfg)
}

func (v *Variable) loadValueInternal(recurseLevel int, cfg LoadConfig) {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Inspect the parent pointer's address value first (`print ptr`) and verify it points to valid memory.
  2. Check why the parent pointer itself is unreadable (the wrapped `%w` error has the root cause).
  3. For core dump debugging, re-dump with full memory (`gcore`/delve dump options) or debug the live process.
  4. If the pointer is corrupted, inspect the code path that produced it.
Defensive patterns

Strategy: fallback

Validate before calling

// Check the parent pointer's own Unreadable marker before dereferencing:
// (dlv) print ptr          // see if value/address is sane
// (dlv) print uintptr(ptr) // raw address

Try / catch

// In DAP/RPC2 clients, inspect Variable.Unreadable instead of treating missing children as a crash:
if v.Unreadable != nil {
    log.Printf("pointer unreadable: %v", v.Unreadable)
}

Prevention

When it happens

Trigger: Evaluating any pointer expression whose target memory is inaccessible: `print ptr`, `print ptr.field`, or hovering a pointer in an IDE; occurs when the pointed-to memory is unmapped or the process memory read fails during `maybeDereference`/`loadPointerTo`.

Common situations: Dangling pointers to freed/unmapped memory; inspecting core dumps where the pointed-to pages were not dumped; pointers read through a gdbserial connection to a stopped/dead target; corrupted register or stack values.

Related errors


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