{"record":{"id":"978ecee22ebd13b5","repo":"go-delve/delve","slug":"procstat-getauxv-failed-v","errorCode":null,"errorMessage":"procstat_getauxv failed: %v","messagePattern":"procstat_getauxv failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/native/proc_freebsd.go","lineNumber":602,"sourceCode":"\tps, err := C.procstat_open_sysctl()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"procstat_open_sysctl failed: %v\", err)\n\t}\n\tdefer C.procstat_close(ps)\n\n\tvar count C.uint\n\tkipp, err := C.procstat_getprocs(ps, C.KERN_PROC_PID, C.int(dbp.pid), &count)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"procstat_getprocs failed: %v\", err)\n\t}\n\tdefer C.procstat_freeprocs(ps, kipp)\n\tif count == 0 {\n\t\treturn 0, errors.New(\"procstat_getprocs returned no processes\")\n\t}\n\n\tauxv, err := C.procstat_getauxv(ps, kipp, &count)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"procstat_getauxv failed: %v\", err)\n\t}\n\tdefer C.procstat_freeauxv(ps, auxv)\n\n\tfor i := 0; i < int(count); i++ {\n\t\tif auxv.a_type == C.AT_ENTRY {\n\t\t\treturn uint64(C.elf_aux_info_ptr(auxv)), nil\n\t\t}\n\t\tauxv = (*C.Elf_Auxinfo)(unsafe.Pointer(uintptr(unsafe.Pointer(auxv)) + unsafe.Sizeof(*auxv)))\n\t}\n\treturn 0, errors.New(\"entry point not found\")\n}\n\nfunc (dbp *nativeProcess) SupportsBPF() bool {\n\treturn false\n}\n\nfunc (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error {\n\tpanic(\"not implemented\")","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/proc_freebsd.go#L584-L620","documentation":"EntryPoint on FreeBSD retrieves the process auxiliary vector via procstat_getauxv and scans it for AT_ENTRY. If procstat_getauxv fails, delve reports 'procstat_getauxv failed'. Without auxv the program entry address cannot be determined through this path.","triggerScenarios":"procstat_getauxv(ps, kipp, &count) returns an error when EntryPoint runs — the kernel did not expose the auxv for this process record (unsupported FreeBSD version, restricted access, or a kernel thread/ zombie with no auxv).","commonSituations":"Older FreeBSD (<12) without procstat_getauxv; debugging processes in jails with restricted sysctls; querying a just-exited or zombie process; kernels where PFLAGS tracing restricts auxv exposure.","solutions":["Ensure FreeBSD 12+ where procstat_getauxv exists, and that delve was compiled against matching headers.","Run as root/same user to satisfy kernel visibility restrictions.","Fall back to parsing AT_ENTRY from /proc/<pid>/elf auxv or compute the ELF entry from the binary's program headers.","Check the target is a normal alive process (not zombie/kernel process) before calling EntryPoint."],"exampleFix":"// before\nep, err := proc.EntryPoint() // procstat_getauxv failed: ...\n\n// after\nep, err := proc.EntryPoint()\nif err != nil {\n    if f, ferr := elf.Open(exePath); ferr == nil {\n        ep = f.Entry // ELF header entry as fallback\n        f.Close()\n    }\n}","handlingStrategy":"fallback","validationCode":"// require FreeBSD 12+ auxv support before relying on EntryPoint\nfunc auxvSupported() bool {\n    ver, err := exec.Command(\"freebsd-version\", \"-u\").Output()\n    if err != nil { return false }\n    major := strings.Split(strings.TrimSpace(string(ver)), \".\")[0]\n    n, _ := strconv.Atoi(major)\n    return n >= 12\n}","typeGuard":null,"tryCatchPattern":"ep, err := proc.EntryPoint()\nif err != nil && strings.Contains(err.Error(), \"procstat_getauxv failed\") {\n    if f, ferr := elf.Open(exePath); ferr == nil {\n        ep, err = f.Entry, nil // ELF program-header entry as fallback\n        f.Close()\n    }\n}","preventionTips":["Run on FreeBSD 12+ where procstat_getauxv exists.","Compile delve against the matching libprocstat headers.","Run as root/same user to satisfy kernel exposure restrictions.","Skip EntryPoint queries for zombies/kernel processes."],"tags":["freebsd","procstat","auxv","entry-point"],"backgroundTag":"procstat-getauxv-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}