diff --git a/devel/gdb/Makefile b/devel/gdb/Makefile --- a/devel/gdb/Makefile +++ b/devel/gdb/Makefile @@ -1,8 +1,7 @@ # Created by: Steven Kreuzer PORTNAME= gdb -DISTVERSION= 10.2 -PORTREVISION= 1 +DISTVERSION= 11.1 CATEGORIES= devel MASTER_SITES= GNU @@ -15,7 +14,8 @@ # untested on sparc64, might work NOT_FOR_ARCHS= sparc64 -LIB_DEPENDS= libmpfr.so:math/mpfr +LIB_DEPENDS= libgmp.so:math/gmp \ + libmpfr.so:math/mpfr TEST_DEPENDS= runtest:misc/dejagnu USES= compiler:c++11-lang cpe gmake libtool makeinfo pkgconfig tar:xz @@ -34,8 +34,7 @@ --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 +CFLAGS+= -DRL_NO_COMPAT EXCLUDE= dejagnu expect sim texinfo intl EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /} LIB_DEPENDS+= libexpat.so:textproc/expat2 @@ -97,7 +96,7 @@ GH_ACCOUNT= bsdjhb:libcxx GH_PROJECT= libcxx-gdbpy:libcxx -GH_TAGNAME= 229610a:libcxx +GH_TAGNAME= 03d0d9b:libcxx # Workaround USE_GITHUB preventing the default DISTFILES DISTFILES= ${DISTNAME}${EXTRACT_SUFX} diff --git a/devel/gdb/distinfo b/devel/gdb/distinfo --- a/devel/gdb/distinfo +++ b/devel/gdb/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1619544553 -SHA256 (gdb-10.2.tar.xz) = aaa1223d534c9b700a8bec952d9748ee1977513f178727e1bee520ee000b4f29 -SIZE (gdb-10.2.tar.xz) = 21518900 -SHA256 (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = d4235f98b71c4d5e3f01744de279e64808229dd46c0f00cac6a12fdeb3a998a1 -SIZE (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = 5299 +TIMESTAMP = 1631890421 +SHA256 (gdb-11.1.tar.xz) = cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94 +SIZE (gdb-11.1.tar.xz) = 22040696 +SHA256 (bsdjhb-libcxx-gdbpy-03d0d9b_GH0.tar.gz) = 2c1563f361d4fb59b54b1b39bff5cdf609d73962758eb05a8cdfe2c22551b259 +SIZE (bsdjhb-libcxx-gdbpy-03d0d9b_GH0.tar.gz) = 6052 diff --git a/devel/gdb/files/extrapatch-kgdb b/devel/gdb/files/extrapatch-kgdb --- a/devel/gdb/files/extrapatch-kgdb +++ b/devel/gdb/files/extrapatch-kgdb @@ -1,8 +1,8 @@ diff --git gdb/Makefile.in gdb/Makefile.in -index 4808357e65..982af063b8 100644 +index b8729ed7b2e..660476c11e2 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -665,6 +665,7 @@ TARGET_OBS = @TARGET_OBS@ +@@ -677,6 +677,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 = \ @@ -10,31 +10,31 @@ aarch64-fbsd-tdep.o \ aarch64-linux-tdep.o \ aarch64-newlib-tdep.o \ -@@ -679,6 +680,7 @@ ALL_64_TARGET_OBS = \ +@@ -691,6 +692,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-netbsd-tdep.o \ amd64-obsd-tdep.o \ -@@ -693,6 +695,7 @@ ALL_64_TARGET_OBS = \ +@@ -707,6 +709,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-netbsd-tdep.o \ sparc64-obsd-tdep.o \ -@@ -713,6 +716,7 @@ ALL_TARGET_OBS = \ +@@ -727,6 +730,7 @@ ALL_TARGET_OBS = \ arch/ppc-linux-common.o \ arch/riscv.o \ arm-bsd-tdep.o \ + arm-fbsd-kern.o \ arm-fbsd-tdep.o \ arm-linux-tdep.o \ - arm-nbsd-tdep.o \ -@@ -731,6 +735,8 @@ ALL_TARGET_OBS = \ + arm-netbsd-tdep.o \ +@@ -745,6 +749,8 @@ ALL_TARGET_OBS = \ csky-linux-tdep.o \ csky-tdep.o \ dicos-tdep.o \ @@ -43,7 +43,7 @@ fbsd-tdep.o \ frv-linux-tdep.o \ frv-tdep.o \ -@@ -746,6 +752,7 @@ ALL_TARGET_OBS = \ +@@ -760,6 +766,7 @@ ALL_TARGET_OBS = \ i386-darwin-tdep.o \ i386-dicos-tdep.o \ i386-fbsd-tdep.o \ @@ -51,40 +51,40 @@ i386-gnu-tdep.o \ i386-go32-tdep.o \ i386-linux-tdep.o \ -@@ -770,6 +777,7 @@ ALL_TARGET_OBS = \ +@@ -784,6 +791,7 @@ ALL_TARGET_OBS = \ mep-tdep.o \ microblaze-linux-tdep.o \ microblaze-tdep.o \ + mipsfbsd-kern.o \ mips-fbsd-tdep.o \ mips-linux-tdep.o \ - mips-nbsd-tdep.o \ -@@ -788,6 +796,7 @@ ALL_TARGET_OBS = \ + mips-netbsd-tdep.o \ +@@ -802,6 +810,7 @@ ALL_TARGET_OBS = \ or1k-linux-tdep.o \ or1k-tdep.o \ ppc-fbsd-tdep.o \ + ppcfbsd-kern.o \ ppc-linux-tdep.o \ - ppc-nbsd-tdep.o \ + ppc-netbsd-tdep.o \ ppc-obsd-tdep.o \ -@@ -795,6 +804,7 @@ ALL_TARGET_OBS = \ +@@ -809,6 +818,7 @@ ALL_TARGET_OBS = \ ppc-sysv-tdep.o \ ppc64-tdep.o \ ravenscar-thread.o \ + riscv-fbsd-kern.o \ riscv-fbsd-tdep.o \ riscv-linux-tdep.o \ - riscv-ravenscar-thread.o \ -@@ -1606,7 +1616,7 @@ generated_files = \ + riscv-none-tdep.o \ +@@ -1633,7 +1643,7 @@ generated_files = \ # Flags needed to compile Python code PYTHON_CFLAGS = @PYTHON_CFLAGS@ -all: gdb$(EXEEXT) $(CONFIG_ALL) gdb-gdb.py gdb-gdb.gdb +all: gdb$(EXEEXT) kgdb$(EXEEXT) $(CONFIG_ALL) gdb-gdb.py gdb-gdb.gdb - @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do + @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=$(SUBDIRS)" subdir_do # Rule for compiling .c files in the top-level gdb directory. -@@ -1871,6 +1881,12 @@ ifneq ($(CODESIGN_CERT),) +@@ -1887,6 +1897,12 @@ ifneq ($(CODESIGN_CERT),) $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT) endif @@ -94,10 +94,10 @@ + -o kgdb$(EXEEXT) kgdb-main.o $(LIBGDB_OBS) \ + $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) + - # Convenience rule to handle recursion. - .PHONY: all-data-directory - all-data-directory: data-directory/Makefile -@@ -1911,6 +1927,7 @@ clean mostlyclean: $(CONFIG_CLEAN) + # This is useful when debugging GDB, because some Unix's don't let you run GDB + # on itself without copying the executable. So "make gdb1" will make + # gdb and put a copy in gdb1, and you can run it with "gdb gdb1". +@@ -1922,6 +1938,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) @@ -105,7 +105,7 @@ rm -f test-cp-name-parser$(EXEEXT) rm -f xml-builtin.c stamp-xml rm -f $(DEPDIR)/* -@@ -2106,6 +2123,7 @@ MAKEOVERRIDES = +@@ -2114,6 +2131,7 @@ MAKEOVERRIDES = ALLDEPFILES = \ aarch32-tdep.c \ @@ -113,7 +113,7 @@ aarch64-fbsd-nat.c \ aarch64-fbsd-tdep.c \ aarch64-linux-nat.c \ -@@ -2125,6 +2143,7 @@ ALLDEPFILES = \ +@@ -2133,6 +2151,7 @@ ALLDEPFILES = \ amd64-bsd-nat.c \ amd64-darwin-tdep.c \ amd64-dicos-tdep.c \ @@ -121,7 +121,7 @@ amd64-fbsd-nat.c \ amd64-fbsd-tdep.c \ amd64-linux-nat.c \ -@@ -2139,6 +2158,7 @@ ALLDEPFILES = \ +@@ -2149,6 +2168,7 @@ ALLDEPFILES = \ arc-tdep.c \ arm.c \ arm-bsd-tdep.c \ @@ -129,7 +129,7 @@ arm-fbsd-nat.c \ arm-fbsd-tdep.c \ arm-get-next-pcs.c \ -@@ -2160,6 +2180,9 @@ ALLDEPFILES = \ +@@ -2170,6 +2190,9 @@ ALLDEPFILES = \ csky-tdep.c \ darwin-nat.c \ dicos-tdep.c \ @@ -139,7 +139,7 @@ fbsd-nat.c \ fbsd-tdep.c \ fork-child.c \ -@@ -2180,6 +2203,7 @@ ALLDEPFILES = \ +@@ -2190,6 +2213,7 @@ ALLDEPFILES = \ i386-darwin-nat.c \ i386-darwin-tdep.c \ i386-dicos-tdep.c \ @@ -147,7 +147,7 @@ i386-fbsd-nat.c \ i386-fbsd-tdep.c \ i386-gnu-nat.c \ -@@ -2217,6 +2241,7 @@ ALLDEPFILES = \ +@@ -2227,6 +2251,7 @@ ALLDEPFILES = \ microblaze-linux-tdep.c \ microblaze-tdep.c \ mingw-hdep.c \ @@ -155,7 +155,7 @@ mips-fbsd-nat.c \ mips-fbsd-tdep.c \ mips-linux-nat.c \ -@@ -2236,6 +2261,7 @@ ALLDEPFILES = \ +@@ -2246,6 +2271,7 @@ ALLDEPFILES = \ obsd-nat.c \ obsd-tdep.c \ posix-hdep.c \ @@ -163,7 +163,7 @@ ppc-fbsd-nat.c \ ppc-fbsd-tdep.c \ ppc-linux-nat.c \ -@@ -2250,6 +2276,7 @@ ALLDEPFILES = \ +@@ -2260,6 +2286,7 @@ ALLDEPFILES = \ procfs.c \ ravenscar-thread.c \ remote-sim.c \ @@ -171,7 +171,7 @@ riscv-fbsd-nat.c \ riscv-fbsd-tdep.c \ riscv-linux-nat.c \ -@@ -2286,6 +2313,7 @@ ALLDEPFILES = \ +@@ -2297,6 +2324,7 @@ ALLDEPFILES = \ sparc-sol2-nat.c \ sparc-sol2-tdep.c \ sparc-tdep.c \ @@ -179,7 +179,7 @@ sparc64-fbsd-nat.c \ sparc64-fbsd-tdep.c \ sparc64-linux-nat.c \ -@@ -2544,7 +2572,7 @@ endif +@@ -2555,7 +2583,7 @@ endif # A list of all the objects we might care about in this build, for # dependency tracking. @@ -189,12 +189,12 @@ # All the .deps files to include. diff --git gdb/config.in gdb/config.in -index 9755458f9c..4a1f7a924c 100644 +index 2c30504905b..edf57bf48a9 100644 --- gdb/config.in +++ gdb/config.in -@@ -217,6 +217,12 @@ - /* Define to 1 if your system has the kinfo_getvmmap function. */ - #undef HAVE_KINFO_GETVMMAP +@@ -213,6 +213,12 @@ + /* Define to 1 if you have the `kinfo_getfile' function. */ + #undef HAVE_KINFO_GETFILE +/* Define to 1 if your system has the kvm_kerndisp function. */ +#undef HAVE_KVM_DISP @@ -206,11 +206,11 @@ #undef HAVE_LANGINFO_CODESET diff --git gdb/configure gdb/configure -index e7811e807a..0a6a1304ce 100755 +index 5d89635c043..2ab494696c6 100755 --- gdb/configure +++ gdb/configure -@@ -8331,6 +8331,126 @@ $as_echo "#define HAVE_KINFO_GETVMMAP 1" >>confdefs.h - fi +@@ -8226,6 +8226,126 @@ fi + +# kgdb needs kvm_open2 for cross-debugging @@ -337,12 +337,12 @@ if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" diff --git gdb/configure.ac gdb/configure.ac -index 620ae23e34..9186b54386 100644 +index b8c79bcac9a..9b73cb6018d 100644 --- gdb/configure.ac +++ gdb/configure.ac -@@ -480,6 +480,16 @@ 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. ])]) +@@ -504,6 +504,16 @@ AC_SEARCH_LIBS(socketpair, socket) + # Link in zlib if we can. This allows us to read compressed debug sections. + AM_ZLIB +# kgdb needs kvm_open2 for cross-debugging +AC_SEARCH_LIBS(kvm_open2, kvm, @@ -358,7 +358,7 @@ # GDB may fork/exec the iconv program to get the list of supported character diff --git gdb/configure.nat gdb/configure.nat -index 3e94a064ae..6b73f8dd90 100644 +index e34cccffd98..d15a915d2c9 100644 --- gdb/configure.nat +++ gdb/configure.nat @@ -63,7 +63,8 @@ case ${gdb_host} in @@ -372,19 +372,19 @@ LOADLIBES='-lkvm' ;; diff --git gdb/configure.tgt gdb/configure.tgt -index a3e11c4b9b..1d8b6f10a0 100644 +index 97a5a57c378..19ef5c7a48f 100644 --- gdb/configure.tgt +++ gdb/configure.tgt -@@ -101,7 +101,7 @@ esac +@@ -103,7 +103,7 @@ esac case "${targ}" in *-*-freebsd* | *-*-kfreebsd*-gnu) - os_obs="fbsd-tdep.o solib-svr4.o";; + os_obs="fbsd-tdep.o solib-svr4.o fbsd-kld.o fbsd-kthr.o";; *-*-netbsd* | *-*-knetbsd*-gnu) - os_obs="nbsd-tdep.o solib-svr4.o";; + os_obs="netbsd-tdep.o solib-svr4.o";; *-*-openbsd*) -@@ -118,7 +118,7 @@ aarch64*-*-elf | aarch64*-*-rtems*) +@@ -120,7 +120,7 @@ aarch64*-*-elf | aarch64*-*-rtems*) aarch64*-*-freebsd*) # Target: FreeBSD/aarch64 @@ -393,7 +393,7 @@ ;; aarch64*-*-linux*) -@@ -173,7 +173,7 @@ arm*-*-linux*) +@@ -176,7 +176,7 @@ arm*-*-linux*) ;; arm*-*-freebsd*) # Target: FreeBSD/arm @@ -402,7 +402,7 @@ ;; arm*-*-netbsd* | arm*-*-knetbsd*-gnu) # Target: NetBSD/arm -@@ -277,7 +277,11 @@ i[34567]86-*-dicos*) +@@ -276,7 +276,11 @@ i[34567]86-*-dicos*) ;; i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) # Target: FreeBSD/i386 @@ -415,7 +415,7 @@ ;; i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) # Target: NetBSD/i386 -@@ -423,7 +427,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) +@@ -422,7 +426,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) ;; mips*-*-freebsd*) # Target: MIPS running FreeBSD @@ -424,7 +424,7 @@ gdb_sim=../sim/mips/libsim.a ;; mips64*-*-openbsd*) -@@ -489,7 +493,7 @@ or1k-*-* | or1knd-*-*) +@@ -488,7 +492,7 @@ or1k-*-* | or1knd-*-*) powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ @@ -433,7 +433,7 @@ ravenscar-thread.o ppc-ravenscar-thread.o" ;; -@@ -541,7 +545,7 @@ s390*-*-linux*) +@@ -540,7 +544,7 @@ s390*-*-linux*) riscv*-*-freebsd*) # Target: FreeBSD/riscv @@ -462,10 +462,10 @@ x86_64-*-mingw* | x86_64-*-cygwin*) # Target: MingW/amd64 diff --git gdb/osabi.c gdb/osabi.c -index 627b9d9815..45a2fc6ade 100644 +index aabf895c045..5b5ef033f90 100644 --- gdb/osabi.c +++ gdb/osabi.c -@@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] = +@@ -67,6 +67,7 @@ static const struct osabi_names gdb_osabi_names[] = { "Solaris", NULL }, { "GNU/Linux", "linux(-gnu[^-]*)?" }, { "FreeBSD", NULL }, @@ -474,7 +474,7 @@ { "OpenBSD", NULL }, { "WindowsCE", NULL }, diff --git gdb/osabi.h gdb/osabi.h -index a7e6a10d01..07cef9bee3 100644 +index 1ecbed4611d..9f701076063 100644 --- gdb/osabi.h +++ gdb/osabi.h @@ -31,6 +31,7 @@ enum gdb_osabi @@ -486,10 +486,10 @@ GDB_OSABI_OPENBSD, GDB_OSABI_WINCE, diff --git gdb/regcache.c gdb/regcache.c -index 91d3202b94..903b3d0d86 100644 +index fde0c612975..818c62bbf31 100644 --- gdb/regcache.c +++ gdb/regcache.c -@@ -1108,6 +1108,22 @@ reg_buffer::raw_supply_zeroed (int regnum) +@@ -1112,6 +1112,22 @@ reg_buffer::raw_supply_zeroed (int regnum) m_register_status[regnum] = REG_VALID; } @@ -513,7 +513,7 @@ void diff --git gdb/regcache.h gdb/regcache.h -index 9390f5708e..62920a5b7f 100644 +index ee254f381f4..63158dcdaf1 100644 --- gdb/regcache.h +++ gdb/regcache.h @@ -228,6 +228,8 @@ class reg_buffer : public reg_buffer_common @@ -525,16 +525,3 @@ void invalidate (int regnum); virtual ~reg_buffer () = default; -diff --git gnulib/configure gnulib/configure -index ef7f6d5e80..536a0b4812 100644 ---- gnulib/configure -+++ gnulib/configure -@@ -20747,6 +20747,8 @@ else - *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess all is fine on musl systems. - *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; -+ # Guess all is fine on FreeBSD. -+ freebsd*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. diff --git a/devel/gdb/files/kgdb/aarch64-fbsd-kern.c b/devel/gdb/files/kgdb/aarch64-fbsd-kern.c --- a/devel/gdb/files/kgdb/aarch64-fbsd-kern.c +++ b/devel/gdb/files/kgdb/aarch64-fbsd-kern.c @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ /* Target-dependent code for FreeBSD/aarch64 kernels. */ @@ -156,6 +155,7 @@ } static const struct frame_unwind aarch64_fbsd_trapframe_unwind = { + "aarch64 FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, aarch64_fbsd_trapframe_this_id, @@ -187,11 +187,9 @@ set_gdbarch_significant_addr_bit (gdbarch, 64); } -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_aarch64_kgdb_tdep; - +void _initialize_aarch64_kgdb_tdep (); void -_initialize_aarch64_kgdb_tdep (void) +_initialize_aarch64_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_aarch64, bfd_target_elf_flavour, diff --git a/devel/gdb/files/kgdb/amd64fbsd-kern.c b/devel/gdb/files/kgdb/amd64fbsd-kern.c --- a/devel/gdb/files/kgdb/amd64fbsd-kern.c +++ b/devel/gdb/files/kgdb/amd64fbsd-kern.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "defs.h" #include "frame-unwind.h" #include "gdbcore.h" @@ -217,6 +215,7 @@ } static const struct frame_unwind amd64fbsd_trapframe_unwind = { + "amd64 FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, amd64fbsd_trapframe_this_id, @@ -240,9 +239,9 @@ fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb); } -void _initialize_amd64_kgdb_tdep(void); +void _initialize_amd64_kgdb_tdep (); void -_initialize_amd64_kgdb_tdep(void) +_initialize_amd64_kgdb_tdep () { gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_FREEBSD_KERNEL, amd64fbsd_kernel_init_abi); diff --git a/devel/gdb/files/kgdb/arm-fbsd-kern.c b/devel/gdb/files/kgdb/arm-fbsd-kern.c --- a/devel/gdb/files/kgdb/arm-fbsd-kern.c +++ b/devel/gdb/files/kgdb/arm-fbsd-kern.c @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ /* Target-dependent code for FreeBSD/arm kernels. */ @@ -170,6 +169,7 @@ } static const struct frame_unwind arm_fbsd_trapframe_unwind = { + "arm FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, arm_fbsd_trapframe_this_id, @@ -199,11 +199,9 @@ set_gdbarch_software_single_step (gdbarch, arm_software_single_step); } -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_arm_kgdb_tdep; - +void _initialize_arm_kgdb_tdep (); void -_initialize_arm_kgdb_tdep (void) +_initialize_arm_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_arm, bfd_target_elf_flavour, diff --git a/devel/gdb/files/kgdb/fbsd-kld.c b/devel/gdb/files/kgdb/fbsd-kld.c --- a/devel/gdb/files/kgdb/fbsd-kld.c +++ b/devel/gdb/files/kgdb/fbsd-kld.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "defs.h" #include "command.h" #include "completer.h" @@ -127,7 +125,8 @@ static gdb::optional find_kld_path (const char *filename) { - if (exec_bfd) + bfd *exec_bfd = current_program_space->exec_bfd (); + if (exec_bfd != nullptr) { std::string kernel_dir = ldirname (bfd_get_filename (exec_bfd)); if (!kernel_dir.empty ()) @@ -171,7 +170,7 @@ gdb_byte ptr_buf[8]; int arch_size; - arch_size = bfd_get_arch_size (exec_bfd); + arch_size = bfd_get_arch_size (current_program_space->exec_bfd ()); if (arch_size == -1) return (0); ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr; @@ -239,14 +238,8 @@ static void load_kld (const char *path, CORE_ADDR base_addr, int from_tty) { - struct target_section *sections = NULL, *sections_end = NULL, *s; - gdb_bfd_ref_ptr bfd; - CORE_ADDR curr_addr; - symfile_add_flags add_flags; - int i; - /* Open the kld. */ - bfd = gdb_bfd_openr(path, gnutarget); + gdb_bfd_ref_ptr bfd = gdb_bfd_openr(path, gnutarget); if (bfd == NULL) error("\"%s\": can't open: %s", path, bfd_errmsg(bfd_get_error())); @@ -259,27 +252,24 @@ error("\"%s\": can't find text section", path); /* 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); - curr_addr = base_addr; - for (s = sections; s < sections_end; s++) - adjust_section_address(s, &curr_addr); + target_section_table sections = build_section_table (bfd.get()); + CORE_ADDR curr_addr = base_addr; + for (target_section &s : sections) + adjust_section_address(&s, &curr_addr); /* Build a section addr info to pass to symbol_file_add(). */ section_addr_info sap - = build_section_addr_info_from_section_table (sections, - sections_end); - xfree(sections); + = build_section_addr_info_from_section_table (sections); printf_unfiltered("add symbol table from file \"%s\" at\n", path); - for (i = 0; i < sap.size(); i++) - printf_unfiltered("\t%s_addr = %s\n", sap[i].name.c_str(), - paddress(target_gdbarch(), sap[i].addr)); + for (const other_sections &s : sap) + printf_unfiltered("\t%s_addr = %s\n", s.name.c_str(), + paddress(target_gdbarch(), s.addr)); if (from_tty && (!query("%s", ""))) error("Not confirmed."); - add_flags = 0; + symfile_add_flags add_flags = 0; if (from_tty) add_flags |= SYMFILE_VERBOSE; symbol_file_add_from_bfd(bfd.get(), path, add_flags, &sap, @@ -291,7 +281,7 @@ { CORE_ADDR base_addr; - if (!exec_bfd) + if (current_program_space->exec_bfd () == nullptr) error("No kernel symbol file"); /* Try to open the raw path to handle absolute paths first. */ @@ -326,7 +316,7 @@ lm_info_kld *li = (lm_info_kld *) so->lm_info; static CORE_ADDR curr_addr; - if (sec == so->sections) + if (sec == &so->sections->front()) curr_addr = li->base_address; adjust_section_address(sec, &curr_addr); @@ -365,7 +355,7 @@ struct kld_info *info; info = get_kld_info(); - + /* * Compute offsets of relevant members in struct linker_file * and the addresses of global variables. Newer kernels @@ -533,9 +523,9 @@ return (fd); } -void _initialize_kld_target(void); +void _initialize_kld_target (); void -_initialize_kld_target(void) +_initialize_kld_target () { struct cmd_list_element *c; diff --git a/devel/gdb/files/kgdb/fbsd-kthr.c b/devel/gdb/files/kgdb/fbsd-kthr.c --- a/devel/gdb/files/kgdb/fbsd-kthr.c +++ b/devel/gdb/files/kgdb/fbsd-kthr.c @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #include diff --git a/devel/gdb/files/kgdb/fbsd-kvm.c b/devel/gdb/files/kgdb/fbsd-kvm.c --- a/devel/gdb/files/kgdb/fbsd-kvm.c +++ b/devel/gdb/files/kgdb/fbsd-kvm.c @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #include "defs.h" @@ -179,9 +178,8 @@ case ELFOSABI_NONE: { enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; - bfd_map_over_sections (abfd, - generic_elf_osabi_sniff_abi_tag_sections, - &osabi); + for (asection *sect : gdb_bfd_sections (abfd)) + generic_elf_osabi_sniff_abi_tag_sections (abfd, sect, &osabi); /* * aarch64 and RISC-V kernels don't have the right @@ -330,11 +328,13 @@ } /* Don't free the filename now and close any previous vmcore. */ - unpush_target(&fbsd_kvm_ops); + current_inferior ()->unpush_target (&fbsd_kvm_ops); #ifdef HAVE_KVM_DISP /* Relocate kernel objfile if needed. */ - if (symfile_objfile && + struct objfile *symfile_objfile = + current_program_space->symfile_object_file; + if (symfile_objfile != nullptr && (bfd_get_file_flags(symfile_objfile->obfd) & (EXEC_P | DYNAMIC)) != 0) { CORE_ADDR displacement = kvm_kerndisp(nkvm); @@ -387,7 +387,7 @@ kvm = nkvm; vmcore = filename; - push_target (&fbsd_kvm_ops); + current_inferior()->push_target (&fbsd_kvm_ops); kgdb_dmesg(); @@ -419,6 +419,9 @@ { if (kvm != NULL) { + switch_to_no_thread (); + exit_inferior_silent (current_inferior ()); + clear_solib(); if (kvm_close(kvm) != 0) warning("cannot close \"%s\": %s", vmcore, @@ -428,8 +431,6 @@ vmcore = NULL; } - switch_to_no_thread (); - exit_inferior_silent (current_inferior ()); } #if 0 @@ -637,9 +638,9 @@ kgdb_switch_to_thread(arg, addr); } -void _initialize_kgdb_target(void); +void _initialize_kgdb_target (); void -_initialize_kgdb_target(void) +_initialize_kgdb_target () { add_target(fbsd_kvm_target_info, fbsd_kvm_target_open, diff --git a/devel/gdb/files/kgdb/i386fbsd-kern.c b/devel/gdb/files/kgdb/i386fbsd-kern.c --- a/devel/gdb/files/kgdb/i386fbsd-kern.c +++ b/devel/gdb/files/kgdb/i386fbsd-kern.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "defs.h" #include "frame-unwind.h" #include "gdbcore.h" @@ -282,6 +280,7 @@ } static const struct frame_unwind i386fbsd_dblfault_unwind = { + "i386 FreeBSD double fault", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, i386fbsd_dblfault_this_id, @@ -441,6 +440,7 @@ } static const struct frame_unwind i386fbsd_trapframe_unwind = { + "i386 FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, i386fbsd_trapframe_this_id, @@ -466,9 +466,9 @@ fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb); } -void _initialize_i386_kgdb_tdep(void); +void _initialize_i386_kgdb_tdep (); void -_initialize_i386_kgdb_tdep(void) +_initialize_i386_kgdb_tdep () { /* This is used for both i386 and amd64, but amd64 always includes this target, so just include it here. */ diff --git a/devel/gdb/files/kgdb/kgdb-main.c b/devel/gdb/files/kgdb/kgdb-main.c --- a/devel/gdb/files/kgdb/kgdb-main.c +++ b/devel/gdb/files/kgdb/kgdb-main.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include #include #include @@ -49,6 +47,7 @@ #include #include #include +#include "serial.h" #include #include #include diff --git a/devel/gdb/files/kgdb/kgdb.h b/devel/gdb/files/kgdb/kgdb.h --- a/devel/gdb/files/kgdb/kgdb.h +++ b/devel/gdb/files/kgdb/kgdb.h @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #ifndef _KGDB_H_ diff --git a/devel/gdb/files/kgdb/mipsfbsd-kern.c b/devel/gdb/files/kgdb/mipsfbsd-kern.c --- a/devel/gdb/files/kgdb/mipsfbsd-kern.c +++ b/devel/gdb/files/kgdb/mipsfbsd-kern.c @@ -23,8 +23,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: src/gnu/usr.bin/gdb/kgdb/trgt_alpha.c,v 1.2.2.1 2005/09/15 05:32:10 marcel */ #include "defs.h" @@ -238,6 +236,7 @@ } static const struct frame_unwind mipsfbsd_trapframe_unwind = { + "mips FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, mipsfbsd_trapframe_this_id, @@ -283,9 +282,9 @@ fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb); } -void _initialize_mips_kgdb_tdep(void); +void _initialize_mips_kgdb_tdep (); void -_initialize_mips_kgdb_tdep (void) +_initialize_mips_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_mips, bfd_target_elf_flavour, diff --git a/devel/gdb/files/kgdb/ppcfbsd-kern.c b/devel/gdb/files/kgdb/ppcfbsd-kern.c --- a/devel/gdb/files/kgdb/ppcfbsd-kern.c +++ b/devel/gdb/files/kgdb/ppcfbsd-kern.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "defs.h" #include "frame-unwind.h" #include "gdbcore.h" @@ -201,6 +199,7 @@ static const struct frame_unwind ppcfbsd_trapframe_unwind = { + "ppc FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, ppcfbsd_trapframe_this_id, @@ -239,9 +238,9 @@ } } -void _initialize_ppc_kgdb_tdep(void); +void _initialize_ppc_kgdb_tdep (); void -_initialize_ppc_kgdb_tdep(void) +_initialize_ppc_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_powerpc, bfd_target_elf_flavour, diff --git a/devel/gdb/files/kgdb/riscv-fbsd-kern.c b/devel/gdb/files/kgdb/riscv-fbsd-kern.c --- a/devel/gdb/files/kgdb/riscv-fbsd-kern.c +++ b/devel/gdb/files/kgdb/riscv-fbsd-kern.c @@ -22,7 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ /* Target-dependent code for FreeBSD/riscv64 kernels. */ @@ -170,6 +169,7 @@ } static const struct frame_unwind riscv_fbsd_trapframe_unwind = { + "riscv FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, riscv_fbsd_trapframe_this_id, @@ -193,11 +193,9 @@ fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb); } -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_riscv_kgdb_tdep; - +void _initialize_riscv_kgdb_tdep (); void -_initialize_riscv_kgdb_tdep (void) +_initialize_riscv_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_riscv, bfd_target_elf_flavour, diff --git a/devel/gdb/files/kgdb/sparc64fbsd-kern.c b/devel/gdb/files/kgdb/sparc64fbsd-kern.c --- a/devel/gdb/files/kgdb/sparc64fbsd-kern.c +++ b/devel/gdb/files/kgdb/sparc64fbsd-kern.c @@ -24,8 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "defs.h" #include "gdbarch.h" #include "gdbcore.h" @@ -99,18 +97,19 @@ cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); - cache->saved_regs[SPARC_SP_REGNUM].addr = trapframe_addr + OFF_TF_SP; + cache->saved_regs[SPARC_SP_REGNUM].set_addr (trapframe_addr + OFF_TF_SP); #ifdef notyet - cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr + OFF_TF_TSTATE; + cache->saved_regs[SPARC64_STATE_REGNUM].set_addr (trapframe_addr + + OFF_TF_TSTATE); #endif - cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + OFF_TF_TPC; - cache->saved_regs[SPARC64_NPC_REGNUM].addr = trapframe_addr + OFF_TF_TNPC; + cache->saved_regs[SPARC64_PC_REGNUM].set_addr (trapframe_addr + OFF_TF_TPC); + cache->saved_regs[SPARC64_NPC_REGNUM].set_addr (trapframe_addr + OFF_TF_TNPC); for (regnum = SPARC_O0_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) - cache->saved_regs[regnum].addr = - trapframe_addr + OFF_TF_OUT + (regnum - SPARC_O0_REGNUM) * 8; + cache->saved_regs[regnum].set_addr (trapframe_addr + OFF_TF_OUT + + (regnum - SPARC_O0_REGNUM) * 8); for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) - cache->saved_regs[regnum].addr = - sp + BIAS + (regnum - SPARC_L0_REGNUM) * 8; + cache->saved_regs[regnum].set_addr (sp + BIAS + + (regnum - SPARC_L0_REGNUM) * 8); return cache; } @@ -156,6 +155,7 @@ static const struct frame_unwind sparc64fbsd_trapframe_unwind = { + "sparc64 FreeBSD kernel trap", SIGTRAMP_FRAME, default_frame_unwind_stop_reason, sparc64fbsd_trapframe_this_id, @@ -302,9 +302,9 @@ #endif } -void _initialize_sparc64_kgdb_tdep(void); +void _initialize_sparc64_kgdb_tdep (); void -_initialize_sparc64_kgdb_tdep(void) +_initialize_sparc64_kgdb_tdep () { gdbarch_register_osabi_sniffer(bfd_arch_sparc, bfd_target_elf_flavour, diff --git a/devel/gdb/files/patch-gdb_amd64-bsd-nat.c b/devel/gdb/files/patch-gdb_amd64-bsd-nat.c --- a/devel/gdb/files/patch-gdb_amd64-bsd-nat.c +++ b/devel/gdb/files/patch-gdb_amd64-bsd-nat.c @@ -1,5 +1,5 @@ ---- gdb/amd64-bsd-nat.c.orig 2017-09-14 09:28:17 UTC -+++ gdb/amd64-bsd-nat.c +--- gdb/amd64-bsd-nat.c.orig 2021-07-03 10:41:09.000000000 -0700 ++++ gdb/amd64-bsd-nat.c 2021-09-16 13:59:34.240785000 -0700 @@ -28,6 +28,7 @@ #include #include @@ -8,23 +8,23 @@ #include "amd64-tdep.h" #include "amd64-nat.h" -@@ -95,12 +96,19 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, +@@ -142,12 +143,19 @@ amd64bsd_store_inferior_registers (struct regcache *re if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { struct reg regs; + register_t old_rflags; if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) - perror_with_name (_("Couldn't get registers")); + perror_with_name (_("Couldn't get registers")); + old_rflags = regs.r_rflags; amd64_collect_native_gregset (regcache, ®s, regnum); + /* This is a workaround about the PSL_USERCHANGE posix limitation. */ + if ((regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE) -+ { -+ regs.r_rflags ^= (regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE; -+ } ++ { ++ regs.r_rflags ^= (regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE; ++ } if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) - perror_with_name (_("Couldn't write registers")); + perror_with_name (_("Couldn't write registers")); diff --git a/devel/gdb/files/patch-gdb_configure b/devel/gdb/files/patch-gdb_configure deleted file mode 100644 --- a/devel/gdb/files/patch-gdb_configure +++ /dev/null @@ -1,16 +0,0 @@ ---- gdb/configure.orig 2019-05-11 11:19:02.000000000 -0700 -+++ gdb/configure 2019-05-24 16:21:50.559870000 -0700 -@@ -15511,10 +15511,10 @@ fi - - # The options we'll try to enable. - build_warnings="-Wall -Wpointer-arith \ ---Wno-unused -Wunused-value -Wunused-variable -Wunused-function \ -+-Wno-unused \ - -Wno-switch -Wno-char-subscripts \ ---Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ ---Wno-sign-compare -Wno-error=maybe-uninitialized \ -+-Wempty-body \ -+-Wno-sign-compare \ - -Wno-mismatched-tags \ - -Wno-error=deprecated-register \ - -Wsuggest-override \ diff --git a/devel/gdb/files/patch-gdb_python_python-config.py b/devel/gdb/files/patch-gdb_python_python-config.py --- a/devel/gdb/files/patch-gdb_python_python-config.py +++ b/devel/gdb/files/patch-gdb_python_python-config.py @@ -1,11 +1,11 @@ ---- gdb/python/python-config.py 2017-09-14 09:28:17 UTC -+++ gdb/python/python-config.py -@@ -59,6 +59,8 @@ for opt in opt_flags: +--- gdb/python/python-config.py.orig 2021-07-03 10:41:10.000000000 -0700 ++++ gdb/python/python-config.py 2021-09-16 14:01:52.807472000 -0700 +@@ -65,6 +65,8 @@ for opt in opt_flags: - elif opt in ('--libs', '--ldflags'): - libs = ['-lpython' + pyver + abiflags] + elif opt in ("--libs", "--ldflags"): + libs = ["-lpython" + pyver + abiflags] + if getvar('LDFLAGS') is not None: + libs.extend(getvar('LDFLAGS').split()) - if getvar('LIBS') is not None: - libs.extend(getvar('LIBS').split()) - if getvar('SYSLIBS') is not None: + if getvar("LIBS") is not None: + libs.extend(getvar("LIBS").split()) + if getvar("SYSLIBS") is not None: