Index: devel/gdb/files/patch-gdb_common_filestuff.c =================================================================== --- /dev/null +++ devel/gdb/files/patch-gdb_common_filestuff.c @@ -0,0 +1,37 @@ +--- gdb/common/filestuff.c.orig 2018-01-04 22:07:23.000000000 -0600 ++++ gdb/common/filestuff.c 2018-10-04 18:48:13.140419000 -0500 +@@ -36,6 +36,11 @@ + #define HAVE_SOCKETS 1 + #endif + ++#if defined(__FreeBSD__) && defined(HAVE_KINFO_GETFILE) ++#include ++#include ++#endif ++ + #ifdef HAVE_SYS_RESOURCE_H + #include + #endif /* HAVE_SYS_RESOURCE_H */ +@@ -104,6 +109,22 @@ fdwalk (int (*func) (void *, int), void *arg) + return result; + } + /* We may fall through to the next case. */ ++#endif ++#if defined(__FreeBSD__) && defined(HAVE_KINFO_GETFILE) ++ struct kinfo_file *fdtbl; ++ int cnt, i, result; ++ ++ fdtbl = kinfo_getfile(getpid(), &cnt); ++ if (fdtbl == NULL) ++ return 0; ++ for (i = 0; i < cnt; i++) { ++ result = func (arg, fdtbl[i].kf_fd); ++ if (result != 0) ++ break; ++ } ++ free(fdtbl); ++ return result; ++ + #endif + + {