aboutsummaryrefslogtreecommitdiff
path: root/devel/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'devel/gdb')
-rw-r--r--devel/gdb/Makefile115
-rw-r--r--devel/gdb/distinfo6
-rw-r--r--devel/gdb/files/extrapatch-kgdb280
-rw-r--r--devel/gdb/files/kgdb/aarch64-fbsd-kern.c140
-rw-r--r--devel/gdb/files/kgdb/amd64fbsd-kern.c10
-rw-r--r--devel/gdb/files/kgdb/arm-fbsd-kern.c20
-rw-r--r--devel/gdb/files/kgdb/fbsd-kld.c32
-rw-r--r--devel/gdb/files/kgdb/fbsd-kthr.c26
-rw-r--r--devel/gdb/files/kgdb/fbsd-kvm.c166
-rw-r--r--devel/gdb/files/kgdb/i386fbsd-kern.c51
-rw-r--r--devel/gdb/files/kgdb/kgdb-main.c52
-rw-r--r--devel/gdb/files/kgdb/mipsfbsd-kern.c24
-rw-r--r--devel/gdb/files/kgdb/ppcfbsd-kern.c22
-rw-r--r--devel/gdb/files/kgdb/riscv-fbsd-kern.c18
-rw-r--r--devel/gdb/files/kgdb/sparc64fbsd-kern.c10
-rw-r--r--devel/gdb/files/patch-fixes10
-rw-r--r--devel/gdb/files/patch-gdb_amd64-bsd-nat.c30
-rw-r--r--devel/gdb/files/patch-gdb_fbsd-nat.c17
-rw-r--r--devel/gdb/files/patch-gdb_i386-fbsd-nat.c22
-rw-r--r--devel/gdb/files/patch-gnulib_import_stddef.in.h10
-rw-r--r--devel/gdb/files/patch-include_libiberty.h11
-rw-r--r--devel/gdb/files/patch-libiberty_configure12
-rw-r--r--devel/gdb/pkg-descr2
-rw-r--r--devel/gdb/pkg-plist60
24 files changed, 581 insertions, 565 deletions
diff --git a/devel/gdb/Makefile b/devel/gdb/Makefile
index 66abc21d8070..029f36d86653 100644
--- a/devel/gdb/Makefile
+++ b/devel/gdb/Makefile
@@ -1,22 +1,20 @@
-# Created by: Steven Kreuzer <skreuzer@FreeBSD.org>
-
PORTNAME= gdb
-DISTVERSION= 11.1
-PORTREVISION= 1
+DISTVERSION= 14.1
+PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= GNU
MAINTAINER= pizzamig@FreeBSD.org
COMMENT= GNU Project Debugger
+WWW= https://www.gnu.org/software/gdb/
LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/COPYING3
-# untested on sparc64, might work
-NOT_FOR_ARCHS= sparc64
-
-LIB_DEPENDS= libgmp.so:math/gmp \
- libmpfr.so:math/mpfr
+LIB_DEPENDS= libexpat.so:textproc/expat2 \
+ libgmp.so:math/gmp \
+ libmpfr.so:math/mpfr \
+ libzstd.so:archivers/zstd
TEST_DEPENDS= runtest:misc/dejagnu
USES= compiler:c++11-lang cpe gmake libtool makeinfo pkgconfig tar:xz
@@ -27,25 +25,26 @@ TEST_TARGET= check
CPE_VENDOR= gnu
GNU_CONFIGURE= yes
CONFIGURE_ENV= CONFIGURED_M4=m4 CONFIGURED_BISON=byacc
-CONFIGURE_ARGS= --program-suffix=${DISTVERSION:S/.//g} \
+CONFIGURE_ARGS= --program-suffix=${VER} \
+ --disable-sim \
--enable-targets=all --enable-64-bit-bfd \
--with-separate-debug-dir=/usr/lib/debug \
+ --with-additional-debug-dirs=${LOCALBASE}/lib/debug \
${ICONV_CONFIGURE_ARG} \
- --with-expat=yes --with-libexpat-prefix=${LOCALBASE} \
- --without-libunwind-ia64 --with-system-zlib
+ --without-libunwind-ia64
CONFIGURE_OUTSOURCE= yes
CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in sometimes
CFLAGS+= -DRL_NO_COMPAT
-EXCLUDE= dejagnu expect sim texinfo intl
+EXCLUDE= dejagnu expect texinfo intl
EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /}
-LIB_DEPENDS+= libexpat.so:textproc/expat2
VER= ${DISTVERSION:S/.//g}
PLIST_SUB= VER=${VER}
-OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB NLS PYTHON SOURCE_HIGHLIGHT TUI
-
-OPTIONS_DEFAULT= GDB_LINK KGDB NLS PYTHON SOURCE_HIGHLIGHT TUI
+OPTIONS_DEFINE= DEBUGINFOD GDB_LINK GUILE KGDB NLS PYTHON \
+ SOURCE_HIGHLIGHT TUI XXHASH
+OPTIONS_DEFAULT= GDB_LINK KGDB NLS PYTHON SOURCE_HIGHLIGHT \
+ TUI XXHASH
OPTIONS_DEFAULT+= PORT_READLINE PORT_ICONV SYSTEM_ZLIB
OPTIONS_SINGLE= READLINE ICONV ZLIB
@@ -53,36 +52,42 @@ OPTIONS_SINGLE_READLINE= BUNDLED_READLINE PORT_READLINE
OPTIONS_SINGLE_ICONV= PORT_ICONV SYSTEM_ICONV
OPTIONS_SINGLE_ZLIB= BUNDLED_ZLIB SYSTEM_ZLIB
+DEBUGINFOD_DESC= Build gdb with debuginfod server support
GDB_LINK_DESC= Create ${PREFIX}/bin/gdb symlink
-KGDB_DESC= Kernel Debugging Support
+KGDB_DESC= Kernel debugging support
BUNDLED_READLINE_DESC= from gdb distfile
BUNDLED_ZLIB_DESC= from gdb distfile
PORT_READLINE_DESC= from devel/readline port
PORT_ICONV_DESC= use libiconv, with wider charset support
-SOURCE_HIGHLIGHT_DESC= Source Code Styling
+SOURCE_HIGHLIGHT_DESC= Syntax highlighting support
SYSTEM_ICONV_DESC= use libc iconv, with no wchar support
SYSTEM_ZLIB_DESC= use system zlib
-TUI_DESC= Text User Interface enabled
+TUI_DESC= Text User Interface support
+XXHASH_DESC= Use xxHash for hashing (faster)
OPTIONS_SUB= yes
BUNDLED_READLINE_CONFIGURE_OFF= --with-system-readline
-DEBUG_CFLAGS= -g
-DEBUG_VARS= STRIP=
-GUILE_CONFIGURE_WITH= guile
-GUILE_LIB_DEPENDS= libguile-2.2.so:lang/guile2
+DEBUGINFOD_CONFIGURE_WITH= debuginfod
+DEBUGINFOD_LIB_DEPENDS= libdebuginfod.so:devel/elfutils
+GUILE_CONFIGURE_WITH= guile=guile-${GUILE_VER}
+GUILE_USES= guile:2.2,3.0
NLS_USES= gettext-runtime
PORT_READLINE_USES= readline
PORT_ICONV_USES= iconv:wchar_t
PYTHON_CONFIGURE_ON= --with-python=${PYTHON_CMD}
PYTHON_CONFIGURE_OFF= --without-python
-PYTHON_USES= python:3.6+
-SOURCE_HIGHLIGHT_WITH= source-highlight
+PYTHON_USES= python
+SOURCE_HIGHLIGHT_CONFIGURE_ENABLE= source-highlight
SOURCE_HIGHLIGHT_LIB_DEPENDS= \
libsource-highlight.so:textproc/source-highlight
SYSTEM_ICONV_USES= iconv
-SYSTEM_ZLIB_WITH= system-zlib
+SYSTEM_ZLIB_CONFIGURE_WITH= system-zlib
TUI_CONFIGURE_ENABLE= tui
+XXHASH_CONFIGURE_OFF= --with-xxhash=no
+XXHASH_LIB_DEPENDS= libxxhash.so:devel/xxhash
+
+ALL_TARGET= all-gdb
.include <bsd.port.pre.mk>
@@ -92,7 +97,8 @@ PKGNAMESUFFIX= ${PYTHON_PKGNAMESUFFIX}
.endif
.endif
-.if ${PORT_OPTIONS:MPYTHON} && exists(/usr/lib/libc++.so.1)
+.if ${PORT_OPTIONS:MPYTHON} && \
+ (exists(/usr/lib/libc++.so.1) || exists(/lib/libc++.so.1))
USE_GITHUB= nodefault
GH_ACCOUNT= bsdjhb:libcxx
@@ -102,6 +108,13 @@ GH_TAGNAME= 03d0d9b:libcxx
# Workaround USE_GITHUB preventing the default DISTFILES
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
+.if exists(/usr/lib/libc++.so.1)
+LIBCXX_DIR= /usr/lib
+.else
+LIBCXX_DIR= /lib
+.endif
+
+PLIST_SUB+= LIBCXX_DIR="${LIBCXX_DIR}"
PLIST_SUB+= LIBCXX=""
.else
PLIST_SUB+= LIBCXX="@comment "
@@ -115,10 +128,6 @@ EXCLUDE+= zlib
CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL}
.endif
-.if ${CHOSEN_COMPILER_TYPE} == clang
-CFLAGS+= -Wno-extended-offsetof
-.endif
-
post-patch:
@${REINPLACE_CMD} -e 's|$$| [GDB v${DISTVERSION} for FreeBSD]|' \
${WRKSRC}/gdb/version.in
@@ -131,50 +140,56 @@ do-install:
${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 ${INSTALL_WRKSRC}/gdb/data-directory ; \
- ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls )
+ ${STAGEDIR}${PREFIX}/share/man/man1/gdb${VER}.1
+ (cd ${INSTALL_WRKSRC}/gdb/data-directory ; ${SETENVI} ${WRK_ENV} \
+ ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls )
do-install-KGDB-on:
${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/gdb/kgdb \
${STAGEDIR}${PREFIX}/bin/kgdb${VER}
${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \
- ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1
+ ${STAGEDIR}${PREFIX}/share/man/man1/kgdb${VER}.1
do-install-TUI-on:
${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER}
do-install-GDB_LINK-on:
${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb
- ${LN} -sf gdb${VER}.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/gdb.1
+ ${LN} -sf gdb${VER}.1 ${STAGEDIR}${PREFIX}/share/man/man1/gdb.1
.if ${PORT_OPTIONS:MKGDB}
${LN} -sf kgdb${VER} ${STAGEDIR}${PREFIX}/bin/kgdb
- ${LN} -sf kgdb${VER}.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb.1
+ ${LN} -sf kgdb${VER}.1 ${STAGEDIR}${PREFIX}/share/man/man1/kgdb.1
.endif
do-install-PYTHON-on:
- (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 ${INSTALL_WRKSRC}/gdb ; ${SETENVI} ${WRK_ENV} \
+ ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python )
+ (cd ${INSTALL_WRKSRC}/gdb/data-directory ; ${SETENVI} ${WRK_ENV} \
+ ${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
@(cd ${STAGEDIR}${PREFIX}/share/gdb/python/${f} ; ${CHMOD} 644 *.py* )
. endfor
-.if exists(/usr/lib/libc++.so.1)
- @(cd ${WRKSRC_libcxx} ; \
- ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} install )
- @(cd ${STAGEDIR}${PREFIX}/share/gdb/auto-load/usr/lib && \
+.if exists(/usr/lib/libc++.so.1) || exists(/lib/libc++.so.1)
+ @(cd ${WRKSRC_libcxx} ; ${SETENVI} ${WRK_ENV} \
+ ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} \
+ LIBCXX_DIR="${LIBCXX_DIR}" install )
+ @(cd ${STAGEDIR}${PREFIX}/share/gdb/auto-load/${LIBCXX_DIR} && \
${PYTHON_CMD} -m compileall .)
@(cd ${STAGEDIR}${PREFIX}/share/libcxx-gdbpy/libcxx && \
${PYTHON_CMD} -m compileall .)
.endif
+# DO NOT try and add rules here to strip .go files, no matter how loudly
+# testport / stage-qa shouts at you about it, because .go files (which are
+# compiled bytecode) are not intended to be stripped and doing so causes
+# breakage at run time.
+
do-install-GUILE-on:
- (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 )
+ (cd ${INSTALL_WRKSRC}/gdb ; ${SETENVI} ${WRK_ENV} \
+ ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile )
+ (cd ${INSTALL_WRKSRC}/gdb/data-directory ; ${SETENVI} ${WRK_ENV} \
+ ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile )
.include <bsd.port.post.mk>
diff --git a/devel/gdb/distinfo b/devel/gdb/distinfo
index 81d7eafa5e93..95fd730add1c 100644
--- a/devel/gdb/distinfo
+++ b/devel/gdb/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1631890421
-SHA256 (gdb-11.1.tar.xz) = cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94
-SIZE (gdb-11.1.tar.xz) = 22040696
+TIMESTAMP = 1702493574
+SHA256 (gdb-14.1.tar.xz) = d66df51276143451fcbff464cc8723d68f1e9df45a6a2d5635a54e71643edb80
+SIZE (gdb-14.1.tar.xz) = 24108624
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
index f94bb3a49699..f9098cc19de8 100644
--- 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 b8729ed7b2e..660476c11e2 100644
+index 9c0a0bff2cd..0e62786dd31 100644
--- gdb/Makefile.in
+++ gdb/Makefile.in
-@@ -677,6 +677,7 @@ TARGET_OBS = @TARGET_OBS@
+@@ -704,6 +704,7 @@ ALL_AMD_DBGAPI_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,7 +10,7 @@ index b8729ed7b2e..660476c11e2 100644
aarch64-fbsd-tdep.o \
aarch64-linux-tdep.o \
aarch64-newlib-tdep.o \
-@@ -691,6 +692,7 @@ ALL_64_TARGET_OBS = \
+@@ -718,6 +719,7 @@ ALL_64_TARGET_OBS = \
amd64-darwin-tdep.o \
amd64-dicos-tdep.o \
amd64-fbsd-tdep.o \
@@ -18,23 +18,37 @@ index b8729ed7b2e..660476c11e2 100644
amd64-linux-tdep.o \
amd64-netbsd-tdep.o \
amd64-obsd-tdep.o \
-@@ -707,6 +709,7 @@ ALL_64_TARGET_OBS = \
+@@ -737,18 +739,21 @@ ALL_64_TARGET_OBS = \
ia64-vms-tdep.o \
+ loongarch-linux-tdep.o \
+ loongarch-tdep.o \
++ mipsfbsd-kern.o \
+ mips-fbsd-tdep.o \
+ mips-linux-tdep.o \
+ mips-netbsd-tdep.o \
+ mips-sde-tdep.o \
+ mips-tdep.o \
mips64-obsd-tdep.o \
++ riscv-fbsd-kern.o \
+ riscv-fbsd-tdep.o \
+ riscv-linux-tdep.o \
+ riscv-none-tdep.o \
+ riscv-ravenscar-thread.o \
+ riscv-tdep.o \
sparc64-fbsd-tdep.o \
+ sparc64fbsd-kern.o \
sparc64-linux-tdep.o \
sparc64-netbsd-tdep.o \
sparc64-obsd-tdep.o \
-@@ -727,6 +730,7 @@ ALL_TARGET_OBS = \
+@@ -773,6 +778,7 @@ ALL_TARGET_OBS = \
+ arch/loongarch.o \
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-netbsd-tdep.o \
-@@ -745,6 +749,8 @@ ALL_TARGET_OBS = \
+@@ -790,6 +796,8 @@ ALL_TARGET_OBS = \
csky-linux-tdep.o \
csky-tdep.o \
dicos-tdep.o \
@@ -43,77 +57,31 @@ index b8729ed7b2e..660476c11e2 100644
fbsd-tdep.o \
frv-linux-tdep.o \
frv-tdep.o \
-@@ -760,6 +766,7 @@ ALL_TARGET_OBS = \
+@@ -804,6 +812,7 @@ ALL_TARGET_OBS = \
+ i386-bsd-tdep.o \
i386-darwin-tdep.o \
i386-dicos-tdep.o \
- i386-fbsd-tdep.o \
+ i386fbsd-kern.o \
+ i386-fbsd-tdep.o \
i386-gnu-tdep.o \
i386-go32-tdep.o \
- i386-linux-tdep.o \
-@@ -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-netbsd-tdep.o \
-@@ -802,6 +810,7 @@ ALL_TARGET_OBS = \
+@@ -841,6 +850,7 @@ ALL_TARGET_OBS = \
+ obsd-tdep.o \
or1k-linux-tdep.o \
or1k-tdep.o \
- ppc-fbsd-tdep.o \
+ ppcfbsd-kern.o \
+ ppc-fbsd-tdep.o \
ppc-linux-tdep.o \
ppc-netbsd-tdep.o \
- ppc-obsd-tdep.o \
-@@ -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-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=$(SUBDIRS)" subdir_do
-
- # Rule for compiling .c files in the top-level gdb directory.
-@@ -1887,6 +1897,12 @@ ifneq ($(CODESIGN_CERT),)
- $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
- endif
-
-+kgdb$(EXEEXT): kgdb-main.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
-+ $(SILENCE) rm -f kgdb$(EXEEXT)
-+ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
-+ -o kgdb$(EXEEXT) kgdb-main.o $(LIBGDB_OBS) \
-+ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
-+
- # 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)
-+ rm -f kgdb$(EXEEXT)
- rm -f test-cp-name-parser$(EXEEXT)
- rm -f xml-builtin.c stamp-xml
- rm -f $(DEPDIR)/*
-@@ -2114,6 +2131,7 @@ MAKEOVERRIDES =
-
- ALLDEPFILES = \
+@@ -1642,6 +1652,7 @@ ALLDEPFILES = \
+ arch/riscv.c \
+ arch/tic6x.c \
aarch32-tdep.c \
+ aarch64-fbsd-kern.c \
aarch64-fbsd-nat.c \
aarch64-fbsd-tdep.c \
aarch64-linux-nat.c \
-@@ -2133,6 +2151,7 @@ ALLDEPFILES = \
+@@ -1662,6 +1673,7 @@ ALLDEPFILES = \
amd64-bsd-nat.c \
amd64-darwin-tdep.c \
amd64-dicos-tdep.c \
@@ -121,15 +89,15 @@ index b8729ed7b2e..660476c11e2 100644
amd64-fbsd-nat.c \
amd64-fbsd-tdep.c \
amd64-linux-nat.c \
-@@ -2149,6 +2168,7 @@ ALLDEPFILES = \
+@@ -1678,6 +1690,7 @@ ALLDEPFILES = \
+ arc-linux-nat.c \
arc-tdep.c \
- arm.c \
arm-bsd-tdep.c \
+ arm-fbsd-kern.c \
arm-fbsd-nat.c \
arm-fbsd-tdep.c \
- arm-get-next-pcs.c \
-@@ -2170,6 +2190,9 @@ ALLDEPFILES = \
+ arm-linux-nat.c \
+@@ -1697,6 +1710,9 @@ ALLDEPFILES = \
csky-tdep.c \
darwin-nat.c \
dicos-tdep.c \
@@ -139,7 +107,7 @@ index b8729ed7b2e..660476c11e2 100644
fbsd-nat.c \
fbsd-tdep.c \
fork-child.c \
-@@ -2190,6 +2213,7 @@ ALLDEPFILES = \
+@@ -1717,6 +1733,7 @@ ALLDEPFILES = \
i386-darwin-nat.c \
i386-darwin-tdep.c \
i386-dicos-tdep.c \
@@ -147,7 +115,7 @@ index b8729ed7b2e..660476c11e2 100644
i386-fbsd-nat.c \
i386-fbsd-tdep.c \
i386-gnu-nat.c \
-@@ -2227,6 +2251,7 @@ ALLDEPFILES = \
+@@ -1757,6 +1774,7 @@ ALLDEPFILES = \
microblaze-linux-tdep.c \
microblaze-tdep.c \
mingw-hdep.c \
@@ -155,15 +123,15 @@ index b8729ed7b2e..660476c11e2 100644
mips-fbsd-nat.c \
mips-fbsd-tdep.c \
mips-linux-nat.c \
-@@ -2246,6 +2271,7 @@ ALLDEPFILES = \
- obsd-nat.c \
+@@ -1777,6 +1795,7 @@ ALLDEPFILES = \
obsd-tdep.c \
+ or1k-linux-nat.c \
posix-hdep.c \
+ ppcfbsd-kern.c \
ppc-fbsd-nat.c \
ppc-fbsd-tdep.c \
ppc-linux-nat.c \
-@@ -2260,6 +2286,7 @@ ALLDEPFILES = \
+@@ -1791,6 +1810,7 @@ ALLDEPFILES = \
procfs.c \
ravenscar-thread.c \
remote-sim.c \
@@ -171,7 +139,7 @@ index b8729ed7b2e..660476c11e2 100644
riscv-fbsd-nat.c \
riscv-fbsd-tdep.c \
riscv-linux-nat.c \
-@@ -2297,6 +2324,7 @@ ALLDEPFILES = \
+@@ -1828,6 +1848,7 @@ ALLDEPFILES = \
sparc-sol2-nat.c \
sparc-sol2-tdep.c \
sparc-tdep.c \
@@ -179,7 +147,37 @@ index b8729ed7b2e..660476c11e2 100644
sparc64-fbsd-nat.c \
sparc64-fbsd-tdep.c \
sparc64-linux-nat.c \
-@@ -2555,7 +2583,7 @@ endif
+@@ -1915,7 +1936,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=$(SUBDIRS)" subdir_do
+
+ # Rule for compiling .c files in the top-level gdb directory.
+@@ -2178,6 +2199,12 @@ ifneq ($(CODESIGN_CERT),)
+ $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
+ endif
+
++kgdb$(EXEEXT): kgdb-main.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
++ $(SILENCE) rm -f kgdb$(EXEEXT)
++ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
++ -o kgdb$(EXEEXT) kgdb-main.o $(LIBGDB_OBS) \
++ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
++
+ # 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".
+@@ -2213,6 +2240,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)
++ rm -f kgdb$(EXEEXT)
+ rm -f test-cp-name-parser$(EXEEXT)
+ rm -f xml-builtin.c stamp-xml
+ rm -f $(DEPDIR)/*
+@@ -2636,7 +2664,7 @@ endif
# A list of all the objects we might care about in this build, for
# dependency tracking.
@@ -189,10 +187,10 @@ index b8729ed7b2e..660476c11e2 100644
# All the .deps files to include.
diff --git gdb/config.in gdb/config.in
-index 2c30504905b..edf57bf48a9 100644
+index e17245156d8..e1be9fdbc40 100644
--- gdb/config.in
+++ gdb/config.in
-@@ -213,6 +213,12 @@
+@@ -229,6 +229,12 @@
/* Define to 1 if you have the `kinfo_getfile' function. */
#undef HAVE_KINFO_GETFILE
@@ -206,10 +204,10 @@ index 2c30504905b..edf57bf48a9 100644
#undef HAVE_LANGINFO_CODESET
diff --git gdb/configure gdb/configure
-index 5d89635c043..2ab494696c6 100755
+index 5361bf42952..9f4c500fd22 100755
--- gdb/configure
+++ gdb/configure
-@@ -8226,6 +8226,126 @@ fi
+@@ -19724,6 +19724,126 @@ fi
@@ -334,15 +332,15 @@ index 5d89635c043..2ab494696c6 100755
+
+
- if test "X$prefix" = "XNONE"; then
- acl_final_prefix="$ac_default_prefix"
+ # Check whether --with-zstd was given.
+ if test "${with_zstd+set}" = set; then :
diff --git gdb/configure.ac gdb/configure.ac
-index b8c79bcac9a..9b73cb6018d 100644
+index 3912b77b27f..bc960202b22 100644
--- gdb/configure.ac
+++ gdb/configure.ac
-@@ -504,6 +504,16 @@ AC_SEARCH_LIBS(socketpair, socket)
- # Link in zlib if we can. This allows us to read compressed debug sections.
+@@ -516,6 +516,16 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
AM_ZLIB
+ AC_ZSTD
+# kgdb needs kvm_open2 for cross-debugging
+AC_SEARCH_LIBS(kvm_open2, kvm,
@@ -358,7 +356,7 @@ index b8c79bcac9a..9b73cb6018d 100644
# GDB may fork/exec the iconv program to get the list of supported character
diff --git gdb/configure.nat gdb/configure.nat
-index e34cccffd98..d15a915d2c9 100644
+index 1dc4206b69c..cb46e1505c7 100644
--- gdb/configure.nat
+++ gdb/configure.nat
@@ -63,7 +63,8 @@ case ${gdb_host} in
@@ -372,10 +370,10 @@ index e34cccffd98..d15a915d2c9 100644
LOADLIBES='-lkvm'
;;
diff --git gdb/configure.tgt gdb/configure.tgt
-index 97a5a57c378..19ef5c7a48f 100644
+index 47a674201f9..4b4b6893edf 100644
--- gdb/configure.tgt
+++ gdb/configure.tgt
-@@ -103,7 +103,7 @@ esac
+@@ -122,7 +122,7 @@ esac
case "${targ}" in
*-*-freebsd* | *-*-kfreebsd*-gnu)
@@ -384,7 +382,7 @@ index 97a5a57c378..19ef5c7a48f 100644
*-*-netbsd* | *-*-knetbsd*-gnu)
os_obs="netbsd-tdep.o solib-svr4.o";;
*-*-openbsd*)
-@@ -120,7 +120,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
+@@ -139,7 +139,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
aarch64*-*-freebsd*)
# Target: FreeBSD/aarch64
@@ -393,7 +391,7 @@ index 97a5a57c378..19ef5c7a48f 100644
;;
aarch64*-*-linux*)
-@@ -176,7 +176,7 @@ arm*-*-linux*)
+@@ -202,7 +202,7 @@ arm*-*-linux*)
;;
arm*-*-freebsd*)
# Target: FreeBSD/arm
@@ -402,7 +400,7 @@ index 97a5a57c378..19ef5c7a48f 100644
;;
arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
# Target: NetBSD/arm
-@@ -276,7 +276,11 @@ i[34567]86-*-dicos*)
+@@ -294,7 +294,11 @@ i[34567]86-*-dicos*)
;;
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
# Target: FreeBSD/i386
@@ -415,16 +413,16 @@ index 97a5a57c378..19ef5c7a48f 100644
;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
# Target: NetBSD/i386
-@@ -422,7 +426,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+@@ -434,7 +438,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
;;
mips*-*-freebsd*)
# Target: MIPS running FreeBSD
- gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o"
+ gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o mipsfbsd-kern.o"
- gdb_sim=../sim/mips/libsim.a
;;
mips64*-*-openbsd*)
-@@ -488,7 +492,7 @@ or1k-*-* | or1knd-*-*)
+ # Target: OpenBSD/mips64
+@@ -492,7 +496,7 @@ or1k-*-* | or1knd-*-*)
powerpc*-*-freebsd*)
# Target: FreeBSD/powerpc
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
@@ -433,7 +431,7 @@ index 97a5a57c378..19ef5c7a48f 100644
ravenscar-thread.o ppc-ravenscar-thread.o"
;;
-@@ -540,7 +544,7 @@ s390*-*-linux*)
+@@ -541,7 +545,7 @@ s390*-*-linux*)
riscv*-*-freebsd*)
# Target: FreeBSD/riscv
@@ -442,7 +440,7 @@ index 97a5a57c378..19ef5c7a48f 100644
;;
riscv*-*-linux*)
-@@ -616,6 +620,7 @@ sparc64-*-linux*)
+@@ -606,6 +610,7 @@ sparc64-*-linux*)
sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
# Target: FreeBSD/sparc64
gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \
@@ -450,7 +448,7 @@ index 97a5a57c378..19ef5c7a48f 100644
ravenscar-thread.o sparc-ravenscar-thread.o"
;;
sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
-@@ -735,8 +740,8 @@ x86_64-*-linux*)
+@@ -722,8 +727,8 @@ x86_64-*-linux*)
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
# Target: FreeBSD/amd64
@@ -462,7 +460,7 @@ index 97a5a57c378..19ef5c7a48f 100644
x86_64-*-mingw* | x86_64-*-cygwin*)
# Target: MingW/amd64
diff --git gdb/osabi.c gdb/osabi.c
-index aabf895c045..5b5ef033f90 100644
+index ad3dad5b849..29e8578d031 100644
--- gdb/osabi.c
+++ gdb/osabi.c
@@ -67,6 +67,7 @@ static const struct osabi_names gdb_osabi_names[] =
@@ -474,7 +472,7 @@ index aabf895c045..5b5ef033f90 100644
{ "OpenBSD", NULL },
{ "WindowsCE", NULL },
diff --git gdb/osabi.h gdb/osabi.h
-index 1ecbed4611d..9f701076063 100644
+index 35f14ec433c..1276d34d5f7 100644
--- gdb/osabi.h
+++ gdb/osabi.h
@@ -31,6 +31,7 @@ enum gdb_osabi
@@ -486,10 +484,10 @@ index 1ecbed4611d..9f701076063 100644
GDB_OSABI_OPENBSD,
GDB_OSABI_WINCE,
diff --git gdb/regcache.c gdb/regcache.c
-index fde0c612975..818c62bbf31 100644
+index 91b20b7a2a2..0cfa1bae3d9 100644
--- gdb/regcache.c
+++ gdb/regcache.c
-@@ -1112,6 +1112,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
+@@ -1123,6 +1123,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
m_register_status[regnum] = REG_VALID;
}
@@ -512,11 +510,91 @@ index fde0c612975..818c62bbf31 100644
/* See gdbsupport/common-regcache.h. */
void
+@@ -1289,6 +1305,53 @@ regcache::collect_regset (const struct regset *regset, int regbase,
+ size);
+ }
+
++/* See regcache.h */
++
++int
++regcache_map_entry_size (const struct regcache_map_entry *map, gdbarch *gdbarch)
++{
++ int size = 0, count;
++
++ for (; (count = map->count) != 0; map++)
++ {
++ int regno = map->regno;
++ int slot_size = map->size;
++
++ if (slot_size == 0 && regno != REGCACHE_MAP_SKIP)
++ slot_size = register_size (gdbarch, regno);
++
++ size += count * slot_size;
++ }
++ return size;
++}
++
++/* See regcache.h */
++
++int
++regcache_map_offset (const struct regcache_map_entry *map, int regnum,
++ gdbarch *gdbarch)
++{
++ int offs = 0, count;
++
++ for (; (count = map->count) != 0; map++)
++ {
++ int regno = map->regno;
++ int slot_size = map->size;
++
++ if (slot_size == 0 && regno != REGCACHE_MAP_SKIP)
++ slot_size = register_size (gdbarch, regno);
++
++ if (regno != REGCACHE_MAP_SKIP && regnum >= regno
++ && regnum < regno + count)
++ return offs + (regno - regnum) * slot_size;
++
++ offs += count * slot_size;
++ }
++ return -1;
++}
++
++/* See regcache.h */
++
+ bool
+ regcache_map_supplies (const struct regcache_map_entry *map, int regnum,
+ struct gdbarch *gdbarch, size_t size)
diff --git gdb/regcache.h gdb/regcache.h
-index ee254f381f4..63158dcdaf1 100644
+index 57ddac465f0..b9f62994901 100644
--- gdb/regcache.h
+++ gdb/regcache.h
-@@ -228,6 +228,8 @@ class reg_buffer : public reg_buffer_common
+@@ -133,6 +133,11 @@ regcache_map_entry_size (const struct regcache_map_entry *map)
+ return size;
+ }
+
++/* Same as above, but accepts a gdbarch to handle entries with a
++ variable register size. */
++extern int regcache_map_entry_size (const struct regcache_map_entry *map,
++ gdbarch *gdbarch);
++
+ /* Transfer a set of registers (as described by REGSET) between
+ REGCACHE and BUF. If REGNUM == -1, transfer all registers
+ belonging to the regset, otherwise just the register numbered
+@@ -151,6 +156,13 @@ extern void regcache_collect_regset (const struct regset *regset,
+ int regnum, void *buf, size_t size);
+
+
++/* Return the offset of REGNUM in a block of registers described by an
++ array of regcache_map_entries. If the register is not found,
++ returns -1. */
++
++extern int regcache_map_offset (const struct regcache_map_entry *map,
++ int regnum, gdbarch *gdbarch);
++
+ /* Return true if a set of registers contains the value of the
+ register numbered REGNUM. The size of the set of registers is
+ given in SIZE, and the layout of the set of registers is described
+@@ -238,6 +250,8 @@ class reg_buffer : public reg_buffer_common
only LEN, without editing the rest of the register. */
void raw_supply_part (int regnum, int offset, int len, const gdb_byte *in);
diff --git a/devel/gdb/files/kgdb/aarch64-fbsd-kern.c b/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
index 8c0bac8dfc0b..2eb89a7da5e1 100644
--- a/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
+++ b/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
@@ -41,11 +41,36 @@
#include "kgdb.h"
+struct aarch64_fbsd_kern_info
+{
+ LONGEST osreldate = 0;
+};
+
+/* Per-program-space data key. */
+static const registry<program_space>::key<aarch64_fbsd_kern_info>
+aarch64_fbsd_kern_pspace_data;
+
+/* Get the current aarch64_fbsd_kern data. If none is found yet, add it
+ now. This function always returns a valid object. */
+
+static struct aarch64_fbsd_kern_info *
+get_aarch64_fbsd_kern_info (void)
+{
+ struct aarch64_fbsd_kern_info *info;
+
+ info = aarch64_fbsd_kern_pspace_data.get (current_program_space);
+ if (info != nullptr)
+ return info;
+
+ info = aarch64_fbsd_kern_pspace_data.emplace (current_program_space);
+ info->osreldate = parse_and_eval_long ("osreldate");
+ return info;
+}
+
static const struct regcache_map_entry aarch64_fbsd_pcbmap[] =
{
- { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 11, AARCH64_X0_REGNUM + 19, 8 }, /* x19 ... x29 */
{ 1, AARCH64_PC_REGNUM, 8 },
- { 1, REGCACHE_MAP_SKIP, 8 },
{ 1, AARCH64_SP_REGNUM, 8 },
{ 0 }
};
@@ -56,53 +81,99 @@ static const struct regset aarch64_fbsd_pcbregset =
regcache_supply_regset, regcache_collect_regset
};
+/* In kernels prior to __FreeBSD_version 1400084, struct pcb used an
+ alternate layout. */
+
+static const struct regcache_map_entry aarch64_fbsd13_pcbmap[] =
+ {
+ { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, REGCACHE_MAP_SKIP, 8 },
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 0 }
+ };
+
+static const struct regset aarch64_fbsd13_pcbregset =
+ {
+ aarch64_fbsd13_pcbmap,
+ regcache_supply_regset, regcache_collect_regset
+ };
+
static void
aarch64_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
{
+ const struct regset *pcbregset;
+ struct aarch64_fbsd_kern_info *info = get_aarch64_fbsd_kern_info();
gdb_byte buf[8 * 33];
+ if (info->osreldate >= 1400084)
+ pcbregset = &aarch64_fbsd_pcbregset;
+ else
+ pcbregset = &aarch64_fbsd13_pcbregset;
if (target_read_memory (pcb_addr, buf, sizeof buf) == 0)
- regcache_supply_regset (&aarch64_fbsd_pcbregset, regcache, -1, buf,
+ regcache_supply_regset (pcbregset, regcache, -1, buf,
sizeof (buf));
}
+static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] =
+ {
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 1, AARCH64_LR_REGNUM, 8 },
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, AARCH64_CPSR_REGNUM, 8 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* esr */
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* far */
+ { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 0 }
+ };
+
+/* In kernels prior to __FreeBSD_version 1400084, struct trapframe
+ used an alternate layout. */
+
+static const struct regcache_map_entry aarch64_fbsd13_trapframe_map[] =
+ {
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 1, AARCH64_LR_REGNUM, 8 },
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, AARCH64_CPSR_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* esr */
+ { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 0 }
+ };
+
static struct trad_frame_cache *
-aarch64_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+aarch64_fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ struct aarch64_fbsd_kern_info *info = get_aarch64_fbsd_kern_info();
struct trad_frame_cache *cache;
- CORE_ADDR func, pc, sp;
+ CORE_ADDR func, offset, pc, sp;
const char *name;
- int i;
+ int i, tf_size;
if (*this_cache != NULL)
return ((struct trad_frame_cache *)*this_cache);
+ const struct regcache_map_entry *trapframe_map;
+ if (info->osreldate >= 1400084)
+ trapframe_map = aarch64_fbsd_trapframe_map;
+ else
+ trapframe_map = aarch64_fbsd13_trapframe_map;
+
cache = trad_frame_cache_zalloc (this_frame);
*this_cache = cache;
- func = get_frame_func (this_frame);
sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
- find_pc_partial_function (func, &name, NULL, NULL);
- if (strcmp(name, "fork_trampoline") == 0 && get_frame_pc (this_frame) == func)
- {
- /* fork_exit hasn't been called (kthread has never run), so SP
- hasn't been initialized yet. The stack pointer is stored in
- the X2 in the pcb. */
- sp = get_frame_register_unsigned (this_frame, AARCH64_X0_REGNUM + 2);
- }
-
- trad_frame_set_reg_addr (cache, AARCH64_SP_REGNUM, sp);
- trad_frame_set_reg_addr (cache, AARCH64_LR_REGNUM, sp + 8);
- trad_frame_set_reg_addr (cache, AARCH64_PC_REGNUM, sp + 16);
- trad_frame_set_reg_addr (cache, AARCH64_CPSR_REGNUM, sp + 24);
- for (i = 0; i < 30; i++)
- trad_frame_set_reg_addr (cache, AARCH64_X0_REGNUM + i, sp + 32 + i * 8);
+ tf_size = regcache_map_entry_size (trapframe_map);
+ trad_frame_set_reg_regmap (cache, trapframe_map, sp, tf_size);
/* Read $PC from trap frame. */
- pc = read_memory_unsigned_integer (sp + 16, 8, byte_order);
+ func = get_frame_func (this_frame);
+ find_pc_partial_function (func, &name, NULL, NULL);
+ offset = regcache_map_offset (trapframe_map, AARCH64_PC_REGNUM, gdbarch);
+ pc = read_memory_unsigned_integer (sp + offset, 8, byte_order);
if (pc == 0 && strcmp(name, "fork_trampoline") == 0)
{
@@ -112,15 +183,15 @@ aarch64_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
else
{
/* Construct the frame ID using the function start. */
- trad_frame_set_id (cache, frame_id_build (sp + 8 * 34, func));
+ trad_frame_set_id (cache, frame_id_build (sp, func));
}
return cache;
}
static void
-aarch64_fbsd_trapframe_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+aarch64_fbsd_trapframe_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
aarch64_fbsd_trapframe_cache (this_frame, this_cache);
@@ -129,8 +200,8 @@ aarch64_fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-aarch64_fbsd_trapframe_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+aarch64_fbsd_trapframe_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
aarch64_fbsd_trapframe_cache (this_frame, this_cache);
@@ -140,7 +211,7 @@ aarch64_fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
aarch64_fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
const char *name;
@@ -169,27 +240,22 @@ static const struct frame_unwind aarch64_fbsd_trapframe_unwind = {
static void
aarch64_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
frame_unwind_prepend_unwinder (gdbarch, &aarch64_fbsd_trapframe_unwind);
- set_solib_ops (gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops (gdbarch, &kld_so_ops);
/* Enable longjmp. */
tdep->jb_pc = 13;
fbsd_vmcore_set_supply_pcb (gdbarch, aarch64_fbsd_supply_pcb);
fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb);
-
- /* The kernel is linked at a virtual address with the upper 4 bits
- set, so all 64 bits of virtual addresses need to be treated as
- significant. */
- set_gdbarch_significant_addr_bit (gdbarch, 64);
}
void _initialize_aarch64_kgdb_tdep ();
void
-_initialize_aarch64_kgdb_tdep ()
+_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
index dafd16501536..7c71bf919cdc 100644
--- a/devel/gdb/files/kgdb/amd64fbsd-kern.c
+++ b/devel/gdb/files/kgdb/amd64fbsd-kern.c
@@ -128,7 +128,7 @@ static const int amd64fbsd_trapframe_offset[] = {
#define TRAPFRAME_SIZE 192
static struct trad_frame_cache *
-amd64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+amd64fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -179,7 +179,7 @@ amd64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-amd64fbsd_trapframe_this_id (struct frame_info *this_frame,
+amd64fbsd_trapframe_this_id (frame_info_ptr this_frame,
void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
@@ -189,7 +189,7 @@ amd64fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-amd64fbsd_trapframe_prev_register (struct frame_info *this_frame,
+amd64fbsd_trapframe_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
@@ -200,7 +200,7 @@ amd64fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
amd64fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
const char *name;
@@ -233,7 +233,7 @@ amd64fbsd_kernel_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_prepend_unwinder(gdbarch, &amd64fbsd_trapframe_unwind);
- set_solib_ops(gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops(gdbarch, &kld_so_ops);
fbsd_vmcore_set_supply_pcb(gdbarch, amd64fbsd_supply_pcb);
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb);
diff --git a/devel/gdb/files/kgdb/arm-fbsd-kern.c b/devel/gdb/files/kgdb/arm-fbsd-kern.c
index 4ae80313dbc3..0caa5af96cb5 100644
--- a/devel/gdb/files/kgdb/arm-fbsd-kern.c
+++ b/devel/gdb/files/kgdb/arm-fbsd-kern.c
@@ -75,7 +75,7 @@ arm_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
#define PSR_USR32_MODE 0x00000010
static struct trad_frame_cache *
-arm_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+arm_fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -132,8 +132,8 @@ arm_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-arm_fbsd_trapframe_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+arm_fbsd_trapframe_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
arm_fbsd_trapframe_cache (this_frame, this_cache);
@@ -142,8 +142,8 @@ arm_fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-arm_fbsd_trapframe_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+arm_fbsd_trapframe_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
arm_fbsd_trapframe_cache (this_frame, this_cache);
@@ -153,8 +153,8 @@ arm_fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
arm_fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
{
const char *name;
@@ -183,11 +183,11 @@ static const struct frame_unwind arm_fbsd_trapframe_unwind = {
static void
arm_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
frame_unwind_prepend_unwinder (gdbarch, &arm_fbsd_trapframe_unwind);
- set_solib_ops (gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops (gdbarch, &kld_so_ops);
tdep->jb_pc = 24;
tdep->jb_elt_size = 4;
@@ -201,7 +201,7 @@ arm_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
void _initialize_arm_kgdb_tdep ();
void
-_initialize_arm_kgdb_tdep ()
+_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
index baaca7fda26e..55121d87d974 100644
--- a/devel/gdb/files/kgdb/fbsd-kld.c
+++ b/devel/gdb/files/kgdb/fbsd-kld.c
@@ -56,15 +56,7 @@ struct kld_info {
struct target_so_ops kld_so_ops;
/* Per-program-space data key. */
-static const struct program_space_data *kld_pspace_data;
-
-static void
-kld_pspace_data_cleanup (struct program_space *pspace, void *arg)
-{
- struct kld_info *info = (struct kld_info *)arg;
-
- xfree (info);
-}
+static const registry<program_space>::key<kld_info> kld_pspace_data;
/* Get the current kld data. If none is found yet, add it now. This
function always returns a valid object. */
@@ -74,13 +66,10 @@ get_kld_info (void)
{
struct kld_info *info;
- info = (struct kld_info *)
- program_space_data (current_program_space, kld_pspace_data);
- if (info != NULL)
- return info;
+ info = kld_pspace_data.get (current_program_space);
+ if (info == nullptr)
+ info = kld_pspace_data.emplace (current_program_space);
- info = XCNEW (struct kld_info);
- set_program_space_data (current_program_space, kld_pspace_data, info);
return info;
}
@@ -272,7 +261,7 @@ load_kld (const char *path, CORE_ADDR base_addr, int from_tty)
symfile_add_flags add_flags = 0;
if (from_tty)
add_flags |= SYMFILE_VERBOSE;
- symbol_file_add_from_bfd(bfd.get(), path, add_flags, &sap,
+ symbol_file_add_from_bfd(bfd, path, add_flags, &sap,
OBJF_USERLOADED, NULL);
}
@@ -377,17 +366,17 @@ kld_solib_create_inferior_hook (int from_tty)
"Unable to find struct linker_file symbol"));
info->off_address =
- lookup_struct_elt (SYMBOL_TYPE (linker_file_sym),
+ lookup_struct_elt (linker_file_sym->type (),
"address", 0).offset / 8;
info->off_filename =
- lookup_struct_elt (SYMBOL_TYPE (linker_file_sym),
+ lookup_struct_elt (linker_file_sym->type (),
"filename", 0).offset / 8;
info->off_pathname =
- lookup_struct_elt (SYMBOL_TYPE (linker_file_sym),
+ lookup_struct_elt (linker_file_sym->type (),
"pathname", 0).offset / 8;
struct type *link_type =
- lookup_struct_elt_type (SYMBOL_TYPE (linker_file_sym),
+ lookup_struct_elt_type (linker_file_sym->type (),
"link", 0);
if (link_type == NULL)
error (_("Unable to find link type"));
@@ -544,7 +533,4 @@ _initialize_kld_target ()
"Usage: add-kld FILE\n\
Load the symbols from the kernel loadable module FILE.");
set_cmd_completer(c, filename_completer);
-
- kld_pspace_data = register_program_space_data_with_cleanup (NULL,
- kld_pspace_data_cleanup);
}
diff --git a/devel/gdb/files/kgdb/fbsd-kthr.c b/devel/gdb/files/kgdb/fbsd-kthr.c
index b1c55a2ba6f5..603e9bd4178f 100644
--- a/devel/gdb/files/kgdb/fbsd-kthr.c
+++ b/devel/gdb/files/kgdb/fbsd-kthr.c
@@ -58,7 +58,7 @@ kgdb_lookup(const char *sym)
msym = lookup_minimal_symbol(sym, NULL, NULL);
if (msym.minsym == NULL)
return (0);
- return (BMSYMBOL_VALUE_ADDRESS(msym));
+ return (msym.value_address ());
}
/*
@@ -159,7 +159,7 @@ kgdb_thr_add_procs_hash(CORE_ADDR pidhashtbl, CORE_ADDR (*cpu_pcb_addr) (u_int))
for (i = 0; i < pidhash; i++) {
try {
paddr = read_memory_typed_address (pidhashtbl +
- i * TYPE_LENGTH(ptr_type), ptr_type);
+ i * ptr_type->length (), ptr_type);
} catch (const gdb_exception_error &e) {
continue;
}
@@ -254,16 +254,16 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int))
error (_("Unable to find struct proc symbol"));
proc_off_p_pid =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_pid",
+ lookup_struct_elt (proc_sym->type (), "p_pid",
0).offset / 8;
proc_off_p_comm =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_comm",
+ lookup_struct_elt (proc_sym->type (), "p_comm",
0).offset / 8;
proc_off_p_list =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_list",
+ lookup_struct_elt (proc_sym->type (), "p_list",
0).offset / 8;
proc_off_p_threads =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym),
+ lookup_struct_elt (proc_sym->type (),
"p_threads", 0).offset / 8;
struct symbol *thread_sym =
@@ -273,23 +273,23 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int))
error (_("Unable to find struct thread symbol"));
thread_off_td_tid =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_tid",
+ lookup_struct_elt (proc_sym->type (), "td_tid",
0).offset / 8;
thread_off_td_name =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_name",
+ lookup_struct_elt (proc_sym->type (), "td_name",
0).offset / 8;
thread_off_td_pcb =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_pcb",
+ lookup_struct_elt (proc_sym->type (), "td_pcb",
0).offset / 8;
thread_off_td_plist =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_plist",
+ lookup_struct_elt (proc_sym->type (), "td_plist",
0).offset / 8;
struct_elt td_oncpu =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "td_oncpu",
+ lookup_struct_elt (proc_sym->type (), "td_oncpu",
0);
thread_off_td_oncpu = td_oncpu.offset / 8;
- thread_oncpu_size = FIELD_BITSIZE(*td_oncpu.field) / 8;
+ thread_oncpu_size = td_oncpu.field->bitsize () / 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);
@@ -319,7 +319,7 @@ kgdb_thr_init(CORE_ADDR (*cpu_pcb_addr) (u_int))
error (_("Unable to find struct proc symbol"));
proc_off_p_hash =
- lookup_struct_elt (SYMBOL_TYPE (proc_sym), "p_hash",
+ lookup_struct_elt (proc_sym->type (), "p_hash",
0).offset / 8;
} catch (const gdb_exception_error &e2) {
proc_off_p_hash = offsetof(struct proc, p_hash);
diff --git a/devel/gdb/files/kgdb/fbsd-kvm.c b/devel/gdb/files/kgdb/fbsd-kvm.c
index 78fa9d331a5b..8c7406c0b177 100644
--- a/devel/gdb/files/kgdb/fbsd-kvm.c
+++ b/devel/gdb/files/kgdb/fbsd-kvm.c
@@ -30,7 +30,7 @@
#include "filenames.h"
#include "gdbcore.h"
#include "gdbthread.h"
-#include "gdb_obstack.h"
+#include "gdbsupport/gdb_obstack.h"
#include "inferior.h"
#include "objfiles.h"
#include "osabi.h"
@@ -39,7 +39,9 @@
#include "target.h"
#include "value.h"
#include "readline/tilde.h"
+#include "gdbsupport/buildargv.h"
#include "gdbsupport/pathstuff.h"
+#include "gdbsupport/gdb_tilde_expand.h"
#include <sys/user.h>
#include <fcntl.h>
@@ -50,26 +52,26 @@
static CORE_ADDR stoppcbs;
static LONGEST pcb_size;
-static char *vmcore;
-
-/* Per-architecture data key. */
-static struct gdbarch_data *fbsd_vmcore_data;
+static std::string vmcore;
struct fbsd_vmcore_ops
{
/* Supply registers for a pcb to a register cache. */
- void (*supply_pcb)(struct regcache *, CORE_ADDR);
+ void (*supply_pcb)(struct regcache *, CORE_ADDR) = nullptr;
/* Return address of pcb for thread running on a CPU. */
- CORE_ADDR (*cpu_pcb_addr)(u_int);
+ CORE_ADDR (*cpu_pcb_addr)(u_int) = nullptr;
};
-static void *
-fbsd_vmcore_init (struct obstack *obstack)
-{
- struct fbsd_vmcore_ops *ops;
+/* Per-architecture data key. */
+static const registry<gdbarch>::key<struct fbsd_vmcore_ops> fbsd_vmcore_data;
- ops = OBSTACK_ZALLOC (obstack, struct fbsd_vmcore_ops);
+static struct fbsd_vmcore_ops *
+get_fbsd_vmcore_ops (struct gdbarch *gdbarch)
+{
+ struct fbsd_vmcore_ops *ops = fbsd_vmcore_data.get (gdbarch);
+ if (ops == nullptr)
+ ops = fbsd_vmcore_data.emplace (gdbarch);
return ops;
}
@@ -81,8 +83,7 @@ fbsd_vmcore_set_supply_pcb (struct gdbarch *gdbarch,
void (*supply_pcb) (struct regcache *,
CORE_ADDR))
{
- struct fbsd_vmcore_ops *ops = (struct fbsd_vmcore_ops *)
- gdbarch_data (gdbarch, fbsd_vmcore_data);
+ struct fbsd_vmcore_ops *ops = get_fbsd_vmcore_ops (gdbarch);
ops->supply_pcb = supply_pcb;
}
@@ -94,8 +95,7 @@ void
fbsd_vmcore_set_cpu_pcb_addr (struct gdbarch *gdbarch,
CORE_ADDR (*cpu_pcb_addr) (u_int))
{
- struct fbsd_vmcore_ops *ops = (struct fbsd_vmcore_ops *)
- gdbarch_data (gdbarch, fbsd_vmcore_data);
+ struct fbsd_vmcore_ops *ops = get_fbsd_vmcore_ops (gdbarch);
ops->cpu_pcb_addr = cpu_pcb_addr;
}
@@ -241,7 +241,6 @@ public:
void files_info () override;
bool thread_alive (ptid_t ptid) override;
- void update_thread_list () override;
std::string pid_to_str (ptid_t) override;
const char *extra_thread_info (thread_info *) override;
@@ -264,7 +263,7 @@ kgdb_resolve_symbol(const char *name, kvaddr_t *kva)
ms = lookup_minimal_symbol (name, NULL, NULL);
if (ms.minsym == NULL)
return (1);
- *kva = BMSYMBOL_VALUE_ADDRESS (ms);
+ *kva = ms.value_address ();
return (0);
}
#endif
@@ -272,15 +271,15 @@ kgdb_resolve_symbol(const char *name, kvaddr_t *kva)
static void
fbsd_kvm_target_open (const char *args, int from_tty)
{
- struct fbsd_vmcore_ops *ops = (struct fbsd_vmcore_ops *)
- gdbarch_data (target_gdbarch(), fbsd_vmcore_data);
+ struct fbsd_vmcore_ops *ops = get_fbsd_vmcore_ops (target_gdbarch ());
char kvm_err[_POSIX2_LINE_MAX];
struct inferior *inf;
struct cleanup *old_chain;
struct kthr *kt;
kvm_t *nkvm;
const char *kernel;
- char *temp, *filename;
+ std::string filename;
+ LONGEST osreldate;
bool writeable;
if (ops == NULL || ops->supply_pcb == NULL || ops->cpu_pcb_addr == NULL)
@@ -292,7 +291,6 @@ fbsd_kvm_target_open (const char *args, int from_tty)
error ("Can't open a vmcore without a kernel");
writeable = false;
- filename = NULL;
if (args != NULL) {
gdb_argv built_argv (args);
@@ -303,29 +301,24 @@ fbsd_kvm_target_open (const char *args, int from_tty)
else
error (_("Invalid argument"));
} else {
- if (filename != NULL)
+ if (!filename.empty ())
error (_("Invalid argument"));
- filename = tilde_expand (*argv);
- if (filename[0] != '/') {
- gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (filename));
-
- xfree (filename);
- filename = temp.release ();
- }
+ filename = gdb_tilde_expand (*argv);
+ if (!IS_ABSOLUTE_PATH (filename))
+ filename = gdb_abspath (filename.c_str ());
}
}
}
#ifdef HAVE_KVM_OPEN2
- nkvm = kvm_open2(kernel, filename,
+ nkvm = kvm_open2(kernel, filename.c_str (),
writeable ? O_RDWR : O_RDONLY, kvm_err, kgdb_resolve_symbol);
#else
- nkvm = kvm_openfiles(kernel, filename, NULL,
+ nkvm = kvm_openfiles(kernel, filename.c_str (), NULL,
writeable ? O_RDWR : O_RDONLY, kvm_err);
#endif
if (nkvm == NULL) {
- xfree (filename);
error ("Failed to open vmcore: %s", kvm_err);
}
@@ -337,7 +330,7 @@ fbsd_kvm_target_open (const char *args, int from_tty)
struct objfile *symfile_objfile =
current_program_space->symfile_object_file;
if (symfile_objfile != nullptr &&
- (bfd_get_file_flags(symfile_objfile->obfd) &
+ (bfd_get_file_flags(symfile_objfile->obfd.get ()) &
(EXEC_P | DYNAMIC)) != 0) {
CORE_ADDR displacement = kvm_kerndisp(nkvm);
if (displacement != 0) {
@@ -348,6 +341,17 @@ fbsd_kvm_target_open (const char *args, int from_tty)
}
#endif
+ kvm = nkvm;
+ vmcore = std::move(filename);
+ target_unpush_up unpusher;
+ inf = current_inferior();
+ inf->push_target (&fbsd_kvm_ops);
+
+ if (inf->pid == 0) {
+ inferior_appeared(inf, 1);
+ inf->fake_pid_p = 1;
+ }
+
/*
* Determine the first address in KVA. Newer kernels export
* VM_MAXUSER_ADDRESS and the first kernel address can be
@@ -361,11 +365,23 @@ fbsd_kvm_target_open (const char *args, int from_tty)
kernstart = kgdb_lookup("kernbase");
}
+ osreldate = parse_and_eval_long("osreldate");
+
/*
- * Lookup symbols needed for stoppcbs[] handling, but don't
+ * Look up symbols needed for stoppcbs handling, but don't
* fail if they aren't present.
*/
stoppcbs = kgdb_lookup("stoppcbs");
+ if (osreldate >= 1400088) {
+ /* stoppcbs is now a pointer rather than an array. */
+ try {
+ stoppcbs = read_memory_typed_address(stoppcbs,
+ builtin_type(target_gdbarch())->builtin_data_ptr);
+ } catch (const gdb_exception_error &e) {
+ stoppcbs = 0;
+ }
+ }
+
try {
pcb_size = parse_and_eval_long("pcb_size");
} catch (const gdb_exception_error &e) {
@@ -387,18 +403,8 @@ fbsd_kvm_target_open (const char *args, int from_tty)
}
}
- kvm = nkvm;
- vmcore = filename;
- current_inferior()->push_target (&fbsd_kvm_ops);
-
kgdb_dmesg();
- inf = current_inferior();
- if (inf->pid == 0) {
- inferior_appeared(inf, 1);
- inf->fake_pid_p = 1;
- }
- solib_create_inferior_hook(0);
kt = kgdb_thr_init(ops->cpu_pcb_addr);
thread_info *curthr = nullptr;
while (kt != NULL) {
@@ -410,6 +416,10 @@ fbsd_kvm_target_open (const char *args, int from_tty)
}
switch_to_thread (curthr);
+ unpusher.release ();
+
+ post_create_inferior (from_tty);
+
target_fetch_registers (get_current_regcache (), -1);
reinit_frame_cache ();
@@ -422,15 +432,14 @@ fbsd_kvm_target::close()
if (kvm != NULL) {
switch_to_no_thread ();
- exit_inferior_silent (current_inferior ());
+ exit_inferior (current_inferior ());
clear_solib();
if (kvm_close(kvm) != 0)
- warning("cannot close \"%s\": %s", vmcore,
+ warning("cannot close \"%s\": %s", vmcore.c_str (),
kvm_geterr(kvm));
kvm = NULL;
- xfree(vmcore);
- vmcore = NULL;
+ vmcore.clear ();
}
}
@@ -445,7 +454,7 @@ kgdb_trgt_detach(struct target_ops *ops, const char *args, int from_tty)
unpush_target(&kgdb_trgt_ops);
reinit_frame_cache();
if (from_tty)
- printf_filtered("No vmcore file now.\n");
+ gdb_printf("No vmcore file now.\n");
}
#endif
@@ -478,33 +487,9 @@ void
fbsd_kvm_target::files_info()
{
- printf_filtered ("\t`%s', ", vmcore);
- wrap_here (" ");
- printf_filtered ("file type %s.\n", "FreeBSD kernel vmcore");
-}
-
-void
-fbsd_kvm_target::update_thread_list()
-{
- /*
- * XXX: We should probably rescan the thread list here and update
- * it if there are any changes. One nit though is that we'd have
- * to detect exited threads.
- */
- gdb_assert(kvm != NULL);
-#if 0
- prune_threads();
-#endif
-#if 0
- struct target_ops *tb;
-
- if (kvm != NULL)
- return;
-
- tb = find_target_beneath(ops);
- if (tb->to_update_thread_list != NULL)
- tb->to_update_thread_list(tb);
-#endif
+ gdb_printf ("\t`%s', ", vmcore.c_str ());
+ gdb_stdout->wrap_here (8);
+ gdb_printf ("file type %s.\n", "FreeBSD kernel vmcore");
}
std::string
@@ -522,8 +507,7 @@ fbsd_kvm_target::thread_alive(ptid_t ptid)
void
fbsd_kvm_target::fetch_registers(struct regcache *regcache, int regnum)
{
- struct fbsd_vmcore_ops *ops = (struct fbsd_vmcore_ops *)
- gdbarch_data (target_gdbarch(), fbsd_vmcore_data);
+ struct fbsd_vmcore_ops *ops = get_fbsd_vmcore_ops (target_gdbarch ());
struct kthr *kt;
if (ops->supply_pcb == NULL)
@@ -565,30 +549,10 @@ fbsd_kvm_target::xfer_partial(enum target_object object,
}
}
-#if 0
-static int
-kgdb_trgt_insert_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
-{
-
- return 0;
-}
-
-static int
-kgdb_trgt_remove_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt, enum remove_bp_reason reason)
-{
-
- return 0;
-}
-#endif
-
static void
kgdb_switch_to_thread(const char *arg, int tid)
{
- struct thread_info *tp;
-
- tp = find_thread_ptid (&fbsd_kvm_ops, fbsd_vmcore_ptid (tid));
+ struct thread_info *tp = fbsd_kvm_ops.find_thread (fbsd_vmcore_ptid (tid));
if (tp == NULL)
error ("invalid tid");
thread_select (arg, tp);
@@ -648,8 +612,6 @@ _initialize_kgdb_target ()
add_target(fbsd_kvm_target_info, fbsd_kvm_target_open,
filename_completer);
- fbsd_vmcore_data = gdbarch_data_register_pre_init(fbsd_vmcore_init);
-
add_com ("proc", class_obscure, kgdb_set_proc_cmd,
"Set current process context");
add_com ("tid", class_obscure, kgdb_set_tid_cmd,
diff --git a/devel/gdb/files/kgdb/i386fbsd-kern.c b/devel/gdb/files/kgdb/i386fbsd-kern.c
index 1040defa74da..d6e1075db9a3 100644
--- a/devel/gdb/files/kgdb/i386fbsd-kern.c
+++ b/devel/gdb/files/kgdb/i386fbsd-kern.c
@@ -50,15 +50,7 @@ struct i386fbsd_info {
};
/* Per-program-space data key. */
-static const struct program_space_data *i386fbsd_pspace_data;
-
-static void
-i386fbsd_pspace_data_cleanup (struct program_space *pspace, void *arg)
-{
- struct i386fbsd_info *info = (struct i386fbsd_info *)arg;
-
- xfree (info);
-}
+static const registry<program_space>::key<i386fbsd_info> i386fbsd_pspace_data;
/* Get the current i386fbsd data. If none is found yet, add it now. This
function always returns a valid object. */
@@ -68,13 +60,11 @@ get_i386fbsd_info (void)
{
struct i386fbsd_info *info;
- info = (struct i386fbsd_info *)
- program_space_data (current_program_space, i386fbsd_pspace_data);
- if (info != NULL)
+ info = i386fbsd_pspace_data.get (current_program_space);
+ if (info != nullptr)
return info;
- info = XCNEW (struct i386fbsd_info);
- set_program_space_data (current_program_space, i386fbsd_pspace_data, info);
+ info = i386fbsd_pspace_data.emplace (current_program_space);
/*
* In revision 1.117 of i386/i386/exception.S trap handlers
@@ -219,7 +209,7 @@ i386fbsd_fetch_tss(void)
}
static struct trad_frame_cache *
-i386fbsd_dblfault_cache (struct frame_info *this_frame, void **this_cache)
+i386fbsd_dblfault_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -249,8 +239,8 @@ i386fbsd_dblfault_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-i386fbsd_dblfault_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+i386fbsd_dblfault_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
i386fbsd_dblfault_cache (this_frame, this_cache);
@@ -259,8 +249,8 @@ i386fbsd_dblfault_this_id (struct frame_info *this_frame,
}
static struct value *
-i386fbsd_dblfault_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+i386fbsd_dblfault_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
i386fbsd_dblfault_cache (this_frame, this_cache);
@@ -270,8 +260,8 @@ i386fbsd_dblfault_prev_register (struct frame_info *this_frame,
static int
i386fbsd_dblfault_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
{
const char *name;
@@ -312,7 +302,7 @@ static const int i386fbsd_trapframe_offset[] = {
#define TRAPFRAME_SIZE 72
static struct trad_frame_cache *
-i386fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+i386fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -407,8 +397,8 @@ i386fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-i386fbsd_trapframe_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+i386fbsd_trapframe_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
i386fbsd_trapframe_cache (this_frame, this_cache);
@@ -417,8 +407,8 @@ i386fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-i386fbsd_trapframe_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+i386fbsd_trapframe_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
i386fbsd_trapframe_cache (this_frame, this_cache);
@@ -428,8 +418,8 @@ i386fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
i386fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
{
const char *name;
@@ -460,7 +450,7 @@ i386fbsd_kernel_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
#endif
frame_unwind_prepend_unwinder(gdbarch, &i386fbsd_trapframe_unwind);
- set_solib_ops(gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops(gdbarch, &kld_so_ops);
fbsd_vmcore_set_supply_pcb(gdbarch, i386fbsd_supply_pcb);
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb);
@@ -478,9 +468,6 @@ _initialize_i386_kgdb_tdep ()
gdbarch_register_osabi (bfd_arch_i386, 0,
GDB_OSABI_FREEBSD_KERNEL, i386fbsd_kernel_init_abi);
- i386fbsd_pspace_data = register_program_space_data_with_cleanup (NULL,
- i386fbsd_pspace_data_cleanup);
-
#ifdef __i386__
/*
* FreeBSD/i386 kernels prior to the introduction of AVX
diff --git a/devel/gdb/files/kgdb/kgdb-main.c b/devel/gdb/files/kgdb/kgdb-main.c
index 22a219027785..07dbf0a8dccd 100644
--- a/devel/gdb/files/kgdb/kgdb-main.c
+++ b/devel/gdb/files/kgdb/kgdb-main.c
@@ -24,37 +24,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <err.h>
-#include <kvm.h>
-#include <limits.h>
-#include <paths.h>
-
-/* libgdb stuff. */
-#include <defs.h>
-#include <frame.h>
-#include <frame-unwind.h>
-#include <inferior.h>
-#include <interps.h>
-#include <cli-out.h>
-#include <main.h>
-#include <objfiles.h>
+#include "defs.h"
+#include "interps.h"
+#include "main.h"
+#include "osabi.h"
+#include "run-on-main-thread.h"
#include "serial.h"
-#include <target.h>
-#include <top.h>
-#include <ui-file.h>
-#include <bfd.h>
-#include <gdbcore.h>
-#include <unistd.h>
+#include <err.h>
+#include <paths.h>
#include "kgdb.h"
@@ -66,21 +44,6 @@ static char *kernel;
static char *remote;
static char *vmcore;
-/*
- * TODO:
- * - test remote kgdb (see if threads and klds work)
- * - possibly split kthr.c out into a separate thread_stratum target that
- * uses new_objfile test to push itself when a FreeBSD kernel is loaded
- * (check for kernel osabi) (probably don't bother with this)
- * + test alternate kgdb_lookup()
- * + fix kgdb build on amd64 to include i386 cross-debug support
- * - propose expanded libkvm interface that supports cross-debug and moves
- * MD bits of kgdb into the library (examining PCB's and exporting a
- * stable-ABI struct of registers, similarly for trapframe handling and
- * stop-pcb stuff
- * + use tid's as lwp IDs instead of PIDs in ptid's
- */
-
static void
usage(void)
{
@@ -406,5 +369,6 @@ main(int argc, char *argv[])
/* Terminate argv list. */
add_arg(&args, NULL);
+ gdb_assert (is_main_thread ());
return (gdb_main(&args));
}
diff --git a/devel/gdb/files/kgdb/mipsfbsd-kern.c b/devel/gdb/files/kgdb/mipsfbsd-kern.c
index 78c9c44a2ca4..761c969d43dd 100644
--- a/devel/gdb/files/kgdb/mipsfbsd-kern.c
+++ b/devel/gdb/files/kgdb/mipsfbsd-kern.c
@@ -124,7 +124,7 @@ mipsfbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
}
static struct trad_frame_cache *
-mipsfbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+mipsfbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
size_t regsize = mips_isa_regsize (gdbarch);
@@ -203,7 +203,7 @@ mipsfbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-mipsfbsd_trapframe_this_id (struct frame_info *this_frame,
+mipsfbsd_trapframe_this_id (frame_info_ptr this_frame,
void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
@@ -213,7 +213,7 @@ mipsfbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-mipsfbsd_trapframe_prev_register (struct frame_info *this_frame,
+mipsfbsd_trapframe_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
@@ -224,7 +224,7 @@ mipsfbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
mipsfbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
const char *name;
@@ -258,25 +258,17 @@ mipsfbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
break;
case MIPS_ABI_N32:
set_gdbarch_long_double_bit (gdbarch, 128);
- /* These floatformats should probably be renamed. MIPS uses
- the same 128-bit IEEE floating point format that IA-64 uses,
- except that the quiet/signalling NaN bit is reversed (GDB
- does not distinguish between quiet and signalling NaNs). */
- set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
break;
case MIPS_ABI_N64:
set_gdbarch_long_double_bit (gdbarch, 128);
- /* These floatformats should probably be renamed. MIPS uses
- the same 128-bit IEEE floating point format that IA-64 uses,
- except that the quiet/signalling NaN bit is reversed (GDB
- does not distinguish between quiet and signalling NaNs). */
- set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
break;
}
frame_unwind_prepend_unwinder (gdbarch, &mipsfbsd_trapframe_unwind);
- set_solib_ops (gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops (gdbarch, &kld_so_ops);
fbsd_vmcore_set_supply_pcb (gdbarch, mipsfbsd_supply_pcb);
fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb);
@@ -284,7 +276,7 @@ mipsfbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
void _initialize_mips_kgdb_tdep ();
void
-_initialize_mips_kgdb_tdep ()
+_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
index 3a6eb466a92c..fa04f7762c08 100644
--- a/devel/gdb/files/kgdb/ppcfbsd-kern.c
+++ b/devel/gdb/files/kgdb/ppcfbsd-kern.c
@@ -64,7 +64,7 @@ _Static_assert(offsetof(struct pcb, pcb_lr) == PCB_OFF_LR * sizeof(register_t),
static void
ppcfbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
gdb_byte buf[24 * tdep->wordsize];
int i;
@@ -118,10 +118,10 @@ _Static_assert(offsetof(struct trapframe, srr0)
#endif
static struct trad_frame_cache *
-ppcfbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+ppcfbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
struct trad_frame_cache *cache;
CORE_ADDR base;
int i;
@@ -160,8 +160,8 @@ ppcfbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-ppcfbsd_trapframe_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+ppcfbsd_trapframe_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
ppcfbsd_trapframe_cache (this_frame, this_cache);
@@ -170,8 +170,8 @@ ppcfbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-ppcfbsd_trapframe_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ppcfbsd_trapframe_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
ppcfbsd_trapframe_cache (this_frame, this_cache);
@@ -181,8 +181,8 @@ ppcfbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
ppcfbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ frame_info_ptr this_frame,
+ void **this_cache)
{
CORE_ADDR pc;
const char *name;
@@ -211,11 +211,11 @@ static const struct frame_unwind ppcfbsd_trapframe_unwind =
static void
ppcfbsd_kernel_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
frame_unwind_prepend_unwinder(gdbarch, &ppcfbsd_trapframe_unwind);
- set_solib_ops(gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops(gdbarch, &kld_so_ops);
fbsd_vmcore_set_supply_pcb(gdbarch, ppcfbsd_supply_pcb);
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb);
diff --git a/devel/gdb/files/kgdb/riscv-fbsd-kern.c b/devel/gdb/files/kgdb/riscv-fbsd-kern.c
index 5d648fd0db83..2e77e48a2fa8 100644
--- a/devel/gdb/files/kgdb/riscv-fbsd-kern.c
+++ b/devel/gdb/files/kgdb/riscv-fbsd-kern.c
@@ -96,7 +96,7 @@ static const struct regcache_map_entry riscv_fbsd_tfmap[] =
};
static struct trad_frame_cache *
-riscv_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+riscv_fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -136,8 +136,8 @@ riscv_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-riscv_fbsd_trapframe_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
+riscv_fbsd_trapframe_this_id (frame_info_ptr this_frame,
+ void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
riscv_fbsd_trapframe_cache (this_frame, this_cache);
@@ -146,8 +146,8 @@ riscv_fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-riscv_fbsd_trapframe_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+riscv_fbsd_trapframe_prev_register (frame_info_ptr this_frame,
+ void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
riscv_fbsd_trapframe_cache (this_frame, this_cache);
@@ -157,8 +157,8 @@ riscv_fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
riscv_fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
{
const char *name;
@@ -185,7 +185,7 @@ riscv_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
frame_unwind_prepend_unwinder (gdbarch, &riscv_fbsd_trapframe_unwind);
- set_solib_ops (gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops (gdbarch, &kld_so_ops);
set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
@@ -195,7 +195,7 @@ riscv_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
void _initialize_riscv_kgdb_tdep ();
void
-_initialize_riscv_kgdb_tdep ()
+_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
index 158ad22df2af..115c934a2c70 100644
--- a/devel/gdb/files/kgdb/sparc64fbsd-kern.c
+++ b/devel/gdb/files/kgdb/sparc64fbsd-kern.c
@@ -79,7 +79,7 @@ _Static_assert(offsetof(struct trapframe, tf_out) == OFF_TF_OUT,
#endif
static struct sparc_frame_cache *
-sparc64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+sparc64fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
{
struct sparc_frame_cache *cache;
CORE_ADDR fp, sp, trapframe_addr;
@@ -115,7 +115,7 @@ sparc64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
}
static void
-sparc64fbsd_trapframe_this_id (struct frame_info *this_frame,
+sparc64fbsd_trapframe_this_id (frame_info_ptr this_frame,
void **this_cache, struct frame_id *this_id)
{
struct sparc_frame_cache *cache =
@@ -125,7 +125,7 @@ sparc64fbsd_trapframe_this_id (struct frame_info *this_frame,
}
static struct value *
-sparc64fbsd_trapframe_prev_register (struct frame_info *this_frame,
+sparc64fbsd_trapframe_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
struct sparc_frame_cache *cache =
@@ -136,7 +136,7 @@ sparc64fbsd_trapframe_prev_register (struct frame_info *this_frame,
static int
sparc64fbsd_trapframe_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_cache)
{
CORE_ADDR pc;
@@ -294,7 +294,7 @@ sparc64fbsd_kernel_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_prepend_unwinder(gdbarch, &sparc64fbsd_trapframe_unwind);
- set_solib_ops(gdbarch, &kld_so_ops);
+ set_gdbarch_so_ops(gdbarch, &kld_so_ops);
#ifdef __sparc64__
fbsd_vmcore_set_supply_pcb(gdbarch, sparc64fbsd_supply_pcb);
diff --git a/devel/gdb/files/patch-fixes b/devel/gdb/files/patch-fixes
deleted file mode 100644
index 1d7714c94144..000000000000
--- a/devel/gdb/files/patch-fixes
+++ /dev/null
@@ -1,10 +0,0 @@
---- gdb/compile/compile-loc2c.c.orig 2019-02-26 20:51:50.000000000 -0800
-+++ gdb/compile/compile-loc2c.c 2019-05-24 16:07:42.382379000 -0700
-@@ -657,6 +657,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *s
- uint64_t uoffset, reg;
- int64_t offset;
-
-+ uoffset = 0;
- print_spaces (indent - 2, stream);
- if (info[op_ptr - base].label)
- {
diff --git a/devel/gdb/files/patch-gdb_amd64-bsd-nat.c b/devel/gdb/files/patch-gdb_amd64-bsd-nat.c
deleted file mode 100644
index 9b34d1513cca..000000000000
--- a/devel/gdb/files/patch-gdb_amd64-bsd-nat.c
+++ /dev/null
@@ -1,30 +0,0 @@
---- 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 <sys/types.h>
- #include <sys/ptrace.h>
- #include <machine/reg.h>
-+#include <machine/psl.h>
-
- #include "amd64-tdep.h"
- #include "amd64-nat.h"
-@@ -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) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-+ old_rflags = regs.r_rflags;
- amd64_collect_native_gregset (regcache, &regs, 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;
-+ }
- if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
-
diff --git a/devel/gdb/files/patch-gdb_fbsd-nat.c b/devel/gdb/files/patch-gdb_fbsd-nat.c
deleted file mode 100644
index 40fcdf0cf6e2..000000000000
--- a/devel/gdb/files/patch-gdb_fbsd-nat.c
+++ /dev/null
@@ -1,17 +0,0 @@
---- gdb/fbsd-nat.c.orig 2019-05-11 11:19:03.000000000 -0700
-+++ gdb/fbsd-nat.c 2019-05-24 16:25:52.961523000 -0700
-@@ -1178,6 +1178,14 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum g
- /* If ptid is a specific LWP, suspend all other LWPs in the process. */
- inferior *inf = find_inferior_ptid (ptid);
-
-+#ifndef PT_LWP_EVENTS
-+ /* When LWP events are not supported, a new thread might already be
-+ running that has not yet reported an event when GDB wishes to
-+ only run a single thread. Force an update of the thread list
-+ to ensure that any such threads are suspended before the process
-+ is resumed. */
-+ fbsd_add_threads (ptid.pid ());
-+#endif
- for (thread_info *tp : inf->non_exited_threads ())
- {
- int request;
diff --git a/devel/gdb/files/patch-gdb_i386-fbsd-nat.c b/devel/gdb/files/patch-gdb_i386-fbsd-nat.c
index bba42ea41cb0..e037c13fd396 100644
--- a/devel/gdb/files/patch-gdb_i386-fbsd-nat.c
+++ b/devel/gdb/files/patch-gdb_i386-fbsd-nat.c
@@ -1,23 +1,23 @@
---- gdb/i386-fbsd-nat.c 2017-09-14 09:28:17 UTC
-+++ gdb/i386-fbsd-nat.c
-@@ -43,8 +43,6 @@ public:
- const struct target_desc *read_description () override;
- #endif
+--- gdb/i386-fbsd-nat.c.orig 2022-05-02 12:03:48.925048000 -0700
++++ gdb/i386-fbsd-nat.c 2022-05-02 12:04:43.474983000 -0700
+@@ -41,8 +41,6 @@ class i386_fbsd_nat_target final : public x86_fbsd_nat
+ void store_registers (struct regcache *, int) override;
-- void resume (ptid_t, int, enum gdb_signal) override;
+ const struct target_desc *read_description () override;
-
- #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO)
- bool supports_stopped_by_hw_breakpoint () override;
- #endif
-@@ -52,6 +50,7 @@ public:
+- void resume (ptid_t, int, enum gdb_signal) override;
+ };
static i386_fbsd_nat_target the_i386_fbsd_nat_target;
+@@ -227,6 +225,7 @@ i386_fbsd_nat_target::store_registers (struct regcache
+ perror_with_name (_("Couldn't write floating point status"));
+ }
+#if 0
/* Resume execution of the inferior process. If STEP is nonzero,
single-step it. If SIGNAL is nonzero, give it that signal. */
-@@ -98,6 +97,7 @@ i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
+@@ -273,6 +272,7 @@ i386_fbsd_nat_target::resume (ptid_t ptid, int step, e
gdb_signal_to_host (signal)) == -1)
perror_with_name (("ptrace"));
}
diff --git a/devel/gdb/files/patch-gnulib_import_stddef.in.h b/devel/gdb/files/patch-gnulib_import_stddef.in.h
index 3e3ac0edb8c5..b5d867ac0ab7 100644
--- a/devel/gdb/files/patch-gnulib_import_stddef.in.h
+++ b/devel/gdb/files/patch-gnulib_import_stddef.in.h
@@ -1,10 +1,10 @@
---- gnulib/import/stddef.in.h.orig 2020-09-13 04:33:41.000000000 +0200
-+++ gnulib/import/stddef.in.h 2020-11-01 15:46:55.395133000 +0100
-@@ -90,7 +90,7 @@
- #if defined _MSC_VER && defined __cplusplus
+--- gnulib/import/stddef.in.h.orig 2023-02-01 20:45:52.000000000 -0800
++++ gnulib/import/stddef.in.h 2023-02-24 09:49:57.368290000 -0800
+@@ -116,7 +116,7 @@
+ && defined __cplusplus
# include <cstddef>
#else
--# if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T)
+-# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__))
+# if 0
# if !GNULIB_defined_max_align_t
/* On the x86, the maximum storage alignment of double, long, etc. is 4,
diff --git a/devel/gdb/files/patch-include_libiberty.h b/devel/gdb/files/patch-include_libiberty.h
deleted file mode 100644
index 26afe105b0f7..000000000000
--- a/devel/gdb/files/patch-include_libiberty.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- include/libiberty.h 2017-09-14 09:28:17 UTC
-+++ include/libiberty.h
-@@ -109,7 +109,7 @@
- || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
- || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
- || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
--extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
-+#include <libgen.h>
- #else
- /* Do not allow basename to be used if there is no prototype seen. We
- either need to use the above prototype or have one from
diff --git a/devel/gdb/files/patch-libiberty_configure b/devel/gdb/files/patch-libiberty_configure
deleted file mode 100644
index fb52c901e7e7..000000000000
--- a/devel/gdb/files/patch-libiberty_configure
+++ /dev/null
@@ -1,12 +0,0 @@
---- libiberty/configure.orig 2017-09-12 12:10:11 UTC
-+++ libiberty/configure
-@@ -4398,8 +4398,7 @@
- ac_libiberty_warn_cflags=
- save_CFLAGS="$CFLAGS"
- for real_option in -W -Wall -Wwrite-strings -Wc++-compat \
-- -Wstrict-prototypes \
-- -Wshadow=local; do
-+ -Wstrict-prototypes ; do
- # Do the check with the no- prefix removed since gcc silently
- # accepts any -Wno-* option on purpose
- case $real_option in
diff --git a/devel/gdb/pkg-descr b/devel/gdb/pkg-descr
index 3a1015f89099..9d19503af3f5 100644
--- a/devel/gdb/pkg-descr
+++ b/devel/gdb/pkg-descr
@@ -2,5 +2,3 @@ GDB is a source-level debugger for Ada, C, C++, Objective-C, Pascal and
many other languages. GDB can target (i.e., debug programs running on)
more than a dozen different processor architectures, and GDB itself can
run on most popular GNU/Linux, Unix and Microsoft Windows variants.
-
-WWW: http://www.gnu.org/software/gdb/
diff --git a/devel/gdb/pkg-plist b/devel/gdb/pkg-plist
index 653d280c5b1a..a25ac1fd9528 100644
--- a/devel/gdb/pkg-plist
+++ b/devel/gdb/pkg-plist
@@ -3,24 +3,28 @@
bin/gdb%%VER%%
%%TUI%%bin/gdbtui%%VER%%
%%KGDB%%bin/kgdb%%VER%%
-%%GDB_LINK%%man/man1/gdb.1.gz
-man/man1/gdb%%VER%%.1.gz
-%%GDB_LINK%%%%KGDB%%man/man1/kgdb.1.gz
-%%KGDB%%man/man1/kgdb%%VER%%.1.gz
-%%LIBCXX%%%%DATADIR%%/auto-load/usr/lib/libc++.so.1-gdb.py
-%%LIBCXX%%%%DATADIR%%/auto-load/usr/lib/libc++.so.1-gdb.pyc
+%%GDB_LINK%%share/man/man1/gdb.1.gz
+share/man/man1/gdb%%VER%%.1.gz
+%%GDB_LINK%%%%KGDB%%share/man/man1/kgdb.1.gz
+%%KGDB%%share/man/man1/kgdb%%VER%%.1.gz
+%%LIBCXX%%%%DATADIR%%/auto-load%%LIBCXX_DIR%%/libc++.so.1-gdb.py
+%%LIBCXX%%%%DATADIR%%/auto-load%%LIBCXX_DIR%%/libc++.so.1-gdb.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/__init__.py
%%PYTHON%%%%DATADIR%%/python/gdb/__init__.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/FrameDecorator.py
%%PYTHON%%%%DATADIR%%/python/gdb/FrameDecorator.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/FrameIterator.py
%%PYTHON%%%%DATADIR%%/python/gdb/FrameIterator.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/disassembler.py
+%%PYTHON%%%%DATADIR%%/python/gdb/disassembler.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/frames.py
%%PYTHON%%%%DATADIR%%/python/gdb/frames.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/printing.py
%%PYTHON%%%%DATADIR%%/python/gdb/prompt.py
%%PYTHON%%%%DATADIR%%/python/gdb/prompt.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/printing.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/styling.py
+%%PYTHON%%%%DATADIR%%/python/gdb/styling.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/types.py
%%PYTHON%%%%DATADIR%%/python/gdb/types.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/unwinder.py
@@ -43,6 +47,50 @@ man/man1/gdb%%VER%%.1.gz
%%PYTHON%%%%DATADIR%%/python/gdb/command/unwinders.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/command/xmethods.py
%%PYTHON%%%%DATADIR%%/python/gdb/command/xmethods.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/__init__.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/__init__.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/breakpoint.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/breakpoint.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/bt.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/bt.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/disassemble.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/disassemble.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/evaluate.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/evaluate.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/events.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/events.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/frames.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/frames.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/io.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/io.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/launch.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/launch.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/locations.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/locations.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/memory.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/memory.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/modules.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/modules.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/next.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/next.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/pause.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/pause.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/scopes.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/scopes.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/server.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/server.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/sources.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/sources.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/startup.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/startup.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/state.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/state.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/threads.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/threads.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/typecheck.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/typecheck.pyc
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/varref.py
+%%PYTHON%%%%DATADIR%%/python/gdb/dap/varref.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/function/__init__.py
%%PYTHON%%%%DATADIR%%/python/gdb/function/__init__.pyc
%%PYTHON%%%%DATADIR%%/python/gdb/function/as_string.py