Index: head/devel/gdb/Makefile =================================================================== --- head/devel/gdb/Makefile (revision 486772) +++ head/devel/gdb/Makefile (revision 486773) @@ -1,145 +1,147 @@ # Created by: Steven Kreuzer # $FreeBSD$ PORTNAME= gdb PORTVERSION= 8.2 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= GNU MAINTAINER= pizzamig@FreeBSD.org COMMENT= GNU GDB of newer version than comes with the system LICENSE= GPLv3 LICENSE_FILE= ${WRKSRC}/COPYING3 # untested on sparc64, might work ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386 mips powerpc powerpc64 LIB_DEPENDS= libmpfr.so:math/mpfr TEST_DEPENDS= runtest:misc/dejagnu USES= compiler:c++11-lang cpe gmake libtool tar:xz TEST_TARGET= check USE_CSTD= gnu89 CPE_VENDOR= gnu GNU_CONFIGURE= yes CONFIGURE_ENV= CONFIGURED_M4=m4 CONFIGURED_BISON=byacc CONFIGURE_ARGS= --program-suffix=${PORTVERSION:S/.//g} \ --enable-targets=all --enable-64-bit-bfd \ --with-gdb-datadir=${PREFIX}/share/gdb${PORTVERSION:S/.//g} \ --with-separate-debug-dir=/usr/lib/debug \ ${ICONV_CONFIGURE_ARG} \ --with-expat=yes --with-libexpat-prefix=${LOCALBASE} \ --without-libunwind-ia64 --with-system-zlib CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in sometimes CFLAGS+= -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable CFLAGS+= -Wno-unknown-warning-option EXCLUDE= dejagnu expect sim texinfo intl EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /} -EXTRA_PATCHES= ${FILESDIR}/commit-8aa0243d54 +EXTRA_PATCHES= ${FILESDIR}/commit-8aa0243d54 \ + ${FILESDIR}/commit-93579f6f90 LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} PLIST_SUB= VER=${VER} OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB NLS PYTHON TUI OPTIONS_DEFAULT= GDB_LINK KGDB NLS PYTHON TUI PORT_READLINE PORT_ICONV SYSTEM_ZLIB OPTIONS_SINGLE= READLINE ICONV ZLIB OPTIONS_SINGLE_READLINE= BUNDLED_READLINE PORT_READLINE OPTIONS_SINGLE_ICONV= PORT_ICONV SYSTEM_ICONV OPTIONS_SINGLE_ZLIB= BUNDLED_ZLIB SYSTEM_ZLIB GDB_LINK_DESC= Create ${PREFIX}/bin/gdb symlink KGDB_DESC= Kernel Debugging Support BUNDLED_READLINE_DESC= from gdb distfile BUNDLED_ZLIB_DESC= from gdb distfile PORT_READLINE_DESC= from devel/readline port PORT_ICONV_DESC= use libiconv, with wider charset support SYSTEM_ICONV_DESC= use libc iconv, with no wchar support SYSTEM_ZLIB_DESC= use system zlib TUI_DESC= Text User Interface enabled OPTIONS_SUB= yes BUNDLED_READLINE_CONFIGURE_OFF= --with-system-readline DEBUG_CFLAGS= -g GUILE_CONFIGURE_WITH= guile GUILE_USES= pkgconfig GUILE_LIB_DEPENDS= libguile-2.0.so:lang/guile2 NLS_USES= gettext-runtime PORT_READLINE_USES= readline:port PORT_ICONV_USES= iconv:wchar_t PYTHON_CONFIGURE_ON= --with-python=${PYTHON_CMD} PYTHON_CONFIGURE_OFF= --without-python PYTHON_USES= python SYSTEM_ICONV_USES= iconv SYSTEM_ZLIB_WITH= system-zlib TUI_CONFIGURE_ENABLE= tui .include .if ! ${PORT_OPTIONS:MBUNDLED_READLINE} EXCLUDE+= readline .endif .if ! ${PORT_OPTIONS:MBUNDLED_ZLIB} EXCLUDE+= zlib .endif .if ${ARCH} == "amd64" CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL} .endif .if ${COMPILER_TYPE} == "clang" CFLAGS+= -Wno-extended-offsetof .endif post-patch: @${REINPLACE_CMD} -e 's|$$| [GDB v${PORTVERSION} for FreeBSD]|' \ ${WRKSRC}/gdb/version.in post-patch-KGDB-on: @${CP} -r ${FILESDIR}/kgdb/*.[ch] ${WRKSRC}/gdb/ @${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} < ${FILESDIR}/extrapatch-kgdb do-install: ${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \ ${STAGEDIR}${PREFIX}/bin/gdb${VER} ${INSTALL_MAN} ${WRKSRC}/gdb/doc/gdb.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1/gdb${VER}.1 (cd ${WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls ) do-install-KGDB-on: ${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \ ${STAGEDIR}${PREFIX}/bin/kgdb${VER} ${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1 do-install-TUI-on: ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER} do-install-GDB_LINK-on: ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb .if ${PORT_OPTIONS:MKGDB} ${LN} -sf kgdb${VER} ${STAGEDIR}${PREFIX}/bin/kgdb .endif do-install-PYTHON-on: (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) (cd ${WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) . for f in gdb gdb/command gdb/function gdb/printer @(cd ${STAGEDIR}${PREFIX}/share/gdb${VER}/python/${f} ; ${CHMOD} 644 *.py* ) . endfor do-install-GUILE-on: (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) (cd ${WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) .include Index: head/devel/gdb/files/commit-93579f6f90 =================================================================== --- head/devel/gdb/files/commit-93579f6f90 (nonexistent) +++ head/devel/gdb/files/commit-93579f6f90 (revision 486773) @@ -0,0 +1,57 @@ +commit 93579f6f908fa6010b141fd5da2974d878869c80 +Author: John Baldwin +Date: Fri Nov 30 15:14:18 2018 -0800 + + Use kinfo_getfile to implement fdwalk on FreeBSD. + + kinfo_getfile() requires a couple of system calls to fetch the list of + open file descriptors. This can be much cheaper than invoking fstat + on all of the values from 0 to the open file resource limit maximum. + + gdb/ChangeLog: + + * common/filestuff.c [HAVE_KINFO_GETFILE]: Include headers. + (fdwalk) [HAVE_KINFO_GETFILE]: Use kinfo_getfile. + +diff --git gdb/common/filestuff.c gdb/common/filestuff.c +index 0db5c6936b..f4d5e38f07 100644 +--- gdb/common/filestuff.c ++++ gdb/common/filestuff.c +@@ -36,6 +36,11 @@ + #define HAVE_SOCKETS 1 + #endif + ++#ifdef HAVE_KINFO_GETFILE ++#include ++#include ++#endif ++ + #ifdef HAVE_SYS_RESOURCE_H + #include + #endif /* HAVE_SYS_RESOURCE_H */ +@@ -108,6 +113,25 @@ fdwalk (int (*func) (void *, int), void *arg) + } + /* We may fall through to the next case. */ + #endif ++#ifdef HAVE_KINFO_GETFILE ++ int nfd; ++ gdb::unique_xmalloc_ptr fdtbl ++ (kinfo_getfile (getpid (), &nfd)); ++ if (fdtbl != NULL) ++ { ++ for (int i = 0; i < nfd; i++) ++ { ++ if (fdtbl[i].kf_fd >= 0) ++ { ++ int result = func (arg, fdtbl[i].kf_fd); ++ if (result != 0) ++ return result; ++ } ++ } ++ return 0; ++ } ++ /* We may fall through to the next case. */ ++#endif + + { + int max, fd; Property changes on: head/devel/gdb/files/commit-93579f6f90 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property