From owner-svn-ports-all@freebsd.org Fri Jul 28 21:20:50 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD287DCF8EE; Fri, 28 Jul 2017 21:20:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 72EA071AF1; Fri, 28 Jul 2017 21:20:50 +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 v6SLKnLb076418; Fri, 28 Jul 2017 21:20:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SLKmlY076401; Fri, 28 Jul 2017 21:20:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707282120.v6SLKmlY076401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Jul 2017 21:20:48 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r446852 - 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: 446852 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.23 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: Fri, 28 Jul 2017 21:20:50 -0000 Author: jhb (src,doc committer) Date: Fri Jul 28 21:20:47 2017 New Revision: 446852 URL: https://svnweb.freebsd.org/changeset/ports/446852 Log: Upgrade to GDB 8.0. - Commit b5430a3ced fixes parsing of 32-bit MIPS process cores. - kgdb has been ported to 8.0 including renaming the new OSABI constant, using gdb_bfd_openr, new return type of ldirname, and solib_add changed. - GDB 8.0 requires C++11, however the port is marked as requiring C++14 as a workaround for bugs in clang 10.3. - patch-armfbsd is updated for the new OSABI constant names (a.out was removed in 8.0) and new filename convention (arm-fbsd-*) - patch-gdb-amd64-bsd-nat.c (renamed from patch-gdbamd64-bsd-nat.c) is simplified to just store the r_flags value before collecting registers from the register cache rather than a full copy of the entire register set. - patch-gdb-corelow.c has been removed. It isn't really correct and if arm cores still cause core dumps the error is in arm-fbsd-tdep.c. - patch-gdb-i386-fbsd-nat.c renamed to account for rename of patched file. - patch-gdb-x86bsd-nat.c has been removed. The file was renamed, but the stock file also compiled fine for me on i386. PR: 221025 (exp-run for 10.3) Submitted by: luca.pizzamiglio@gmail.com (original version) Reviewed by: luca.pizzamiglio@gmail.com (maintainer) Approved by: brooks Differential Revision: https://reviews.freebsd.org/D11465 Added: head/devel/gdb/files/commit-b5430a3ced (contents, props changed) head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c - copied, changed from r446851, head/devel/gdb/files/patch-gdb-amd64bsd-nat.c head/devel/gdb/files/patch-gdb-i386-fbsd-nat.c - copied, changed from r446851, head/devel/gdb/files/patch-gdb-i386fbsd-nat.c Deleted: head/devel/gdb/files/commit-387360daf9 head/devel/gdb/files/commit-b268007c68 head/devel/gdb/files/patch-gdb-amd64bsd-nat.c head/devel/gdb/files/patch-gdb-corelow.c head/devel/gdb/files/patch-gdb-i386fbsd-nat.c head/devel/gdb/files/patch-gdb-x86bsd-nat.c Modified: head/devel/gdb/Makefile head/devel/gdb/distinfo head/devel/gdb/files/extrapatch-kgdb 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/kgdb.h head/devel/gdb/files/kgdb/mipsfbsd-kern.c head/devel/gdb/files/kgdb/ppcfbsd-kern.c head/devel/gdb/files/kgdb/sparc64fbsd-kern.c head/devel/gdb/files/patch-armfbsd head/devel/gdb/files/patch-fixes head/devel/gdb/files/patch-gdb-configure head/devel/gdb/files/patch-gdb-fbsd-nat.c head/devel/gdb/files/patch-gdb-gnulib-import-stddef.in.h Modified: head/devel/gdb/Makefile ============================================================================== --- head/devel/gdb/Makefile Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/Makefile Fri Jul 28 21:20:47 2017 (r446852) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= gdb -PORTVERSION= 7.12.1 -PORTREVISION= 2 +PORTVERSION= 8.0 CATEGORIES= devel MASTER_SITES= GNU @@ -15,7 +14,11 @@ LICENSE= GPLv3 TEST_DEPENDS= runtest:misc/dejagnu TEST_TARGET= check -USES= compiler:env cpe iconv gmake libtool tar:xz +# XXX: This should be compiler:c++11-lib as GDB doesn't really require +# C++14. However, clang in 10.3 crashes while building this port. +# Requiring C++14 forces 10.3 to use an external version of clang while +# still using the base system clang on 11.0 and later. +USES= compiler:c++14-lang cpe iconv gmake libtool tar:xz USE_CSTD= gnu89 CPE_VENDOR= gnu GNU_CONFIGURE= yes @@ -31,8 +34,7 @@ CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in so CFLAGS+= -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable EXCLUDE= dejagnu expect sim texinfo intl EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /} -EXTRA_PATCHES= ${FILESDIR}/commit-387360daf9 \ - ${FILESDIR}/commit-b268007c68 +EXTRA_PATCHES= ${FILESDIR}/commit-b5430a3ced LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} Modified: head/devel/gdb/distinfo ============================================================================== --- head/devel/gdb/distinfo Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/distinfo Fri Jul 28 21:20:47 2017 (r446852) @@ -1,3 +1,3 @@ -TIMESTAMP = 1485162707 -SHA256 (gdb-7.12.1.tar.xz) = 4607680b973d3ec92c30ad029f1b7dbde3876869e6b3a117d8a7e90081113186 -SIZE (gdb-7.12.1.tar.xz) = 19225392 +TIMESTAMP = 1498935083 +SHA256 (gdb-8.0.tar.xz) = f6a24ffe4917e67014ef9273eb8b547cb96a13e5ca74895b06d683b391f3f4ee +SIZE (gdb-8.0.tar.xz) = 19588616 Added: head/devel/gdb/files/commit-b5430a3ced ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/gdb/files/commit-b5430a3ced Fri Jul 28 21:20:47 2017 (r446852) @@ -0,0 +1,117 @@ +commit b5430a3ced5fe5ba484bd9b3215b9ae19ced0160 +Author: John Baldwin +Date: Thu Jun 1 09:40:46 2017 -0700 + + Use the ELF class to determine the word size for FreeBSD core notes. + + FreeBSD ELF cores contain data structures with that have two different + layouts: one for ILP32 platforms and a second for LP64 platforms. + Previously, the code used 'bits_per_word' from 'arch_info', but this + field is not a reliable indicator of the format for FreeBSD MIPS cores + in particular. + + I had originally posted this patch back in November because process + cores for FreeBSD MIPS contained an e_flags value of 0 in the header + which resulted in a bfd_arch which always had 'bits_per_word' set to + 32. This permitted reading o32 cores, but not n64 cores. The feedback + I received then was to try to change n64 cores to use a different + default bfd_arch that had a 64-bit 'bits_per_word' when e_flags was zero. + I submitted a patch to that effect but it was never approved. Instead, + I changed FreeBSD's kernel and gcore commands to preserve the e_flags + field from an executable when generating process cores. With a proper + e_flags field in process cores, n64 cores now use a 64-bit bfd_arch and + now work fine. However, the change to include e_flags in the process + cores had the unintended side effect of breaking handling of o32 + process cores. Specifically, FreeBSD MIPS builds o32 with a default + MIPS architecture of 'mips3', thus FreeBSD process cores with a non-zero + e_flags match the 'mips3' bfd_arch which has 64 'bits_per_word'. + + From this, it seems that 'bits_per_word' for FreeBSD MIPS is not likely + to ever be completely correct. However, FreeBSD core dumps do + reliably set the ELF class to ELFCLASS32 for cores using ILP32 and + ELFCLASS64 for cores using LP64. As such, I think my original patch of + using the ELF class instead of 'bits_per_word' is probably the simplest + and most reliable approach for detecting the note structure layout. + + bfd/ChangeLog: + + * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to + determine structure sizes. + (elfcore_grok_freebsd_prstatus): Likewise. + +diff --git bfd/elf.c bfd/elf.c +index 863bd61c5f..34d39c547b 100644 +--- bfd/elf.c ++++ bfd/elf.c +@@ -9814,14 +9814,14 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note) + { + size_t offset; + +- switch (abfd->arch_info->bits_per_word) ++ switch (elf_elfheader (abfd)->e_ident[EI_CLASS]) + { +- case 32: ++ case ELFCLASS32: + if (note->descsz < 108) + return FALSE; + break; + +- case 64: ++ case ELFCLASS64: + if (note->descsz < 120) + return FALSE; + break; +@@ -9836,7 +9836,7 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note) + offset = 4; + + /* Skip over pr_psinfosz. */ +- if (abfd->arch_info->bits_per_word == 32) ++ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) + offset += 4; + else + { +@@ -9879,13 +9879,13 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) + offset = 4; + + /* Skip over pr_statussz. */ +- switch (abfd->arch_info->bits_per_word) ++ switch (elf_elfheader (abfd)->e_ident[EI_CLASS]) + { +- case 32: ++ case ELFCLASS32: + offset += 4; + break; + +- case 64: ++ case ELFCLASS64: + offset += 4; /* Padding before pr_statussz. */ + offset += 8; + break; +@@ -9895,13 +9895,16 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) + } + + /* Extract size of pr_reg from pr_gregsetsz. */ +- if (abfd->arch_info->bits_per_word == 32) ++ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) + size = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset); + else + size = bfd_h_get_64 (abfd, (bfd_byte *) note->descdata + offset); + + /* Skip over pr_gregsetsz and pr_fpregsetsz. */ +- offset += (abfd->arch_info->bits_per_word / 8) * 2; ++ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) ++ offset += 4 * 2; ++ else ++ offset += 8 * 2; + + /* Skip over pr_osreldate. */ + offset += 4; +@@ -9918,7 +9921,7 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) + offset += 4; + + /* Padding before pr_reg. */ +- if (abfd->arch_info->bits_per_word == 64) ++ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) + offset += 4; + + /* Make a ".reg/999" section and a ".reg" section. */ Modified: head/devel/gdb/files/extrapatch-kgdb ============================================================================== --- head/devel/gdb/files/extrapatch-kgdb Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/extrapatch-kgdb Fri Jul 28 21:20:47 2017 (r446852) @@ -1,8 +1,8 @@ diff --git gdb/Makefile.in gdb/Makefile.in -index 5b6ccea764..f501cf29d1 100644 +index 6e96a88a98..98c5fd2664 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -212,7 +212,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import +@@ -227,7 +227,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. @@ -12,35 +12,66 @@ index 5b6ccea764..f501cf29d1 100644 # # CLI sub directory definitons -@@ -653,7 +654,8 @@ ALL_64_TARGET_OBS = \ - ia64-linux-tdep.o ia64-vms-tdep.o ia64-tdep.o \ - mips64obsd-tdep.o \ - sparc64fbsd-tdep.o sparc64-linux-tdep.o sparc64nbsd-tdep.o \ -- sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o -+ sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o \ -+ amd64fbsd-kern.o sparc64fbsd-kern.o - - # All other target-dependent objects files (used with --enable-targets=all). - ALL_TARGET_OBS = \ -@@ -676,6 +678,8 @@ ALL_TARGET_OBS = \ - i386-sol2-tdep.o i386-tdep.o i387-tdep.o \ - i386-dicos-tdep.o i386-darwin-tdep.o \ - iq2000-tdep.o \ -+ fbsd-kld.o fbsd-kthr.o fbsd-kvm.o i386fbsd-kern.o ppcfbsd-kern.o \ +@@ -758,6 +759,7 @@ ALL_64_TARGET_OBS = \ + amd64-darwin-tdep.o \ + amd64-dicos-tdep.o \ + amd64-fbsd-tdep.o \ ++ amd64fbsd-kern.o \ + amd64-linux-tdep.o \ + amd64-nbsd-tdep.o \ + amd64-obsd-tdep.o \ +@@ -769,6 +771,7 @@ ALL_64_TARGET_OBS = \ + ia64-vms-tdep.o \ + mips64-obsd-tdep.o \ + sparc64-fbsd-tdep.o \ ++ sparc64fbsd-kern.o \ + sparc64-linux-tdep.o \ + sparc64-nbsd-tdep.o \ + sparc64-obsd-tdep.o \ +@@ -796,6 +799,9 @@ ALL_TARGET_OBS = \ + cris-linux-tdep.o \ + cris-tdep.o \ + dicos-tdep.o \ ++ fbsd-kld.o \ ++ fbsd-kthr.o \ ++ fbsd-kvm.o \ + fbsd-tdep.o \ + frv-linux-tdep.o \ + frv-tdep.o \ +@@ -812,6 +818,7 @@ ALL_TARGET_OBS = \ + i386-darwin-tdep.o \ + i386-dicos-tdep.o \ + i386-fbsd-tdep.o \ ++ i386fbsd-kern.o \ + i386-gnu-tdep.o \ + i386-go32-tdep.o \ + i386-linux-tdep.o \ +@@ -836,6 +843,7 @@ ALL_TARGET_OBS = \ + mep-tdep.o \ + microblaze-linux-tdep.o \ + microblaze-tdep.o \ + mipsfbsd-kern.o \ - linux-tdep.o \ - lm32-tdep.o \ - m32c-tdep.o \ -@@ -1133,7 +1137,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \ - $(COMPILE) $< - $(POSTCOMPILE) + mips-fbsd-tdep.o \ + mips-linux-tdep.o \ + mips-nbsd-tdep.o \ +@@ -853,6 +861,7 @@ ALL_TARGET_OBS = \ + nto-tdep.o \ + obsd-tdep.o \ + ppc-fbsd-tdep.o \ ++ ppcfbsd-kern.o \ + ppc-linux-tdep.o \ + ppc-nbsd-tdep.o \ + ppc-obsd-tdep.o \ +@@ -1870,7 +1879,7 @@ generated_files = \ + # Flags needed to compile Python code + PYTHON_CFLAGS = @PYTHON_CFLAGS@ -all: gdb$(EXEEXT) $(CONFIG_ALL) +all: gdb$(EXEEXT) kgdb$(EXEEXT) $(CONFIG_ALL) @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do - installcheck: -@@ -1412,6 +1416,12 @@ gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) + # Rule for compiling .c files in the top-level gdb directory. +@@ -2209,6 +2218,12 @@ gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) @@ -53,7 +84,7 @@ index 5b6ccea764..f501cf29d1 100644 # Convenience rule to handle recursion. $(LIBGNU) $(GNULIB_H): all-lib all-lib: $(GNULIB_BUILDDIR)/Makefile -@@ -1456,7 +1466,7 @@ clean mostlyclean: $(CONFIG_CLEAN) +@@ -2253,7 +2268,7 @@ clean mostlyclean: $(CONFIG_CLEAN) @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp rm -f init.c version.c observer.h observer.inc @@ -62,18 +93,71 @@ index 5b6ccea764..f501cf29d1 100644 rm -f gdb[0-9]$(EXEEXT) rm -f test-cp-name-parser$(EXEEXT) rm -f xml-builtin.c stamp-xml -@@ -1688,6 +1698,9 @@ ALLDEPFILES = \ - core-regset.c \ - dcache.c dicos-tdep.c darwin-nat.c \ +@@ -2475,6 +2490,7 @@ ALLDEPFILES = \ + amd64-bsd-nat.c \ + amd64-darwin-tdep.c \ + amd64-dicos-tdep.c \ ++ amd64fbsd-kern.c \ + amd64-fbsd-nat.c \ + amd64-fbsd-tdep.c \ + amd64-linux-nat.c \ +@@ -2510,6 +2526,9 @@ ALLDEPFILES = \ + dcache.c \ + dicos-tdep.c \ exec.c \ -+ fbsd-kld.c fbsd-kthr.c fbsd-kvm.c \ -+ amd64fbsd-kern.c i386fbsd-kern.c mipsfbsd-kern.c ppcfbsd-kern.c \ -+ sparc64fbsd-kern.c \ ++ fbsd-kld.c \ ++ fbsd-kthr.c \ ++ fbsd-kvm.c \ fbsd-nat.c \ fbsd-tdep.c \ fork-child.c \ -@@ -2761,7 +2774,7 @@ py-varobj.o: $(srcdir)/python/py-varobj.c +@@ -2531,6 +2550,7 @@ ALLDEPFILES = \ + i386-darwin-nat.c \ + i386-darwin-tdep.c \ + i386-dicos-tdep.c \ ++ i386fbsd-kern.c \ + i386-fbsd-nat.c \ + i386-fbsd-tdep.c \ + i386-gnu-nat.c \ +@@ -2572,6 +2592,7 @@ ALLDEPFILES = \ + mingw-hdep.c \ + mips-fbsd-nat.c \ + mips-fbsd-tdep.c \ ++ mipsfbsd-kern.c \ + mips-linux-nat.c \ + mips-linux-tdep.c \ + mips-nbsd-nat.c \ +@@ -2589,6 +2610,7 @@ ALLDEPFILES = \ + obsd-nat.c \ + obsd-tdep.c \ + posix-hdep.c \ ++ ppcfbsd-kern.c \ + ppc-fbsd-nat.c \ + ppc-fbsd-tdep.c \ + ppc-linux-nat.c \ +@@ -2633,6 +2655,7 @@ ALLDEPFILES = \ + sparc-sol2-nat.c \ + sparc-sol2-tdep.c \ + sparc-tdep.c \ ++ sparc64fbsd-kern.c \ + sparc64-fbsd-nat.c \ + sparc64-fbsd-tdep.c \ + sparc64-linux-nat.c \ +@@ -2664,6 +2687,12 @@ ALLDEPFILES = \ + xtensa-linux-tdep.c \ + xtensa-tdep.c \ + xtensa-xtregs.c \ ++ kgdb/kld.c \ ++ kgdb/kthr.c \ ++ kgdb/trgt.c \ ++ kgdb/trgt_amd64.c \ ++ kgdb/trgt_i386.c \ ++ kgdb/trgt_sparc64.c \ + common/mingw-strerror.c \ + common/posix-strerror.c +@@ -2925,7 +2954,7 @@ endif + # A list of all the objects we might care about in this build, for # dependency tracking. -all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o \ @@ -82,10 +166,10 @@ index 5b6ccea764..f501cf29d1 100644 # Ensure that generated files are created early. Use order-only diff --git gdb/config.in gdb/config.in -index c82a5b4bac..34140b2d59 100644 +index 3f8a72326b..bb1e8c23bf 100644 --- gdb/config.in +++ gdb/config.in -@@ -219,6 +219,9 @@ +@@ -222,6 +222,9 @@ /* Define to 1 if your system has the kinfo_getvmmap function. */ #undef HAVE_KINFO_GETVMMAP @@ -106,10 +190,10 @@ index f433347a20..5470795612 100644 + +LOADLIBES= -lkvm diff --git gdb/configure gdb/configure -index b5c045cf10..68299ff16c 100755 +index e14886b67d..5682ce42d6 100755 --- gdb/configure +++ gdb/configure -@@ -7112,6 +7112,66 @@ $as_echo "#define HAVE_KINFO_GETVMMAP 1" >>confdefs.h +@@ -7968,6 +7968,66 @@ $as_echo "#define HAVE_KINFO_GETVMMAP 1" >>confdefs.h fi @@ -177,10 +261,10 @@ index b5c045cf10..68299ff16c 100755 if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" diff --git gdb/configure.ac gdb/configure.ac -index f774db7ea6..efccdd3fb1 100644 +index 50f6f592ba..89cdc9cc8e 100644 --- gdb/configure.ac +++ gdb/configure.ac -@@ -540,6 +540,11 @@ AC_SEARCH_LIBS(kinfo_getvmmap, util util-freebsd, +@@ -530,6 +530,11 @@ AC_SEARCH_LIBS(kinfo_getvmmap, util util-freebsd, [AC_DEFINE(HAVE_KINFO_GETVMMAP, 1, [Define to 1 if your system has the kinfo_getvmmap function. ])]) @@ -193,15 +277,15 @@ index f774db7ea6..efccdd3fb1 100644 # GDB may fork/exec the iconv program to get the list of supported character diff --git gdb/configure.tgt gdb/configure.tgt -index 9ee9f7a799..fb14b19405 100644 +index fdcb7b1d69..d99aa325ab 100644 --- gdb/configure.tgt +++ gdb/configure.tgt -@@ -190,7 +190,13 @@ i[34567]86-*-dicos*) +@@ -198,7 +198,13 @@ i[34567]86-*-dicos*) i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) # Target: FreeBSD/i386 - gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ -- bsd-uthread.o fbsd-tdep.o solib-svr4.o" -+ bsd-uthread.o fbsd-tdep.o solib-svr4.o \ + gdb_target_obs="i386-tdep.o i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ +- fbsd-tdep.o solib-svr4.o" ++ fbsd-tdep.o solib-svr4.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o i386fbsd-kern.o" + if test "x$enable_64_bit_bfd" = "xyes"; then + # Target: FreeBSD amd64 @@ -211,7 +295,7 @@ index 9ee9f7a799..fb14b19405 100644 ;; i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) # Target: NetBSD/i386 -@@ -360,7 +366,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) +@@ -372,7 +378,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) ;; mips*-*-freebsd*) # Target: MIPS running FreeBSD @@ -221,19 +305,19 @@ index 9ee9f7a799..fb14b19405 100644 gdb_sim=../sim/mips/libsim.a ;; mips64*-*-openbsd*) -@@ -419,7 +426,8 @@ powerpc*-*-freebsd*) +@@ -431,7 +438,8 @@ powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ - ppcfbsd-tdep.o fbsd-tdep.o solib-svr4.o \ + ppc-fbsd-tdep.o fbsd-tdep.o solib-svr4.o \ - ravenscar-thread.o ppc-ravenscar-thread.o" + ravenscar-thread.o ppc-ravenscar-thread.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o ppcfbsd-kern.o" ;; powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu) -@@ -543,7 +551,8 @@ sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) +@@ -555,7 +563,8 @@ sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) # Target: FreeBSD/sparc64 - gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64fbsd-tdep.o \ + gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \ fbsd-tdep.o solib-svr4.o \ - ravenscar-thread.o sparc-ravenscar-thread.o" + ravenscar-thread.o sparc-ravenscar-thread.o \ @@ -241,46 +325,46 @@ index 9ee9f7a799..fb14b19405 100644 ;; sparc-*-netbsd* | sparc-*-knetbsd*-gnu) # Target: NetBSD/sparc -@@ -674,7 +683,9 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) +@@ -686,7 +695,9 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) # Target: FreeBSD/amd64 - gdb_target_obs="amd64-tdep.o amd64fbsd-tdep.o i386-tdep.o \ - i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ -- bsd-uthread.o fbsd-tdep.o solib-svr4.o" -+ bsd-uthread.o fbsd-tdep.o solib-svr4.o \ + gdb_target_obs="amd64-tdep.o amd64-fbsd-tdep.o i386-tdep.o \ + i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ +- fbsd-tdep.o solib-svr4.o" ++ fbsd-tdep.o solib-svr4.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o amd64fbsd-kern.o \ + i386fbsd-kern.o" ;; x86_64-*-mingw* | x86_64-*-cygwin*) # Target: MingW/amd64 diff --git gdb/defs.h gdb/defs.h -index 9b44f44349..f176be1108 100644 +index a0b586f401..44d3d112ed 100644 --- gdb/defs.h +++ gdb/defs.h -@@ -598,6 +598,7 @@ enum gdb_osabi +@@ -590,6 +590,7 @@ enum gdb_osabi + GDB_OSABI_SOLARIS, GDB_OSABI_LINUX, - GDB_OSABI_FREEBSD_AOUT, - GDB_OSABI_FREEBSD_ELF, -+ GDB_OSABI_FREEBSD_ELF_KERNEL, - GDB_OSABI_NETBSD_AOUT, - GDB_OSABI_NETBSD_ELF, - GDB_OSABI_OPENBSD_ELF, + GDB_OSABI_FREEBSD, ++ GDB_OSABI_FREEBSD_KERNEL, + GDB_OSABI_NETBSD, + GDB_OSABI_OPENBSD, + GDB_OSABI_WINCE, diff --git gdb/osabi.c gdb/osabi.c -index f7d4e74239..130ffef37e 100644 +index 84fa9c0273..5c49e22657 100644 --- gdb/osabi.c +++ gdb/osabi.c -@@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] = +@@ -65,6 +65,7 @@ static const struct osabi_names gdb_osabi_names[] = + { "Solaris", NULL }, { "GNU/Linux", "linux(-gnu)?" }, - { "FreeBSD/a.out", NULL }, - { "FreeBSD/ELF", NULL }, + { "FreeBSD", NULL }, + { "FreeBSD/kernel", NULL }, - { "NetBSD/a.out", NULL }, - { "NetBSD/ELF", NULL }, - { "OpenBSD/ELF", NULL }, + { "NetBSD", NULL }, + { "OpenBSD", NULL }, + { "WindowsCE", NULL }, diff --git gdb/regcache.c gdb/regcache.c -index a5c90a6314..05044e5293 100644 +index 37bc2f0046..9da3aaa514 100644 --- gdb/regcache.c +++ gdb/regcache.c -@@ -1083,6 +1083,20 @@ regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf) +@@ -1105,6 +1105,20 @@ regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf) } } @@ -302,10 +386,10 @@ index a5c90a6314..05044e5293 100644 void diff --git gdb/regcache.h gdb/regcache.h -index 1bb0ce0ec8..65783b6355 100644 +index 1d60fa7616..9b8a4723a3 100644 --- gdb/regcache.h +++ gdb/regcache.h -@@ -135,6 +135,8 @@ extern void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); +@@ -149,6 +149,8 @@ extern void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); extern void regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf); Modified: head/devel/gdb/files/kgdb/amd64fbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/amd64fbsd-kern.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c Fri Jul 28 21:20:47 2017 (r446852) @@ -238,7 +238,7 @@ void _initialize_amd64_kgdb_tdep(void) { gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, - GDB_OSABI_FREEBSD_ELF_KERNEL, amd64fbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, amd64fbsd_kernel_init_abi); #ifdef __amd64__ gdb_assert(offsetof(struct pcb, pcb_rbx) Modified: head/devel/gdb/files/kgdb/fbsd-kld.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kld.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/fbsd-kld.c Fri Jul 28 21:20:47 2017 (r446852) @@ -140,26 +140,22 @@ check_kld_path (char *path, size_t path_size) * in the various paths in the module path. */ static int -find_kld_path (char *filename, char *path, size_t path_size) +find_kld_path (const char *filename, char *path, size_t path_size) { struct kld_info *info; struct cleanup *cleanup; char *module_path; - char *kernel_dir, *module_dir, *cp; + char *module_dir, *cp; int error; info = get_kld_info(); if (exec_bfd) { - kernel_dir = ldirname(bfd_get_filename(exec_bfd)); - if (kernel_dir != NULL) { - cleanup = make_cleanup(xfree, kernel_dir); - snprintf(path, path_size, "%s/%s", kernel_dir, + std::string kernel_dir = ldirname(bfd_get_filename(exec_bfd)); + if (!kernel_dir.empty()) { + snprintf(path, path_size, "%s/%s", kernel_dir.c_str(), filename); - if (check_kld_path(path, path_size)) { - do_cleanups(cleanup); + if (check_kld_path(path, path_size)) return (1); - } - do_cleanups(cleanup); } } if (info->module_path_addr != 0) { @@ -271,28 +267,28 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt struct section_addr_info *sap; struct target_section *sections = NULL, *sections_end = NULL, *s; struct cleanup *cleanup; - bfd *bfd; + gdb_bfd_ref_ptr bfd; CORE_ADDR curr_addr; - int add_flags, i; + symfile_add_flags add_flags; + int i; /* Open the kld. */ - bfd = bfd_openr(path, gnutarget); + bfd = gdb_bfd_openr(path, gnutarget); if (bfd == NULL) error("\"%s\": can't open: %s", path, bfd_errmsg(bfd_get_error())); - cleanup = make_cleanup_bfd_unref(bfd); - if (!bfd_check_format(bfd, bfd_object)) + if (!bfd_check_format(bfd.get(), bfd_object)) error("\%s\": not an object file", path); /* Make sure we have a .text section. */ - if (bfd_get_section_by_name (bfd, ".text") == NULL) + if (bfd_get_section_by_name (bfd.get(), ".text") == NULL) error("\"%s\": can't find text section", path); /* Build a section table from the bfd and relocate the sections. */ - if (build_section_table (bfd, §ions, §ions_end)) + if (build_section_table (bfd.get(), §ions, §ions_end)) error("\"%s\": can't find file sections", path); - make_cleanup(xfree, sections); + cleanup = make_cleanup(xfree, sections); curr_addr = base_addr; for (s = sections; s < sections_end; s++) adjust_section_address(s, &curr_addr); @@ -313,7 +309,8 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt add_flags = 0; if (from_tty) add_flags |= SYMFILE_VERBOSE; - symbol_file_add(path, add_flags, sap, OBJF_USERLOADED); + symbol_file_add_from_bfd(bfd.get(), path, add_flags, sap, + OBJF_USERLOADED, NULL); do_cleanups(cleanup); } @@ -431,14 +428,9 @@ kld_solib_create_inferior_hook (int from_tty) } END_CATCH - solib_add(NULL, 1, ¤t_target, auto_solib_add); + solib_add(NULL, from_tty, auto_solib_add); } -static void -kld_special_symbol_handling (void) -{ -} - static struct so_list * kld_current_sos (void) { @@ -547,7 +539,8 @@ kld_in_dynsym_resolve_code (CORE_ADDR pc) } static int -kld_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) +kld_find_and_open_solib (const char *solib, unsigned o_flags, + char **temp_pathname) { char path[PATH_MAX]; int fd; @@ -575,7 +568,6 @@ _initialize_kld_target(void) kld_so_ops.clear_so = kld_clear_so; kld_so_ops.clear_solib = kld_clear_solib; kld_so_ops.solib_create_inferior_hook = kld_solib_create_inferior_hook; - kld_so_ops.special_symbol_handling = kld_special_symbol_handling; kld_so_ops.current_sos = kld_current_sos; kld_so_ops.open_symbol_file_object = kld_open_symbol_file_object; kld_so_ops.in_dynsym_resolve_code = kld_in_dynsym_resolve_code; Modified: head/devel/gdb/files/kgdb/fbsd-kthr.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kthr.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/fbsd-kthr.c Fri Jul 28 21:20:47 2017 (r446852) @@ -322,7 +322,7 @@ kgdb_thr_next(struct kthr *kt) return (kt->next); } -char * +const char * kgdb_thr_extra_thread_info(int tid) { char comm[MAXCOMLEN + 1]; Modified: head/devel/gdb/files/kgdb/fbsd-kvm.c ============================================================================== --- head/devel/gdb/files/kgdb/fbsd-kvm.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/fbsd-kvm.c Fri Jul 28 21:20:47 2017 (r446852) @@ -195,7 +195,7 @@ fbsd_kernel_osabi_sniffer(bfd *abfd) if (s != NULL && bfd_section_size(abfd, s) == sizeof(buf) && bfd_get_full_section_contents(abfd, s, &bufp) && memcmp(buf, KERNEL_INTERP, sizeof(buf)) == 0) - return (GDB_OSABI_FREEBSD_ELF_KERNEL); + return (GDB_OSABI_FREEBSD_KERNEL); return (GDB_OSABI_UNKNOWN); } @@ -362,7 +362,7 @@ kgdb_trgt_detach(struct target_ops *ops, const char *a printf_filtered("No vmcore file now.\n"); } -static char * +static const char * kgdb_trgt_extra_thread_info(struct target_ops *ops, struct thread_info *ti) { @@ -402,7 +402,7 @@ kgdb_trgt_update_thread_list(struct target_ops *ops) #endif } -static char * +static const char * kgdb_trgt_pid_to_str(struct target_ops *ops, ptid_t ptid) { static char buf[33]; Modified: head/devel/gdb/files/kgdb/i386fbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/i386fbsd-kern.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/i386fbsd-kern.c Fri Jul 28 21:20:47 2017 (r446852) @@ -473,7 +473,7 @@ _initialize_i386_kgdb_tdep(void) bfd_target_elf_flavour, fbsd_kernel_osabi_sniffer); gdbarch_register_osabi (bfd_arch_i386, 0, - GDB_OSABI_FREEBSD_ELF_KERNEL, i386fbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, i386fbsd_kernel_init_abi); i386fbsd_pspace_data = register_program_space_data_with_cleanup (NULL, i386fbsd_pspace_data_cleanup); Modified: head/devel/gdb/files/kgdb/kgdb.h ============================================================================== --- head/devel/gdb/files/kgdb/kgdb.h Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/kgdb.h Fri Jul 28 21:20:47 2017 (r446852) @@ -53,7 +53,7 @@ struct kthr *kgdb_thr_lookup_pid(int); struct kthr *kgdb_thr_lookup_paddr(uintptr_t); struct kthr *kgdb_thr_lookup_taddr(uintptr_t); struct kthr *kgdb_thr_next(struct kthr *); -char *kgdb_thr_extra_thread_info(int); +const char *kgdb_thr_extra_thread_info(int); enum gdb_osabi fbsd_kernel_osabi_sniffer(bfd *abfd); void fbsd_vmcore_set_supply_pcb (struct gdbarch *gdbarch, Modified: head/devel/gdb/files/kgdb/mipsfbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/mipsfbsd-kern.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/mipsfbsd-kern.c Fri Jul 28 21:20:47 2017 (r446852) @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c 249878 2013-04-25 04:53:01Z imp $"); #include #ifdef __mips__ @@ -300,6 +300,6 @@ _initialize_mips_kgdb_tdep (void) gdbarch_register_osabi_sniffer(bfd_arch_mips, bfd_target_elf_flavour, fbsd_kernel_osabi_sniffer); - gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_ELF_KERNEL, + gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_KERNEL, mipsfbsd_kernel_init_abi); } Modified: head/devel/gdb/files/kgdb/ppcfbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/ppcfbsd-kern.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/ppcfbsd-kern.c Fri Jul 28 21:20:47 2017 (r446852) @@ -58,7 +58,7 @@ ppcfbsd_supply_pcb(struct regcache *regcache, CORE_ADD tdep = gdbarch_tdep (target_gdbarch()); - if (target_read_memory(pcb_addr, (gdb_byte *)&pcb, sizeof(pcb)) != 0) + if (target_read_memory(pcb_addr, &pcb, sizeof(pcb)) != 0) memset(&pcb, 0, sizeof(pcb)); /* @@ -241,14 +241,14 @@ _initialize_ppc_kgdb_tdep(void) bfd_target_elf_flavour, fbsd_kernel_osabi_sniffer); gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, - GDB_OSABI_FREEBSD_ELF_KERNEL, ppcfbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, ppcfbsd_kernel_init_abi); gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, - GDB_OSABI_FREEBSD_ELF_KERNEL, ppcfbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, ppcfbsd_kernel_init_abi); /* Not sure about this one. */ gdbarch_register_osabi_sniffer(bfd_arch_rs6000, bfd_target_elf_flavour, fbsd_kernel_osabi_sniffer); gdbarch_register_osabi (bfd_arch_rs6000, 0, - GDB_OSABI_FREEBSD_ELF_KERNEL, ppcfbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, ppcfbsd_kernel_init_abi); } Modified: head/devel/gdb/files/kgdb/sparc64fbsd-kern.c ============================================================================== --- head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Fri Jul 28 21:20:47 2017 (r446852) @@ -55,7 +55,7 @@ sparc64fbsd_supply_pcb(struct regcache *regcache, CORE { struct pcb pcb; - if (target_read_memory(pcb_addr, (gdb_byte *)&pcb, sizeof(pcb)) != 0) + if (target_read_memory(pcb_addr, &pcb, sizeof(pcb)) != 0) memset(&pcb, 0, sizeof(pcb)); regcache_raw_supply(regcache, SPARC_SP_REGNUM, (char *)&pcb.pcb_sp); @@ -252,14 +252,14 @@ kgdb_trgt_trapframe_prev_register(struct frame_info *n ofs = (regnum - SPARC_L0_REGNUM) * 8; *addrp = cache->sp + BIAS + ofs; *lvalp = lval_memory; - target_read_memory(*addrp, (gdb_byte *)valuep, regsz); + target_read_memory(*addrp, valuep, regsz); } return; } *addrp = cache->fp + ofs; *lvalp = lval_memory; - target_read_memory(*addrp, (gdb_byte *)valuep, regsz); + target_read_memory(*addrp, valuep, regsz); } static const struct frame_unwind kgdb_trgt_trapframe_unwind = { @@ -314,6 +314,6 @@ _initialize_sparc64_kgdb_tdep(void) bfd_target_elf_flavour, fbsd_kernel_osabi_sniffer); gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, - GDB_OSABI_FREEBSD_ELF_KERNEL, sparc64fbsd_kernel_init_abi); + GDB_OSABI_FREEBSD_KERNEL, sparc64fbsd_kernel_init_abi); } Modified: head/devel/gdb/files/patch-armfbsd ============================================================================== --- head/devel/gdb/files/patch-armfbsd Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/patch-armfbsd Fri Jul 28 21:20:47 2017 (r446852) @@ -1,8 +1,8 @@ -diff --git gdb/armfbsd-nat.c gdb/armfbsd-nat.c +diff --git gdb/arm-fbsd-nat.c gdb/arm-fbsd-nat.c new file mode 100644 -index 0000000..b883411 +index 0000000000..b883411ceb --- /dev/null -+++ gdb/armfbsd-nat.c ++++ gdb/arm-fbsd-nat.c @@ -0,0 +1,215 @@ +/* Native-dependent code for BSD Unix running on ARM's, for GDB. + @@ -219,11 +219,11 @@ index 0000000..b883411 + t->to_store_registers = armfbsd_store_inferior_registers; + fbsd_nat_add_target (t); +} -diff --git gdb/armfbsd-tdep.c gdb/armfbsd-tdep.c +diff --git gdb/arm-fbsd-tdep.c gdb/arm-fbsd-tdep.c new file mode 100644 -index 0000000..f58c323 +index 0000000000..c76bc96700 --- /dev/null -+++ gdb/armfbsd-tdep.c ++++ gdb/arm-fbsd-tdep.c @@ -0,0 +1,109 @@ +/* Target-dependent code for PowerPC systems running FreeBSD. + @@ -331,37 +331,35 @@ index 0000000..f58c323 +_initialize_armfbsd_tdep (void) +{ + -+ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD_ELF, ++ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD, + arm_freebsd_elf_init_abi); +} diff --git gdb/config/arm/fbsd.mh gdb/config/arm/fbsd.mh new file mode 100644 -index 0000000..0a2d8b1 +index 0000000000..7b2fd44b91 --- /dev/null +++ gdb/config/arm/fbsd.mh @@ -0,0 +1,3 @@ +# Host: FreeBSD/arm -+NATDEPFILES= armfbsd-nat.o fbsd-nat.o fork-child.o inf-ptrace.o ++NATDEPFILES= arm-fbsd-nat.o fbsd-nat.o fork-child.o inf-ptrace.o +HAVE_NATIVE_GCORE_HOST = 1 diff --git gdb/Makefile.in gdb/Makefile.in -index dfaa8a3..ddad28d 100644 +index 1d2dbaf3f7..6e96a88a98 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -659,7 +659,7 @@ - ALL_TARGET_OBS = \ - armbsd-tdep.o arm.o arm-linux.o arm-linux-tdep.o \ - arm-get-next-pcs.o arm-symbian-tdep.o \ -- armnbsd-tdep.o armobsd-tdep.o \ -+ armnbsd-tdep.o armobsd-tdep.o armfbsd-tdep.o \ - arm-tdep.o arm-wince-tdep.o \ - avr-tdep.o \ - bfin-linux-tdep.o bfin-tdep.o \ -@@ -1666,7 +1666,7 @@ - arm.c arm-get-next-pcs.c \ - arm-linux.c arm-linux-nat.c arm-linux-tdep.c \ - arm-symbian-tdep.c arm-tdep.c \ -- armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ -+ armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c armfbsd-tdep.c \ - avr-tdep.c \ - bfin-linux-tdep.c bfin-tdep.c \ - bsd-uthread.c bsd-kvm.c \ +@@ -780,6 +780,7 @@ ALL_TARGET_OBS = \ + arc-tdep.o \ + arm.o \ + arm-bsd-tdep.o \ ++ arm-fbsd-tdep.o \ + arm-get-next-pcs.o \ + arm-linux.o \ + arm-linux-tdep.o \ +@@ -2488,6 +2489,7 @@ ALLDEPFILES = \ + arc-tdep.c \ + arm.c \ + arm-bsd-tdep.c \ ++ arm-fbsd-tdep.c \ + arm-get-next-pcs.c \ + arm-linux.c \ + arm-linux-nat.c \ Modified: head/devel/gdb/files/patch-fixes ============================================================================== --- head/devel/gdb/files/patch-fixes Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/patch-fixes Fri Jul 28 21:20:47 2017 (r446852) @@ -1,11 +1,12 @@ ---- gdb/compile/compile-loc2c.c.orig 2016-07-05 12:30:44.811467295 +0200 -+++ gdb/compile/compile-loc2c.c 2016-07-05 12:38:46.432434206 +0200 -@@ -670,7 +670,7 @@ - enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr; +diff --git gdb/compile/compile-loc2c.c gdb/compile/compile-loc2c.c +index a53214f2e5..67af62bb58 100644 +--- gdb/compile/compile-loc2c.c ++++ gdb/compile/compile-loc2c.c +@@ -669,6 +669,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file &stream, uint64_t uoffset, reg; int64_t offset; -- + + uoffset = 0; - print_spaces (indent - 2, stream); + print_spaces (indent - 2, &stream); if (info[op_ptr - base].label) { Copied and modified: head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c (from r446851, head/devel/gdb/files/patch-gdb-amd64bsd-nat.c) ============================================================================== --- head/devel/gdb/files/patch-gdb-amd64bsd-nat.c Fri Jul 28 21:14:57 2017 (r446851, copy source) +++ head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c Fri Jul 28 21:20:47 2017 (r446852) @@ -1,5 +1,7 @@ ---- gdb/amd64bsd-nat.c.orig 2016-02-10 04:19:39.000000000 +0100 -+++ gdb/amd64bsd-nat.c 2016-03-04 11:17:58.581638025 +0100 +diff --git gdb/amd64-bsd-nat.c gdb/amd64-bsd-nat.c +index ca61a3551b..0f875f8296 100644 +--- gdb/amd64-bsd-nat.c ++++ gdb/amd64-bsd-nat.c @@ -28,6 +28,7 @@ #include #include @@ -8,30 +10,23 @@ #include "amd64-tdep.h" #include "amd64-nat.h" -@@ -98,14 +99,25 @@ - +@@ -95,12 +96,19 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { -- struct reg regs; -+ struct reg regs, oldregs; + struct reg regs; ++ register_t old_rflags; -+ memset( ®s, 0, sizeof(struct reg)); -+ memset( &oldregs, 0, sizeof(struct reg)); - if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, 0) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); -+ ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &oldregs, 0); ++ old_rflags = regs.r_rflags; amd64_collect_native_gregset (regcache, ®s, regnum); -+ if( (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE) ++ /* This is a workaround about the PSL_USERCHANGE posix limitation. */ ++ if ((regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE) + { -+ //printf("regs.r_rflags = 0x%8.8lX\n", regs.r_rflags ); -+ //printf("oldregs.r_rflags = 0x%8.8lX\n", oldregs.r_rflags ); -+ regs.r_rflags ^= (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE; -+ //printf(" allowed regs.r_rflags = 0x%8.8X\n", regs.r_rflags ); ++ regs.r_rflags ^= (regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE; + } - if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, 0) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); + Modified: head/devel/gdb/files/patch-gdb-configure ============================================================================== --- head/devel/gdb/files/patch-gdb-configure Fri Jul 28 21:14:57 2017 (r446851) +++ head/devel/gdb/files/patch-gdb-configure Fri Jul 28 21:20:47 2017 (r446852) @@ -1,24 +1,20 @@ ---- gdb/configure.orig 2016-10-07 19:09:21.000000000 +0200 -+++ gdb/configure 2016-10-18 11:11:30.452542000 +0200 -@@ -14256,9 +14256,8 @@ +diff --git gdb/configure gdb/configure +index 9f05b4bb7e..e14886b67d 100755 +--- gdb/configure ++++ gdb/configure +@@ -15103,12 +15103,10 @@ if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" + fi - # These options work in either C or C++ modes. +-# The options we'll try to enable. ++# These options work in either C or C++ modes. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ --Wno-switch -Wno-char-subscripts \ ---Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable" +--Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ +--Wno-sign-compare -Wno-narrowing" +-Wno-unused -Wno-switch -Wno-char-subscripts \ -+-Wempty-body" ++-Wempty-body -Wno-sign-compare -Wno-narrowing" - # Now add in C and C++ specific options, depending on mode. - if test "$enable_build_with_cxx" = "yes"; then -@@ -14266,8 +14265,7 @@ - -Wno-narrowing" - else - build_warnings="$build_warnings -Wpointer-sign -Wmissing-prototypes \ ---Wdeclaration-after-statement -Wmissing-parameter-type \ ---Wold-style-declaration -Wold-style-definition" -+-Wdeclaration-after-statement -Wold-style-definition" *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***