go-delve/delve · warning

not implemented

Error message

not implemented

What it means

restoreRegisters on the darwin native backend is unimplemented: the darwin port cannot write saved register state back into a thread. Any code path that needs to restore registers (e.g. hot-swapping register state after register modification, or certain replay/call-injection features) fails with this error.

Source

Thrown at pkg/proc/native/threads_darwin.go:134

	}
	if len(buf) == 0 {
		return 0, nil
	}
	var (
		vmData = unsafe.Pointer(&buf[0])
		vmAddr = C.mach_vm_address_t(addr)
		length = C.mach_msg_type_number_t(len(buf))
	)

	ret := C.read_memory(t.dbp.os.task, vmAddr, vmData, length)
	if ret < 0 {
		return 0, fmt.Errorf("could not read memory")
	}
	return len(buf), nil
}

func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
	return errors.New("not implemented")
}

func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error {
	return proc.ErrHWBreakUnsupported
}

// SoftExc returns true if this thread received a software exception during the last resume.
func (t *nativeThread) SoftExc() bool {
	return false
}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Avoid features requiring register restoration on macOS; use breakpoint/step-based workflows instead.
  2. Update/patch delve: implement restoreRegisters using thread_set_state on the mach thread act.
  3. Perform register modifications on a platform that supports them (linux/windows) if possible.
  4. If you only need to read registers, use `regs` without write flags — reading is supported.

Example fix

// before
func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
	return errors.New("not implemented")
}
// after
func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
	r := sr.(*darwinRegisters)
	kret := C.thread_set_state(C.thread_act_t(t.os.threadAct), C.x86_THREAD_STATE64,
		(*C.int)(unsafe.Pointer(&r.regs)), C.x86_THREAD_STATE64_COUNT)
	if kret != C.KERN_SUCCESS {
		return fmt.Errorf("thread_set_state failed: %d", kret)
	}
	return nil
}
Defensive patterns

Strategy: fallback

Validate before calling

// detect darwin backend before using register-restore features
if runtime.GOOS == "darwin" {
	// avoid flows that modify/restore registers
}

Type guard

func isNotImplementedErr(err error) bool {
	return err != nil && (err.Error() == "not implemented" || errors.Is(err, proc.ErrNotImplemented))
}

Try / catch

if err := thread.RestoreRegisters(saved); err != nil {
	if err.Error() == "not implemented" {
		// degrade: re-launch process with fresh state instead of restoring
		return relaunchAndReapplyBreakpoints()
	}
	return err
}

Prevention

When it happens

Trigger: Calling restoreRegisters on a darwin native thread — reached when delve operations need to push modified register state back, such as applying edited registers or certain function-call simulation paths.

Common situations: Using features that modify registers on macOS (some `regs --set`, call injection scenarios); running darwin-specific backends that lag behind linux feature parity.

Related errors


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