go-delve/delve · error
procstat_getprocs failed: %v
Error message
procstat_getprocs failed: %v
What it means
Inside EntryPoint on FreeBSD, procstat_getprocs(ps, KERN_PROC_PID, pid, &count) failed to fetch the process's kinfo_proc entries for the debugged pid. Delve needs this record before querying the auxiliary vector, so it aborts with this error.
Source
Thrown at pkg/proc/native/proc_freebsd.go:593
for _, th := range dbp.threads {
ptraceResume(th.ID)
}
}
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)))
}View on GitHub (pinned to a23773e6c3)
Solutions
- Confirm the target is still alive (ps -p <pid>) before calling APIs that need process metadata.
- Re-run delve as root or the same user as the target if visibility is the issue.
- Retry quickly: if this was a race with process exit, catch ErrProcessExited-style conditions and handle the dead target.
- Update FreeBSD/libprocstat if getprocs fails for a valid, visible pid.
Example fix
// before
ep, err := proc.EntryPoint() // procstat_getprocs failed: no such process
// after
if proc.Exited() {
return // target already gone, skip entry-point lookup
}
ep, err := proc.EntryPoint() Defensive patterns
Strategy: validation
Validate before calling
// check target liveness and visibility before EntryPoint
func pidVisible(pid int) bool {
return exec.Command("procstat", strconv.Itoa(pid)).Run() == nil
} Try / catch
if !pidVisible(pid) { return ErrTargetGone }
ep, err := proc.EntryPoint()
if err != nil && strings.Contains(err.Error(), "procstat_getprocs failed") {
return fmt.Errorf("target %d exited during entry-point lookup", pid)
} Prevention
- Check the process is alive (procstat -p <pid>) before calling metadata APIs.
- Match debugger and target users to avoid visibility failures.
- Handle races with process exit explicitly in long-running tooling.
- Avoid jails/restricted environments when querying kernel process records.
When it happens
Trigger: procstat_getprocs returns non-zero when EntryPoint runs — the pid does not exist anymore, is not visible to the calling user, or the procstat handle is invalid.
Common situations: Target exited before EntryPoint was called (race with process death); running in a jail or as an unprivileged user who cannot see the target's process record; pid reuse confusion in scripts that parse the error.
Related errors
- procstat_open_sysctl failed: %v
- procstat_getauxv failed: %v
- procstat_getprocs returned no processes
- kinfo_getvmmap call failed
- entry point not found
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/75108ca68d224da0.
Report an issue: GitHub.