From owner-svn-ports-all@freebsd.org Mon Mar 9 20:58:29 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C479026D150; Mon, 9 Mar 2020 20:58:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48brD554tzz3F8k; Mon, 9 Mar 2020 20:58:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 956E118B18; Mon, 9 Mar 2020 20:58:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 029KwT5O080131; Mon, 9 Mar 2020 20:58:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 029KwSPS080123; Mon, 9 Mar 2020 20:58:28 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202003092058.029KwSPS080123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 9 Mar 2020 20:58:28 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r528132 - in head/devel/gdb: . files files/kgdb X-SVN-Group: ports-head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/devel/gdb: . files files/kgdb X-SVN-Commit-Revision: 528132 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2020 20:58:29 -0000 Author: jhb (src,doc committer) Date: Mon Mar 9 20:58:27 2020 New Revision: 528132 URL: https://svnweb.freebsd.org/changeset/ports/528132 Log: Update to GDB 9.1. GDB 9 rejects attempts to build in the source tree, so this uses CONFIGURE_OUTSOURCE. Some patch files were renamed to track moving of files in upstream. Approved by: pizzamig (maintainer) Differential Revision: https://reviews.freebsd.org/D23932 Added: head/devel/gdb/files/patch-gdb_gdbsupport_common-defs.h - copied, changed from r528131, head/devel/gdb/files/patch-gdb_common_common-defs.h head/devel/gdb/files/patch-gnulib_import_stddef.in.h - copied, changed from r528131, head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h head/devel/gdb/files/patch-libctf_swap.h (contents, props changed) Deleted: head/devel/gdb/files/commit-1163a4b7a3 head/devel/gdb/files/commit-36c53a0262 head/devel/gdb/files/commit-6e056c8178 head/devel/gdb/files/commit-8399425f5f head/devel/gdb/files/commit-945f3901b5 head/devel/gdb/files/commit-b0f87ed032 head/devel/gdb/files/commit-cd250a1898 head/devel/gdb/files/commit-ce25aa57a3 head/devel/gdb/files/commit-dd6876c91c head/devel/gdb/files/commit-df22c1e5d5 head/devel/gdb/files/commit-ef0bd2046f head/devel/gdb/files/commit-f5424cfa7e head/devel/gdb/files/patch-gdb_common_common-defs.h head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h Modified: head/devel/gdb/Makefile head/devel/gdb/distinfo head/devel/gdb/files/extrapatch-kgdb head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c head/devel/gdb/files/kgdb/amd64fbsd-kern.c head/devel/gdb/files/kgdb/fbsd-kld.c head/devel/gdb/files/kgdb/fbsd-kthr.c head/devel/gdb/files/kgdb/fbsd-kvm.c head/devel/gdb/files/kgdb/i386fbsd-kern.c head/devel/gdb/files/kgdb/riscv-fbsd-kern.c head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Modified: head/devel/gdb/Makefile ============================================================================== --- head/devel/gdb/Makefile Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/Makefile Mon Mar 9 20:58:27 2020 (r528132) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= gdb -PORTVERSION= 8.3.1 -PORTREVISION= 1 +PORTVERSION= 9.1 CATEGORIES= devel MASTER_SITES= GNU @@ -19,7 +18,7 @@ NOT_FOR_ARCHS= sparc64 LIB_DEPENDS= libmpfr.so:math/mpfr TEST_DEPENDS= runtest:misc/dejagnu -USES= compiler:c++11-lang cpe gmake libtool pkgconfig tar:xz +USES= compiler:c++11-lang cpe gmake libtool makeinfo pkgconfig tar:xz USE_PYTHON= flavors py3kplist TEST_TARGET= check @@ -34,20 +33,12 @@ CONFIGURE_ARGS= --program-suffix=${PORTVERSION:S/.//g} ${ICONV_CONFIGURE_ARG} \ --with-expat=yes --with-libexpat-prefix=${LOCALBASE} \ --without-libunwind-ia64 --with-system-zlib +CONFIGURE_OUTSOURCE= yes 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-1163a4b7a3 \ - ${FILESDIR}/commit-dd6876c91c \ - ${FILESDIR}/commit-6e056c8178 \ - ${FILESDIR}/commit-36c53a0262 \ - ${FILESDIR}/commit-ef0bd2046f \ - ${FILESDIR}/commit-945f3901b5 \ - ${FILESDIR}/commit-f5424cfa7e \ - ${FILESDIR}/commit-ce25aa57a3 \ - ${FILESDIR}/commit-8399425f5f LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} @@ -118,10 +109,6 @@ PLIST_SUB+= LIBCXX="" PLIST_SUB+= LIBCXX="@comment " .endif -.if ! ${PORT_OPTIONS:MBUNDLED_READLINE} -EXCLUDE+= readline -.endif - .if ! ${PORT_OPTIONS:MBUNDLED_ZLIB} EXCLUDE+= zlib .endif @@ -143,15 +130,15 @@ post-patch-KGDB-on: @${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} < ${FILESDIR}/extrapatch-kgdb do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \ + ${INSTALL_PROGRAM} ${INSTALL_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 ; \ + (cd ${INSTALL_WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls ) do-install-KGDB-on: - ${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \ + ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/gdb/kgdb \ ${STAGEDIR}${PREFIX}/bin/kgdb${VER} ${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1 @@ -168,9 +155,10 @@ do-install-GDB_LINK-on: .endif do-install-PYTHON-on: - (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) - (cd ${WRKSRC}/gdb/data-directory ; \ + (cd ${INSTALL_WRKSRC}/gdb ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) + (cd ${INSTALL_WRKSRC}/gdb/data-directory ; \ + ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) @(cd ${STAGEDIR}${PREFIX}/share/gdb/python && \ ${PYTHON_CMD} -m compileall .) . for f in gdb gdb/command gdb/function gdb/printer @@ -186,8 +174,9 @@ do-install-PYTHON-on: .endif do-install-GUILE-on: - (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) - (cd ${WRKSRC}/gdb/data-directory ; \ + (cd ${INSTALL_WRKSRC}/gdb ; \ + ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) + (cd ${INSTALL_WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) .include Modified: head/devel/gdb/distinfo ============================================================================== --- head/devel/gdb/distinfo Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/distinfo Mon Mar 9 20:58:27 2020 (r528132) @@ -1,5 +1,5 @@ -TIMESTAMP = 1569514923 -SHA256 (gdb-8.3.1.tar.xz) = 1e55b4d7cdca7b34be12f4ceae651623aa73b2fd640152313f9f66a7149757c4 -SIZE (gdb-8.3.1.tar.xz) = 20489528 +TIMESTAMP = 1582826568 +SHA256 (gdb-9.1.tar.xz) = 699e0ec832fdd2f21c8266171ea5bf44024bd05164fdf064e4d10cc4cf0d1737 +SIZE (gdb-9.1.tar.xz) = 20980824 SHA256 (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = d4235f98b71c4d5e3f01744de279e64808229dd46c0f00cac6a12fdeb3a998a1 SIZE (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = 5299 Modified: head/devel/gdb/files/extrapatch-kgdb ============================================================================== --- head/devel/gdb/files/extrapatch-kgdb Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/extrapatch-kgdb Mon Mar 9 20:58:27 2020 (r528132) @@ -1,18 +1,8 @@ diff --git gdb/Makefile.in gdb/Makefile.in -index 5614cc3386..b9acc63c3f 100644 +index c3e074b21f..8d026a98cb 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -230,7 +230,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import - - # Generated headers in the gnulib directory. These must be listed - # so that they are generated before other files are compiled. --GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@ -+GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h \ -+ $(GNULIB_BUILDDIR)/import/alloca.h @GNULIB_STDINT_H@ - - # - # CLI sub directory definitons -@@ -632,6 +633,7 @@ TARGET_OBS = @TARGET_OBS@ +@@ -648,6 +648,7 @@ TARGET_OBS = @TARGET_OBS@ # All target-dependent objects files that require 64-bit CORE_ADDR # (used with --enable-targets=all --enable-64-bit-bfd). ALL_64_TARGET_OBS = \ @@ -20,7 +10,7 @@ index 5614cc3386..b9acc63c3f 100644 aarch64-fbsd-tdep.o \ aarch64-linux-tdep.o \ aarch64-newlib-tdep.o \ -@@ -646,6 +648,7 @@ ALL_64_TARGET_OBS = \ +@@ -662,6 +663,7 @@ ALL_64_TARGET_OBS = \ amd64-darwin-tdep.o \ amd64-dicos-tdep.o \ amd64-fbsd-tdep.o \ @@ -28,7 +18,7 @@ index 5614cc3386..b9acc63c3f 100644 amd64-linux-tdep.o \ amd64-nbsd-tdep.o \ amd64-obsd-tdep.o \ -@@ -660,6 +663,7 @@ ALL_64_TARGET_OBS = \ +@@ -676,6 +678,7 @@ ALL_64_TARGET_OBS = \ ia64-vms-tdep.o \ mips64-obsd-tdep.o \ sparc64-fbsd-tdep.o \ @@ -36,7 +26,7 @@ index 5614cc3386..b9acc63c3f 100644 sparc64-linux-tdep.o \ sparc64-nbsd-tdep.o \ sparc64-obsd-tdep.o \ -@@ -676,6 +680,7 @@ ALL_TARGET_OBS = \ +@@ -694,6 +697,7 @@ ALL_TARGET_OBS = \ arch/ppc-linux-common.o \ arch/riscv.o \ arm-bsd-tdep.o \ @@ -44,7 +34,7 @@ index 5614cc3386..b9acc63c3f 100644 arm-fbsd-tdep.o \ arm-linux-tdep.o \ arm-nbsd-tdep.o \ -@@ -693,6 +698,8 @@ ALL_TARGET_OBS = \ +@@ -711,6 +715,8 @@ ALL_TARGET_OBS = \ csky-linux-tdep.o \ csky-tdep.o \ dicos-tdep.o \ @@ -53,7 +43,7 @@ index 5614cc3386..b9acc63c3f 100644 fbsd-tdep.o \ frv-linux-tdep.o \ frv-tdep.o \ -@@ -709,6 +716,7 @@ ALL_TARGET_OBS = \ +@@ -727,6 +733,7 @@ ALL_TARGET_OBS = \ i386-darwin-tdep.o \ i386-dicos-tdep.o \ i386-fbsd-tdep.o \ @@ -61,7 +51,7 @@ index 5614cc3386..b9acc63c3f 100644 i386-gnu-tdep.o \ i386-go32-tdep.o \ i386-linux-tdep.o \ -@@ -732,6 +740,7 @@ ALL_TARGET_OBS = \ +@@ -750,6 +757,7 @@ ALL_TARGET_OBS = \ mep-tdep.o \ microblaze-linux-tdep.o \ microblaze-tdep.o \ @@ -69,7 +59,7 @@ index 5614cc3386..b9acc63c3f 100644 mips-fbsd-tdep.o \ mips-linux-tdep.o \ mips-nbsd-tdep.o \ -@@ -750,6 +759,7 @@ ALL_TARGET_OBS = \ +@@ -768,6 +776,7 @@ ALL_TARGET_OBS = \ or1k-linux-tdep.o \ or1k-tdep.o \ ppc-fbsd-tdep.o \ @@ -77,7 +67,7 @@ index 5614cc3386..b9acc63c3f 100644 ppc-linux-tdep.o \ ppc-nbsd-tdep.o \ ppc-obsd-tdep.o \ -@@ -757,6 +767,7 @@ ALL_TARGET_OBS = \ +@@ -775,6 +784,7 @@ ALL_TARGET_OBS = \ ppc-sysv-tdep.o \ ppc64-tdep.o \ ravenscar-thread.o \ @@ -85,7 +75,7 @@ index 5614cc3386..b9acc63c3f 100644 riscv-fbsd-tdep.o \ riscv-linux-tdep.o \ riscv-tdep.o \ -@@ -1629,7 +1640,7 @@ generated_files = \ +@@ -1648,7 +1658,7 @@ generated_files = \ # Flags needed to compile Python code PYTHON_CFLAGS = @PYTHON_CFLAGS@ @@ -94,7 +84,7 @@ index 5614cc3386..b9acc63c3f 100644 @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do # Rule for compiling .c files in the top-level gdb directory. -@@ -1894,6 +1905,12 @@ ifneq ($(CODESIGN_CERT),) +@@ -1913,6 +1923,12 @@ ifneq ($(CODESIGN_CERT),) $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT) endif @@ -105,9 +95,9 @@ index 5614cc3386..b9acc63c3f 100644 + $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) + # Convenience rule to handle recursion. - $(LIBGNU) $(GNULIB_H): all-lib - all-lib: $(GNULIB_BUILDDIR)/Makefile -@@ -1940,6 +1957,7 @@ clean mostlyclean: $(CONFIG_CLEAN) + .PHONY: all-data-directory + all-data-directory: data-directory/Makefile +@@ -1953,6 +1969,7 @@ clean mostlyclean: $(CONFIG_CLEAN) rm -f init.c stamp-init version.c stamp-version rm -f gdb$(EXEEXT) core make.log rm -f gdb[0-9]$(EXEEXT) @@ -115,15 +105,15 @@ index 5614cc3386..b9acc63c3f 100644 rm -f test-cp-name-parser$(EXEEXT) rm -f xml-builtin.c stamp-xml rm -f $(DEPDIR)/* -@@ -2154,6 +2172,7 @@ force_update: - MAKEOVERRIDES = +@@ -2152,6 +2169,7 @@ MAKEOVERRIDES = ALLDEPFILES = \ + aarch32-tdep.c \ + aarch64-fbsd-kern.c \ aarch64-fbsd-nat.c \ aarch64-fbsd-tdep.c \ aarch64-linux-nat.c \ -@@ -2173,6 +2192,7 @@ ALLDEPFILES = \ +@@ -2171,6 +2189,7 @@ ALLDEPFILES = \ amd64-bsd-nat.c \ amd64-darwin-tdep.c \ amd64-dicos-tdep.c \ @@ -131,7 +121,7 @@ index 5614cc3386..b9acc63c3f 100644 amd64-fbsd-nat.c \ amd64-fbsd-tdep.c \ amd64-linux-nat.c \ -@@ -2187,6 +2207,7 @@ ALLDEPFILES = \ +@@ -2185,6 +2204,7 @@ ALLDEPFILES = \ arc-tdep.c \ arm.c \ arm-bsd-tdep.c \ @@ -139,7 +129,7 @@ index 5614cc3386..b9acc63c3f 100644 arm-fbsd-nat.c \ arm-fbsd-tdep.c \ arm-get-next-pcs.c \ -@@ -2207,6 +2228,9 @@ ALLDEPFILES = \ +@@ -2205,6 +2225,9 @@ ALLDEPFILES = \ csky-tdep.c \ darwin-nat.c \ dicos-tdep.c \ @@ -149,7 +139,7 @@ index 5614cc3386..b9acc63c3f 100644 fbsd-nat.c \ fbsd-tdep.c \ fork-child.c \ -@@ -2228,6 +2252,7 @@ ALLDEPFILES = \ +@@ -2226,6 +2249,7 @@ ALLDEPFILES = \ i386-darwin-nat.c \ i386-darwin-tdep.c \ i386-dicos-tdep.c \ @@ -157,7 +147,7 @@ index 5614cc3386..b9acc63c3f 100644 i386-fbsd-nat.c \ i386-fbsd-tdep.c \ i386-gnu-nat.c \ -@@ -2264,6 +2289,7 @@ ALLDEPFILES = \ +@@ -2262,6 +2286,7 @@ ALLDEPFILES = \ microblaze-linux-tdep.c \ microblaze-tdep.c \ mingw-hdep.c \ @@ -165,7 +155,7 @@ index 5614cc3386..b9acc63c3f 100644 mips-fbsd-nat.c \ mips-fbsd-tdep.c \ mips-linux-nat.c \ -@@ -2283,6 +2309,7 @@ ALLDEPFILES = \ +@@ -2281,6 +2306,7 @@ ALLDEPFILES = \ obsd-nat.c \ obsd-tdep.c \ posix-hdep.c \ @@ -173,7 +163,7 @@ index 5614cc3386..b9acc63c3f 100644 ppc-fbsd-nat.c \ ppc-fbsd-tdep.c \ ppc-linux-nat.c \ -@@ -2297,6 +2324,7 @@ ALLDEPFILES = \ +@@ -2295,6 +2321,7 @@ ALLDEPFILES = \ procfs.c \ ravenscar-thread.c \ remote-sim.c \ @@ -181,7 +171,7 @@ index 5614cc3386..b9acc63c3f 100644 riscv-fbsd-nat.c \ riscv-fbsd-tdep.c \ riscv-linux-nat.c \ -@@ -2333,6 +2361,7 @@ ALLDEPFILES = \ +@@ -2330,6 +2357,7 @@ ALLDEPFILES = \ sparc-sol2-nat.c \ sparc-sol2-tdep.c \ sparc-tdep.c \ @@ -189,7 +179,7 @@ index 5614cc3386..b9acc63c3f 100644 sparc64-fbsd-nat.c \ sparc64-fbsd-tdep.c \ sparc64-linux-nat.c \ -@@ -2596,7 +2625,7 @@ endif +@@ -2588,7 +2616,7 @@ endif # A list of all the objects we might care about in this build, for # dependency tracking. @@ -199,10 +189,10 @@ index 5614cc3386..b9acc63c3f 100644 # All the .deps files to include. diff --git gdb/config.in gdb/config.in -index ea907d2b56..1019e448c5 100644 +index cb886ba8e1..b8a937f6de 100644 --- gdb/config.in +++ gdb/config.in -@@ -219,6 +219,12 @@ +@@ -218,6 +218,12 @@ /* Define to 1 if your system has the kinfo_getvmmap function. */ #undef HAVE_KINFO_GETVMMAP @@ -216,10 +206,10 @@ index ea907d2b56..1019e448c5 100644 #undef HAVE_LANGINFO_CODESET diff --git gdb/configure gdb/configure -index 854837c50a..df64effa90 100755 +index b572d414ca..12e08354cc 100755 --- gdb/configure +++ gdb/configure -@@ -8107,6 +8107,126 @@ $as_echo "#define HAVE_KINFO_GETFILE 1" >>confdefs.h +@@ -8064,6 +8064,126 @@ $as_echo "#define HAVE_KINFO_GETFILE 1" >>confdefs.h fi @@ -347,10 +337,10 @@ index 854837c50a..df64effa90 100755 if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" diff --git gdb/configure.ac gdb/configure.ac -index 1527585839..7ff0361e69 100644 +index ca0da7980c..39dc6a3559 100644 --- gdb/configure.ac +++ gdb/configure.ac -@@ -511,6 +511,16 @@ AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd, +@@ -485,6 +485,16 @@ AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd, [AC_DEFINE(HAVE_KINFO_GETFILE, 1, [Define to 1 if your system has the kinfo_getfile function. ])]) @@ -368,7 +358,7 @@ index 1527585839..7ff0361e69 100644 # GDB may fork/exec the iconv program to get the list of supported character diff --git gdb/configure.nat gdb/configure.nat -index 64ee101d83..f32e6328e0 100644 +index fb4522f579..a5059ff37d 100644 --- gdb/configure.nat +++ gdb/configure.nat @@ -63,7 +63,8 @@ case ${gdb_host} in @@ -382,10 +372,10 @@ index 64ee101d83..f32e6328e0 100644 LOADLIBES='-lkvm' ;; diff --git gdb/configure.tgt gdb/configure.tgt -index 27f122ad04..5fa0d0179e 100644 +index caa42be1c0..45668ccaed 100644 --- gdb/configure.tgt +++ gdb/configure.tgt -@@ -98,7 +98,7 @@ esac +@@ -101,7 +101,7 @@ esac case "${targ}" in *-*-freebsd* | *-*-kfreebsd*-gnu) @@ -394,7 +384,7 @@ index 27f122ad04..5fa0d0179e 100644 *-*-netbsd* | *-*-knetbsd*-gnu) os_obs="nbsd-tdep.o solib-svr4.o";; *-*-openbsd*) -@@ -115,7 +115,7 @@ aarch64*-*-elf | aarch64*-*-rtems*) +@@ -118,7 +118,7 @@ aarch64*-*-elf | aarch64*-*-rtems*) aarch64*-*-freebsd*) # Target: FreeBSD/aarch64 @@ -403,7 +393,7 @@ index 27f122ad04..5fa0d0179e 100644 ;; aarch64*-*-linux*) -@@ -168,7 +168,7 @@ arm*-*-linux*) +@@ -171,7 +171,7 @@ arm*-*-linux*) ;; arm*-*-freebsd*) # Target: FreeBSD/arm @@ -412,7 +402,7 @@ index 27f122ad04..5fa0d0179e 100644 ;; arm*-*-netbsd* | arm*-*-knetbsd*-gnu) # Target: NetBSD/arm -@@ -267,7 +267,11 @@ i[34567]86-*-dicos*) +@@ -270,7 +270,11 @@ i[34567]86-*-dicos*) ;; i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) # Target: FreeBSD/i386 @@ -425,7 +415,7 @@ index 27f122ad04..5fa0d0179e 100644 ;; i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) # Target: NetBSD/i386 -@@ -421,7 +425,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) +@@ -424,7 +428,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) ;; mips*-*-freebsd*) # Target: MIPS running FreeBSD @@ -434,7 +424,7 @@ index 27f122ad04..5fa0d0179e 100644 gdb_sim=../sim/mips/libsim.a ;; mips64*-*-openbsd*) -@@ -488,7 +492,7 @@ or1k-*-* | or1knd-*-*) +@@ -491,7 +495,7 @@ or1k-*-* | or1knd-*-*) powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ @@ -443,7 +433,7 @@ index 27f122ad04..5fa0d0179e 100644 ravenscar-thread.o ppc-ravenscar-thread.o" ;; -@@ -543,7 +547,7 @@ s390*-*-linux*) +@@ -545,7 +549,7 @@ s390*-*-linux*) riscv*-*-freebsd*) # Target: FreeBSD/riscv @@ -452,7 +442,7 @@ index 27f122ad04..5fa0d0179e 100644 ;; riscv*-*-linux*) -@@ -622,6 +626,7 @@ sparc64-*-linux*) +@@ -624,6 +628,7 @@ sparc64-*-linux*) sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) # Target: FreeBSD/sparc64 gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \ @@ -460,7 +450,7 @@ index 27f122ad04..5fa0d0179e 100644 ravenscar-thread.o sparc-ravenscar-thread.o" ;; sparc-*-netbsd* | sparc-*-knetbsd*-gnu) -@@ -749,8 +754,8 @@ x86_64-*-linux*) +@@ -745,8 +750,8 @@ x86_64-*-linux*) ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) # Target: FreeBSD/amd64 @@ -472,10 +462,10 @@ index 27f122ad04..5fa0d0179e 100644 x86_64-*-mingw* | x86_64-*-cygwin*) # Target: MingW/amd64 diff --git gdb/defs.h gdb/defs.h -index a44e186907..c4bfd42073 100644 +index 567f214b81..abbaa1f950 100644 --- gdb/defs.h +++ gdb/defs.h -@@ -484,6 +484,7 @@ enum gdb_osabi +@@ -481,6 +481,7 @@ enum gdb_osabi GDB_OSABI_SOLARIS, GDB_OSABI_LINUX, GDB_OSABI_FREEBSD, @@ -483,20 +473,8 @@ index a44e186907..c4bfd42073 100644 GDB_OSABI_NETBSD, GDB_OSABI_OPENBSD, GDB_OSABI_WINCE, -diff --git gdb/gnulib/configure gdb/gnulib/configure -index 340c622cb3..bf0c4dd5d9 100644 ---- gdb/gnulib/configure -+++ gdb/gnulib/configure -@@ -18579,6 +18579,7 @@ else - case "$host_os" in - # Guess all is fine on glibc systems. - *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; -+ freebsd*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; - esac diff --git gdb/osabi.c gdb/osabi.c -index 5d4bbcdff8..a982b22624 100644 +index dec1bddc4c..06c514167e 100644 --- gdb/osabi.c +++ gdb/osabi.c @@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] = @@ -508,10 +486,10 @@ index 5d4bbcdff8..a982b22624 100644 { "OpenBSD", NULL }, { "WindowsCE", NULL }, diff --git gdb/regcache.c gdb/regcache.c -index 6e3eee9663..49ca1e1535 100644 +index 1580359cd4..50ff8d4039 100644 --- gdb/regcache.c +++ gdb/regcache.c -@@ -1003,6 +1003,22 @@ reg_buffer::raw_supply_zeroed (int regnum) +@@ -996,6 +996,22 @@ reg_buffer::raw_supply_zeroed (int regnum) m_register_status[regnum] = REG_VALID; } @@ -531,14 +509,14 @@ index 6e3eee9663..49ca1e1535 100644 + m_register_status[regnum] = REG_VALID; +} + - /* See common/common-regcache.h. */ + /* See gdbsupport/common-regcache.h. */ void diff --git gdb/regcache.h gdb/regcache.h -index 2b703ea4a4..d06e001957 100644 +index e2935eea74..83654be825 100644 --- gdb/regcache.h +++ gdb/regcache.h -@@ -224,6 +224,8 @@ public: +@@ -226,6 +226,8 @@ public: only LEN, without editing the rest of the register. */ void raw_supply_part (int regnum, int offset, int len, const gdb_byte *in); @@ -547,3 +525,16 @@ index 2b703ea4a4..d06e001957 100644 void invalidate (int regnum); virtual ~reg_buffer () = default; +diff --git gnulib/configure gnulib/configure +index 7c74371e8f..396467f68d 100644 +--- gnulib/configure ++++ gnulib/configure +@@ -20267,6 +20267,8 @@ else + case "$host_os" in + # Guess all is fine on glibc systems. + *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; ++ # Guess all is fine on FreeBSD. ++ freebsd*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # If we don't know, assume the worst. + *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; + esac Modified: head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c Mon Mar 9 20:58:27 2020 (r528132) @@ -32,6 +32,7 @@ #include "aarch64-tdep.h" #include "frame-unwind.h" +#include "gdbarch.h" #include "gdbcore.h" #include "osabi.h" #include "regcache.h" Modified: head/devel/gdb/files/kgdb/amd64fbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/amd64fbsd-kern.c Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c Mon Mar 9 20:58:27 2020 (r528132) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include "symtab.h" #include "trad-frame.h" #include "amd64-tdep.h" -#include "common/x86-xstate.h" +#include "gdbsupport/x86-xstate.h" #ifdef __amd64__ #include Modified: head/devel/gdb/files/kgdb/fbsd-kld.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kld.c Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/kgdb/fbsd-kld.c Mon Mar 9 20:58:27 2020 (r528132) @@ -242,9 +242,9 @@ adjust_section_address (struct target_section *sec, CO } *curr_base = align_power(*curr_base, - bfd_get_section_alignment(abfd, asect)); + bfd_section_alignment(asect)); sec->addr = *curr_base; - sec->endaddr = sec->addr + bfd_section_size(abfd, asect); + sec->endaddr = sec->addr + bfd_section_size(asect); *curr_base = sec->endaddr; } @@ -252,7 +252,6 @@ static void load_kld (char *path, CORE_ADDR base_addr, int from_tty) { struct target_section *sections = NULL, *sections_end = NULL, *s; - struct cleanup *cleanup; gdb_bfd_ref_ptr bfd; CORE_ADDR curr_addr; symfile_add_flags add_flags; @@ -274,7 +273,6 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt /* Build a section table from the bfd and relocate the sections. */ if (build_section_table (bfd.get(), §ions, §ions_end)) error("\"%s\": can't find file sections", path); - cleanup = make_cleanup(xfree, sections); curr_addr = base_addr; for (s = sections; s < sections_end; s++) adjust_section_address(s, &curr_addr); @@ -283,6 +281,7 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt section_addr_info sap = build_section_addr_info_from_section_table (sections, sections_end); + xfree(sections); printf_unfiltered("add symbol table from file \"%s\" at\n", path); for (i = 0; i < sap.size(); i++) @@ -297,8 +296,6 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt add_flags |= SYMFILE_VERBOSE; symbol_file_add_from_bfd(bfd.get(), path, add_flags, &sap, OBJF_USERLOADED, NULL); - - do_cleanups(cleanup); } static void @@ -384,39 +381,53 @@ kld_solib_create_inferior_hook (int from_tty) * Compute offsets of relevant members in struct linker_file * and the addresses of global variables. Newer kernels * include constants we can use without requiring debug - * symbols. If those aren't present, fall back to using - * home-grown offsetof() equivalents. + * symbols. */ - TRY { + try { info->off_address = parse_and_eval_long("kld_off_address"); info->off_filename = parse_and_eval_long("kld_off_filename"); info->off_pathname = parse_and_eval_long("kld_off_pathname"); info->off_next = parse_and_eval_long("kld_off_next"); - } CATCH(e, RETURN_MASK_ERROR) { - TRY { - info->off_address = parse_and_eval_address( - "&((struct linker_file *)0)->address"); - info->off_filename = parse_and_eval_address( - "&((struct linker_file *)0)->filename"); - info->off_pathname = parse_and_eval_address( - "&((struct linker_file *)0)->pathname"); - info->off_next = parse_and_eval_address( - "&((struct linker_file *)0)->link.tqe_next"); - } CATCH(e2, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { + try { + struct symbol *linker_file_sym = + lookup_symbol_in_language ("struct linker_file", + NULL, STRUCT_DOMAIN, language_c, NULL).symbol; + if (linker_file_sym == NULL) + error (_( + "Unable to find struct linker_file symbol")); + + info->off_address = + lookup_struct_elt (SYMBOL_TYPE (linker_file_sym), + "address", 0).offset / 8; + info->off_filename = + lookup_struct_elt (SYMBOL_TYPE (linker_file_sym), + "filename", 0).offset / 8; + info->off_pathname = + lookup_struct_elt (SYMBOL_TYPE (linker_file_sym), + "pathname", 0).offset / 8; + + struct type *link_type = + lookup_struct_elt_type (SYMBOL_TYPE (linker_file_sym), + "link", 0); + if (link_type == NULL) + error (_("Unable to find link type")); + + info->off_next = + lookup_struct_elt (link_type, "tqe_next", + 0).offset / 8; + } catch (const gdb_exception_error &e2) { return; } - END_CATCH } - END_CATCH - TRY { + try { info->module_path_addr = parse_and_eval_address("linker_path"); info->linker_files_addr = kgdb_lookup("linker_files"); info->kernel_file_addr = kgdb_lookup("linker_kernel_file"); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { return; } - END_CATCH solib_add(NULL, from_tty, auto_solib_add); } Modified: head/devel/gdb/files/kgdb/fbsd-kthr.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kthr.c Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/kgdb/fbsd-kthr.c Mon Mar 9 20:58:27 2020 (r528132) @@ -106,18 +106,18 @@ kgdb_thr_add_procs(CORE_ADDR paddr, CORE_ADDR (*cpu_pc LONGEST pid, tid; while (paddr != 0) { - TRY { + try { tdaddr = read_memory_typed_address (paddr + proc_off_p_threads, ptr_type); pid = read_memory_integer (paddr + proc_off_p_pid, 4, byte_order); pnext = read_memory_typed_address (paddr + proc_off_p_list, ptr_type); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { break; - } END_CATCH + } while (tdaddr != 0) { - TRY { + try { tid = read_memory_integer (tdaddr + thread_off_td_tid, 4, byte_order); oncpu = read_memory_unsigned_integer (tdaddr + @@ -127,9 +127,9 @@ kgdb_thr_add_procs(CORE_ADDR paddr, CORE_ADDR (*cpu_pc thread_off_td_pcb, ptr_type); tdnext = read_memory_typed_address (tdaddr + thread_off_td_plist, ptr_type); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { break; - } END_CATCH + } kt = XNEW (struct kthr); if (last == NULL) first = last = kt; @@ -172,27 +172,27 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int)) addr = kgdb_lookup("allproc"); if (addr == 0) return (NULL); - TRY { + try { paddr = read_memory_typed_address (addr, ptr_type); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { return (NULL); - } END_CATCH + } dumppcb = kgdb_lookup("dumppcb"); if (dumppcb == 0) return (NULL); - TRY { + try { dumptid = parse_and_eval_long("dumptid"); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { dumptid = -1; - } END_CATCH + } - TRY { + try { mp_maxid = parse_and_eval_long("mp_maxid"); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { mp_maxid = 0; - } END_CATCH + } stopped_cpus = kgdb_lookup("stopped_cpus"); /* @@ -201,7 +201,7 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int)) * kernels, try to extract these offsets using debug symbols. If * that fails, use native values. */ - TRY { + try { proc_off_p_pid = parse_and_eval_long("proc_off_p_pid"); proc_off_p_comm = parse_and_eval_long("proc_off_p_comm"); proc_off_p_list = parse_and_eval_long("proc_off_p_list"); @@ -212,29 +212,52 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int)) thread_off_td_pcb = parse_and_eval_long("thread_off_td_pcb"); thread_off_td_plist = parse_and_eval_long("thread_off_td_plist"); thread_oncpu_size = 4; - } CATCH(e, RETURN_MASK_ERROR) { - TRY { - proc_off_p_pid = parse_and_eval_address( - "&((struct proc *)0)->p_pid"); - proc_off_p_comm = parse_and_eval_address( - "&((struct proc *)0)->p_comm"); - proc_off_p_list = parse_and_eval_address( - "&((struct proc *)0)->p_list"); - proc_off_p_threads = parse_and_eval_address( - "&((struct proc *)0)->p_threads"); - thread_off_td_tid = parse_and_eval_address( - "&((struct thread *)0)->td_tid"); - thread_off_td_name = parse_and_eval_address( - "&((struct thread *)0)->td_name"); - thread_off_td_oncpu = parse_and_eval_address( - "&((struct thread *)0)->td_oncpu"); - thread_off_td_pcb = parse_and_eval_address( - "&((struct thread *)0)->td_pcb"); - thread_off_td_plist = parse_and_eval_address( - "&((struct thread *)0)->td_plist"); - thread_oncpu_size = parse_and_eval_long( - "sizeof(((struct thread *)0)->td_oncpu)"); - } CATCH(e2, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { + try { + struct symbol *proc_sym = + lookup_symbol_in_language ("struct proc", NULL, + STRUCT_DOMAIN, language_c, NULL).symbol; + if (proc_sym == NULL) + error (_("Unable to find struct proc symbol")); + + proc_off_p_pid = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_pid", + 0).offset / 8; + proc_off_p_comm = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_comm", + 0).offset / 8; + proc_off_p_list = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_list", + 0).offset / 8; + proc_off_p_threads = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), + "p_threads", 0).offset / 8; + + struct symbol *thread_sym = + lookup_symbol_in_language ("struct thread", NULL, + STRUCT_DOMAIN, language_c, NULL).symbol; + if (thread_sym == NULL) + error (_("Unable to find struct thread symbol")); + + thread_off_td_tid = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_tid", + 0).offset / 8; + thread_off_td_name = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_name", + 0).offset / 8; + thread_off_td_pcb = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_pcb", + 0).offset / 8; + thread_off_td_plist = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_plist", + 0).offset / 8; + + struct_elt td_oncpu = + lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_oncpu", + 0); + thread_off_td_oncpu = td_oncpu.offset / 8; + thread_oncpu_size = FIELD_BITSIZE(*td_oncpu.field) / 8; + } catch (const gdb_exception_error &e2) { proc_off_p_pid = offsetof(struct proc, p_pid); proc_off_p_comm = offsetof(struct proc, p_comm); proc_off_p_list = offsetof(struct proc, p_list); @@ -246,17 +269,17 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int)) thread_off_td_plist = offsetof(struct thread, td_plist); thread_oncpu_size = sizeof(((struct thread *)0)->td_oncpu); - } END_CATCH - } END_CATCH + } + } kgdb_thr_add_procs(paddr, cpu_pcb_addr); addr = kgdb_lookup("zombproc"); if (addr != 0) { - TRY { + try { paddr = read_memory_typed_address (addr, ptr_type); kgdb_thr_add_procs(paddr, cpu_pcb_addr); - } CATCH(e, RETURN_MASK_ERROR) { - } END_CATCH + } catch (const gdb_exception_error &e) { + } } curkthr = kgdb_thr_lookup_tid(dumptid); if (curkthr == NULL) @@ -326,7 +349,7 @@ kgdb_thr_extra_thread_info(int tid) if (kt == NULL) return (NULL); snprintf(buf, sizeof(buf), "PID=%d", kt->pid); - TRY { + try { read_memory_string (kt->paddr + proc_off_p_comm, comm, sizeof(comm)); strlcat(buf, ": ", sizeof(buf)); @@ -337,7 +360,7 @@ kgdb_thr_extra_thread_info(int tid) strlcat(buf, "/", sizeof(buf)); strlcat(buf, td_name, sizeof(buf)); } - } CATCH(e, RETURN_MASK_ERROR) { - } END_CATCH + } catch (const gdb_exception_error &e) { + } return (buf); } Modified: head/devel/gdb/files/kgdb/fbsd-kvm.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kvm.c Mon Mar 9 20:35:30 2020 (r528131) +++ head/devel/gdb/files/kgdb/fbsd-kvm.c Mon Mar 9 20:58:27 2020 (r528132) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "target.h" #include "value.h" #include "readline/tilde.h" +#include "gdbsupport/pathstuff.h" #include #include @@ -138,14 +139,14 @@ kgdb_dmesg(void) */ if (kgdb_quiet) return; - TRY { + try { bufp = parse_and_eval_address("msgbufp->msg_ptr"); size = parse_and_eval_long("msgbufp->msg_size"); rseq = parse_and_eval_long("msgbufp->msg_rseq"); wseq = parse_and_eval_long("msgbufp->msg_wseq"); - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { return; - } END_CATCH + } rseq = MSGBUF_SEQ_TO_POS(size, rseq); wseq = MSGBUF_SEQ_TO_POS(size, wseq); if (rseq == wseq) @@ -202,7 +203,7 @@ fbsd_kernel_osabi_sniffer(bfd *abfd) /* FreeBSD ELF kernels have an interpreter path of "/red/herring". */ bufp = buf; s = bfd_get_section_by_name(abfd, ".interp"); - if (s != NULL && bfd_section_size(abfd, s) == sizeof(buf) && + if (s != NULL && bfd_section_size(s) == sizeof(buf) && bfd_get_full_section_contents(abfd, s, &bufp) && memcmp(buf, KERNEL_INTERP, sizeof(buf)) == 0) return (GDB_OSABI_FREEBSD_KERNEL); @@ -241,7 +242,7 @@ class fbsd_kvm_target final : public process_stratum_t void files_info () override; bool thread_alive (ptid_t ptid) override; void update_thread_list () override; - const char *pid_to_str (ptid_t) override; + std::string pid_to_str (ptid_t) override; const char *extra_thread_info (thread_info *) override; bool has_all_memory () override { return false; } @@ -278,14 +279,15 @@ fbsd_kvm_target_open (const char *args, int from_tty) struct cleanup *old_chain; struct kthr *kt; kvm_t *nkvm; - char *temp, *kernel, *filename; + const char *kernel; + char *temp, *filename; bool writeable; if (ops == NULL || ops->supply_pcb == NULL || ops->cpu_pcb_addr == NULL) error ("ABI doesn't support a vmcore target"); target_preopen (from_tty); - kernel = get_exec_file (1); + kernel = get_exec_file (0); if (kernel == NULL) error ("Can't open a vmcore without a kernel"); @@ -305,18 +307,16 @@ fbsd_kvm_target_open (const char *args, int from_tty) error (_("Invalid argument")); filename = tilde_expand (*argv); - if (!IS_ABSOLUTE_PATH (filename)) { - temp = concat (current_directory, "/", - filename, NULL); - xfree(filename); - filename = temp; + if (filename[0] != '/') { + gdb::unique_xmalloc_ptr temp (gdb_abspath (filename)); + + xfree (filename); + filename = temp.release (); } } } } - old_chain = make_cleanup (xfree, filename); - #ifdef HAVE_KVM_OPEN2 nkvm = kvm_open2(kernel, filename, writeable ? O_RDWR : O_RDONLY, kvm_err, kgdb_resolve_symbol); @@ -324,11 +324,12 @@ fbsd_kvm_target_open (const char *args, int from_tty) nkvm = kvm_openfiles(kernel, filename, NULL, writeable ? O_RDWR : O_RDONLY, kvm_err); #endif - if (nkvm == NULL) + if (nkvm == NULL) { + xfree (filename); error ("Failed to open vmcore: %s", kvm_err); + } /* Don't free the filename now and close any previous vmcore. */ - discard_cleanups(old_chain); unpush_target(&fbsd_kvm_ops); #ifdef HAVE_KVM_DISP @@ -360,27 +361,27 @@ fbsd_kvm_target_open (const char *args, int from_tty) * symbol that is valid on all platforms, but kernbase is close * for most platforms. */ - TRY { + try { kernstart = parse_and_eval_address("vm_maxuser_address") + 1; - } CATCH(e, RETURN_MASK_ERROR) { + } catch (const gdb_exception_error &e) { kernstart = kgdb_lookup("kernbase"); - } END_CATCH + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***