go-delve/delve · error

procstat_getprocs returned no processes

Error message

procstat_getprocs returned no processes

What it means

On FreeBSD, EntryPoint() uses libprocstat (procstat_getprocs) to find the process by PID and read its ELF auxiliary vector. This error means procstat_getprocs succeeded structurally but returned zero process entries, i.e. no process matching dbp.pid exists at that moment. Without the process record, the auxv (and thus the entry point) cannot be read.

Source

Thrown at pkg/proc/native/proc_freebsd.go:597

	return ptraceDetach(dbp.pid)
}

// EntryPoint returns the entry point address of the process.
func (dbp *nativeProcess) EntryPoint() (uint64, error) {
	ps, err := C.procstat_open_sysctl()
	if err != nil {
		return 0, fmt.Errorf("procstat_open_sysctl failed: %v", err)
	}
	defer C.procstat_close(ps)

	var count C.uint
	kipp, err := C.procstat_getprocs(ps, C.KERN_PROC_PID, C.int(dbp.pid), &count)
	if err != nil {
		return 0, fmt.Errorf("procstat_getprocs failed: %v", err)
	}
	defer C.procstat_freeprocs(ps, kipp)
	if count == 0 {
		return 0, errors.New("procstat_getprocs returned no processes")
	}

	auxv, err := C.procstat_getauxv(ps, kipp, &count)
	if err != nil {
		return 0, fmt.Errorf("procstat_getauxv failed: %v", err)
	}
	defer C.procstat_freeauxv(ps, auxv)

	for i := 0; i < int(count); i++ {
		if auxv.a_type == C.AT_ENTRY {
			return uint64(C.elf_aux_info_ptr(auxv)), nil
		}
		auxv = (*C.Elf_Auxinfo)(unsafe.Pointer(uintptr(unsafe.Pointer(auxv)) + unsafe.Sizeof(*auxv)))
	}
	return 0, errors.New("entry point not found")
}

func (dbp *nativeProcess) SupportsBPF() bool {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Verify the process with the given pid is alive: `procstat -i <pid>` or `ps -p <pid>`.
  2. Re-launch the debug session; the target likely exited prematurely.
  3. Run delve as root or check kern.securelevel / jail visibility settings if the process exists but is not visible.
  4. Confirm you are on a supported FreeBSD version where procstat_getauxv is available.
Defensive patterns

Strategy: validation

Validate before calling

// FreeBSD: check the process exists before EntryPoint-dependent operations
if _, err := os.Stat(fmt.Sprintf("/proc/%d", pid)); err == nil {
	// linux-style /proc may not exist on FreeBSD; use procstat
}
out, err := exec.Command("procstat", "-i", strconv.Itoa(pid)).Output()
if err != nil {
	return fmt.Errorf("pid %d not visible: %w", pid, err)
}

Type guard

func isNoProcesses(err error) bool {
	return err != nil && strings.Contains(err.Error(), "procstat_getprocs returned no processes")
}

Try / catch

if err := startDebug(); err != nil {
	if strings.Contains(err.Error(), "procstat_getprocs returned no processes") {
		// target exited; re-launch instead of attach
		return relaunchTarget()
	}
	return err
}

Prevention

When it happens

Trigger: Calling EntryPoint (invoked during debugger setup, e.g. when locating breakpoints or the entry point for a launch) with a pid that no longer exists or is not visible to the current user.

Common situations: Target exited between launch and the EntryPoint call; attaching to a process owned by another user or with restricted permissions; PID reuse/mismatch; running inside a jail restricting proc visibility.

Related errors


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