svn commit: r557028 - in head/devel/gdb: . files files/kgdb
Luca Pizzamiglio
pizzamig at FreeBSD.org
Fri Dec 4 23:19:30 UTC 2020
Author: pizzamig
Date: Fri Dec 4 23:19:27 2020
New Revision: 557028
URL: https://svnweb.freebsd.org/changeset/ports/557028
Log:
devel/gdb: Update to 10.1
Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D27040
Deleted:
head/devel/gdb/files/patch-commit-c47bae859
head/devel/gdb/files/patch-libctf_swap.h
Modified:
head/devel/gdb/Makefile
head/devel/gdb/distinfo
head/devel/gdb/files/extrapatch-kgdb
head/devel/gdb/files/kgdb/amd64fbsd-kern.c
head/devel/gdb/files/kgdb/fbsd-kld.c
head/devel/gdb/files/kgdb/fbsd-kthr.c
head/devel/gdb/files/kgdb/fbsd-kvm.c
head/devel/gdb/files/kgdb/i386fbsd-kern.c
head/devel/gdb/files/kgdb/mipsfbsd-kern.c
head/devel/gdb/files/kgdb/ppcfbsd-kern.c
head/devel/gdb/files/kgdb/riscv-fbsd-kern.c
head/devel/gdb/files/kgdb/sparc64fbsd-kern.c
head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c
head/devel/gdb/files/patch-gdb_gdbsupport_common-defs.h
head/devel/gdb/files/patch-gnulib_import_stddef.in.h
head/devel/gdb/pkg-plist
Modified: head/devel/gdb/Makefile
==============================================================================
--- head/devel/gdb/Makefile Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/Makefile Fri Dec 4 23:19:27 2020 (r557028)
@@ -2,8 +2,8 @@
# $FreeBSD$
PORTNAME= gdb
-PORTVERSION= 9.2
-PORTREVISION= 2
+PORTVERSION= 10.1
+PORTREVISION= 0
CATEGORIES= devel
MASTER_SITES= GNU
Modified: head/devel/gdb/distinfo
==============================================================================
--- head/devel/gdb/distinfo Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/distinfo Fri Dec 4 23:19:27 2020 (r557028)
@@ -1,5 +1,5 @@
-TIMESTAMP = 1591304030
-SHA256 (gdb-9.2.tar.xz) = 360cd7ae79b776988e89d8f9a01c985d0b1fa21c767a4295e5f88cb49175c555
-SIZE (gdb-9.2.tar.xz) = 20979436
+TIMESTAMP = 1604240338
+SHA256 (gdb-10.1.tar.xz) = f82f1eceeec14a3afa2de8d9b0d3c91d5a3820e23e0a01bbb70ef9f0276b62c0
+SIZE (gdb-10.1.tar.xz) = 21507112
SHA256 (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = d4235f98b71c4d5e3f01744de279e64808229dd46c0f00cac6a12fdeb3a998a1
SIZE (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = 5299
Modified: head/devel/gdb/files/extrapatch-kgdb
==============================================================================
--- head/devel/gdb/files/extrapatch-kgdb Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/extrapatch-kgdb Fri Dec 4 23:19:27 2020 (r557028)
@@ -1,8 +1,8 @@
diff --git gdb/Makefile.in gdb/Makefile.in
-index c3e074b21f..8d026a98cb 100644
+index 4808357e65..982af063b8 100644
--- gdb/Makefile.in
+++ gdb/Makefile.in
-@@ -648,6 +648,7 @@ TARGET_OBS = @TARGET_OBS@
+@@ -665,6 +665,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,7 +10,7 @@ index c3e074b21f..8d026a98cb 100644
aarch64-fbsd-tdep.o \
aarch64-linux-tdep.o \
aarch64-newlib-tdep.o \
-@@ -662,6 +663,7 @@ ALL_64_TARGET_OBS = \
+@@ -679,6 +680,7 @@ ALL_64_TARGET_OBS = \
amd64-darwin-tdep.o \
amd64-dicos-tdep.o \
amd64-fbsd-tdep.o \
@@ -18,7 +18,7 @@ index c3e074b21f..8d026a98cb 100644
amd64-linux-tdep.o \
amd64-nbsd-tdep.o \
amd64-obsd-tdep.o \
-@@ -676,6 +678,7 @@ ALL_64_TARGET_OBS = \
+@@ -693,6 +695,7 @@ ALL_64_TARGET_OBS = \
ia64-vms-tdep.o \
mips64-obsd-tdep.o \
sparc64-fbsd-tdep.o \
@@ -26,7 +26,7 @@ index c3e074b21f..8d026a98cb 100644
sparc64-linux-tdep.o \
sparc64-nbsd-tdep.o \
sparc64-obsd-tdep.o \
-@@ -694,6 +697,7 @@ ALL_TARGET_OBS = \
+@@ -713,6 +716,7 @@ ALL_TARGET_OBS = \
arch/ppc-linux-common.o \
arch/riscv.o \
arm-bsd-tdep.o \
@@ -34,7 +34,7 @@ index c3e074b21f..8d026a98cb 100644
arm-fbsd-tdep.o \
arm-linux-tdep.o \
arm-nbsd-tdep.o \
-@@ -711,6 +715,8 @@ ALL_TARGET_OBS = \
+@@ -731,6 +735,8 @@ ALL_TARGET_OBS = \
csky-linux-tdep.o \
csky-tdep.o \
dicos-tdep.o \
@@ -43,7 +43,7 @@ index c3e074b21f..8d026a98cb 100644
fbsd-tdep.o \
frv-linux-tdep.o \
frv-tdep.o \
-@@ -727,6 +733,7 @@ ALL_TARGET_OBS = \
+@@ -746,6 +752,7 @@ ALL_TARGET_OBS = \
i386-darwin-tdep.o \
i386-dicos-tdep.o \
i386-fbsd-tdep.o \
@@ -51,7 +51,7 @@ index c3e074b21f..8d026a98cb 100644
i386-gnu-tdep.o \
i386-go32-tdep.o \
i386-linux-tdep.o \
-@@ -750,6 +757,7 @@ ALL_TARGET_OBS = \
+@@ -770,6 +777,7 @@ ALL_TARGET_OBS = \
mep-tdep.o \
microblaze-linux-tdep.o \
microblaze-tdep.o \
@@ -59,7 +59,7 @@ index c3e074b21f..8d026a98cb 100644
mips-fbsd-tdep.o \
mips-linux-tdep.o \
mips-nbsd-tdep.o \
-@@ -768,6 +776,7 @@ ALL_TARGET_OBS = \
+@@ -788,6 +796,7 @@ ALL_TARGET_OBS = \
or1k-linux-tdep.o \
or1k-tdep.o \
ppc-fbsd-tdep.o \
@@ -67,15 +67,15 @@ index c3e074b21f..8d026a98cb 100644
ppc-linux-tdep.o \
ppc-nbsd-tdep.o \
ppc-obsd-tdep.o \
-@@ -775,6 +784,7 @@ ALL_TARGET_OBS = \
+@@ -795,6 +804,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-tdep.o \
-@@ -1648,7 +1658,7 @@ generated_files = \
+ riscv-ravenscar-thread.o \
+@@ -1606,7 +1616,7 @@ generated_files = \
# Flags needed to compile Python code
PYTHON_CFLAGS = @PYTHON_CFLAGS@
@@ -84,7 +84,7 @@ index c3e074b21f..8d026a98cb 100644
@$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do
# Rule for compiling .c files in the top-level gdb directory.
-@@ -1913,6 +1923,12 @@ ifneq ($(CODESIGN_CERT),)
+@@ -1871,6 +1881,12 @@ ifneq ($(CODESIGN_CERT),)
$(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
endif
@@ -97,7 +97,7 @@ index c3e074b21f..8d026a98cb 100644
# Convenience rule to handle recursion.
.PHONY: all-data-directory
all-data-directory: data-directory/Makefile
-@@ -1953,6 +1969,7 @@ clean mostlyclean: $(CONFIG_CLEAN)
+@@ -1911,6 +1927,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 @@ index c3e074b21f..8d026a98cb 100644
rm -f test-cp-name-parser$(EXEEXT)
rm -f xml-builtin.c stamp-xml
rm -f $(DEPDIR)/*
-@@ -2152,6 +2169,7 @@ MAKEOVERRIDES =
+@@ -2106,6 +2123,7 @@ MAKEOVERRIDES =
ALLDEPFILES = \
aarch32-tdep.c \
@@ -113,7 +113,7 @@ index c3e074b21f..8d026a98cb 100644
aarch64-fbsd-nat.c \
aarch64-fbsd-tdep.c \
aarch64-linux-nat.c \
-@@ -2171,6 +2189,7 @@ ALLDEPFILES = \
+@@ -2125,6 +2143,7 @@ ALLDEPFILES = \
amd64-bsd-nat.c \
amd64-darwin-tdep.c \
amd64-dicos-tdep.c \
@@ -121,7 +121,7 @@ index c3e074b21f..8d026a98cb 100644
amd64-fbsd-nat.c \
amd64-fbsd-tdep.c \
amd64-linux-nat.c \
-@@ -2185,6 +2204,7 @@ ALLDEPFILES = \
+@@ -2139,6 +2158,7 @@ ALLDEPFILES = \
arc-tdep.c \
arm.c \
arm-bsd-tdep.c \
@@ -129,7 +129,7 @@ index c3e074b21f..8d026a98cb 100644
arm-fbsd-nat.c \
arm-fbsd-tdep.c \
arm-get-next-pcs.c \
-@@ -2205,6 +2225,9 @@ ALLDEPFILES = \
+@@ -2160,6 +2180,9 @@ ALLDEPFILES = \
csky-tdep.c \
darwin-nat.c \
dicos-tdep.c \
@@ -139,7 +139,7 @@ index c3e074b21f..8d026a98cb 100644
fbsd-nat.c \
fbsd-tdep.c \
fork-child.c \
-@@ -2226,6 +2249,7 @@ ALLDEPFILES = \
+@@ -2180,6 +2203,7 @@ ALLDEPFILES = \
i386-darwin-nat.c \
i386-darwin-tdep.c \
i386-dicos-tdep.c \
@@ -147,7 +147,7 @@ index c3e074b21f..8d026a98cb 100644
i386-fbsd-nat.c \
i386-fbsd-tdep.c \
i386-gnu-nat.c \
-@@ -2262,6 +2286,7 @@ ALLDEPFILES = \
+@@ -2217,6 +2241,7 @@ ALLDEPFILES = \
microblaze-linux-tdep.c \
microblaze-tdep.c \
mingw-hdep.c \
@@ -155,7 +155,7 @@ index c3e074b21f..8d026a98cb 100644
mips-fbsd-nat.c \
mips-fbsd-tdep.c \
mips-linux-nat.c \
-@@ -2281,6 +2306,7 @@ ALLDEPFILES = \
+@@ -2236,6 +2261,7 @@ ALLDEPFILES = \
obsd-nat.c \
obsd-tdep.c \
posix-hdep.c \
@@ -163,7 +163,7 @@ index c3e074b21f..8d026a98cb 100644
ppc-fbsd-nat.c \
ppc-fbsd-tdep.c \
ppc-linux-nat.c \
-@@ -2295,6 +2321,7 @@ ALLDEPFILES = \
+@@ -2250,6 +2276,7 @@ ALLDEPFILES = \
procfs.c \
ravenscar-thread.c \
remote-sim.c \
@@ -171,7 +171,7 @@ index c3e074b21f..8d026a98cb 100644
riscv-fbsd-nat.c \
riscv-fbsd-tdep.c \
riscv-linux-nat.c \
-@@ -2330,6 +2357,7 @@ ALLDEPFILES = \
+@@ -2286,6 +2313,7 @@ ALLDEPFILES = \
sparc-sol2-nat.c \
sparc-sol2-tdep.c \
sparc-tdep.c \
@@ -179,7 +179,7 @@ index c3e074b21f..8d026a98cb 100644
sparc64-fbsd-nat.c \
sparc64-fbsd-tdep.c \
sparc64-linux-nat.c \
-@@ -2588,7 +2616,7 @@ endif
+@@ -2544,7 +2572,7 @@ endif
# A list of all the objects we might care about in this build, for
# dependency tracking.
@@ -189,10 +189,10 @@ index c3e074b21f..8d026a98cb 100644
# All the .deps files to include.
diff --git gdb/config.in gdb/config.in
-index cb886ba8e1..b8a937f6de 100644
+index 9755458f9c..4a1f7a924c 100644
--- gdb/config.in
+++ gdb/config.in
-@@ -218,6 +218,12 @@
+@@ -217,6 +217,12 @@
/* Define to 1 if your system has the kinfo_getvmmap function. */
#undef HAVE_KINFO_GETVMMAP
@@ -206,10 +206,10 @@ index cb886ba8e1..b8a937f6de 100644
#undef HAVE_LANGINFO_CODESET
diff --git gdb/configure gdb/configure
-index b572d414ca..12e08354cc 100755
+index e7811e807a..0a6a1304ce 100755
--- gdb/configure
+++ gdb/configure
-@@ -8064,6 +8064,126 @@ $as_echo "#define HAVE_KINFO_GETFILE 1" >>confdefs.h
+@@ -8331,6 +8331,126 @@ $as_echo "#define HAVE_KINFO_GETVMMAP 1" >>confdefs.h
fi
@@ -337,12 +337,12 @@ index b572d414ca..12e08354cc 100755
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
diff --git gdb/configure.ac gdb/configure.ac
-index ca0da7980c..39dc6a3559 100644
+index 620ae23e34..9186b54386 100644
--- gdb/configure.ac
+++ gdb/configure.ac
-@@ -485,6 +485,16 @@ AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd,
- [AC_DEFINE(HAVE_KINFO_GETFILE, 1,
- [Define to 1 if your system has the kinfo_getfile function. ])])
+@@ -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. ])])
+# kgdb needs kvm_open2 for cross-debugging
+AC_SEARCH_LIBS(kvm_open2, kvm,
@@ -358,7 +358,7 @@ index ca0da7980c..39dc6a3559 100644
# GDB may fork/exec the iconv program to get the list of supported character
diff --git gdb/configure.nat gdb/configure.nat
-index fb4522f579..a5059ff37d 100644
+index 3e94a064ae..6b73f8dd90 100644
--- gdb/configure.nat
+++ gdb/configure.nat
@@ -63,7 +63,8 @@ case ${gdb_host} in
@@ -372,7 +372,7 @@ index fb4522f579..a5059ff37d 100644
LOADLIBES='-lkvm'
;;
diff --git gdb/configure.tgt gdb/configure.tgt
-index caa42be1c0..45668ccaed 100644
+index a3e11c4b9b..1d8b6f10a0 100644
--- gdb/configure.tgt
+++ gdb/configure.tgt
@@ -101,7 +101,7 @@ esac
@@ -393,7 +393,7 @@ index caa42be1c0..45668ccaed 100644
;;
aarch64*-*-linux*)
-@@ -171,7 +171,7 @@ arm*-*-linux*)
+@@ -173,7 +173,7 @@ arm*-*-linux*)
;;
arm*-*-freebsd*)
# Target: FreeBSD/arm
@@ -402,7 +402,7 @@ index caa42be1c0..45668ccaed 100644
;;
arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
# Target: NetBSD/arm
-@@ -270,7 +270,11 @@ i[34567]86-*-dicos*)
+@@ -277,7 +277,11 @@ i[34567]86-*-dicos*)
;;
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
# Target: FreeBSD/i386
@@ -415,7 +415,7 @@ index caa42be1c0..45668ccaed 100644
;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
# Target: NetBSD/i386
-@@ -424,7 +428,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+@@ -423,7 +427,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
;;
mips*-*-freebsd*)
# Target: MIPS running FreeBSD
@@ -424,7 +424,7 @@ index caa42be1c0..45668ccaed 100644
gdb_sim=../sim/mips/libsim.a
;;
mips64*-*-openbsd*)
-@@ -491,7 +495,7 @@ or1k-*-* | or1knd-*-*)
+@@ -489,7 +493,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 @@ index caa42be1c0..45668ccaed 100644
ravenscar-thread.o ppc-ravenscar-thread.o"
;;
-@@ -545,7 +549,7 @@ s390*-*-linux*)
+@@ -541,7 +545,7 @@ s390*-*-linux*)
riscv*-*-freebsd*)
# Target: FreeBSD/riscv
@@ -442,7 +442,7 @@ index caa42be1c0..45668ccaed 100644
;;
riscv*-*-linux*)
-@@ -624,6 +628,7 @@ sparc64-*-linux*)
+@@ -616,6 +620,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 +450,7 @@ index caa42be1c0..45668ccaed 100644
ravenscar-thread.o sparc-ravenscar-thread.o"
;;
sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
-@@ -745,8 +750,8 @@ x86_64-*-linux*)
+@@ -735,8 +740,8 @@ x86_64-*-linux*)
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
# Target: FreeBSD/amd64
@@ -461,20 +461,8 @@ index caa42be1c0..45668ccaed 100644
;;
x86_64-*-mingw* | x86_64-*-cygwin*)
# Target: MingW/amd64
-diff --git gdb/defs.h gdb/defs.h
-index 567f214b81..abbaa1f950 100644
---- gdb/defs.h
-+++ gdb/defs.h
-@@ -481,6 +481,7 @@ enum gdb_osabi
- GDB_OSABI_SOLARIS,
- GDB_OSABI_LINUX,
- GDB_OSABI_FREEBSD,
-+ GDB_OSABI_FREEBSD_KERNEL,
- GDB_OSABI_NETBSD,
- GDB_OSABI_OPENBSD,
- GDB_OSABI_WINCE,
diff --git gdb/osabi.c gdb/osabi.c
-index dec1bddc4c..06c514167e 100644
+index 627b9d9815..45a2fc6ade 100644
--- gdb/osabi.c
+++ gdb/osabi.c
@@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] =
@@ -485,11 +473,23 @@ index dec1bddc4c..06c514167e 100644
{ "NetBSD", NULL },
{ "OpenBSD", NULL },
{ "WindowsCE", NULL },
+diff --git gdb/osabi.h gdb/osabi.h
+index a7e6a10d01..07cef9bee3 100644
+--- gdb/osabi.h
++++ gdb/osabi.h
+@@ -31,6 +31,7 @@ enum gdb_osabi
+ GDB_OSABI_SOLARIS,
+ GDB_OSABI_LINUX,
+ GDB_OSABI_FREEBSD,
++ GDB_OSABI_FREEBSD_KERNEL,
+ GDB_OSABI_NETBSD,
+ GDB_OSABI_OPENBSD,
+ GDB_OSABI_WINCE,
diff --git gdb/regcache.c gdb/regcache.c
-index 1580359cd4..50ff8d4039 100644
+index 91d3202b94..903b3d0d86 100644
--- gdb/regcache.c
+++ gdb/regcache.c
-@@ -996,6 +996,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
+@@ -1108,6 +1108,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
m_register_status[regnum] = REG_VALID;
}
@@ -513,10 +513,10 @@ index 1580359cd4..50ff8d4039 100644
void
diff --git gdb/regcache.h gdb/regcache.h
-index e2935eea74..83654be825 100644
+index 9390f5708e..62920a5b7f 100644
--- gdb/regcache.h
+++ gdb/regcache.h
-@@ -226,6 +226,8 @@ public:
+@@ -228,6 +228,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);
@@ -526,15 +526,15 @@ index e2935eea74..83654be825 100644
virtual ~reg_buffer () = default;
diff --git gnulib/configure gnulib/configure
-index 7c74371e8f..396467f68d 100644
+index ef7f6d5e80..536a0b4812 100644
--- gnulib/configure
+++ gnulib/configure
-@@ -20267,6 +20267,8 @@ else
- case "$host_os" in
- # Guess all is fine on glibc systems.
- *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
-+ # Guess all is fine on FreeBSD.
-+ freebsd*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_gettimeofday_clobber="guessing yes" ;;
- esac
+@@ -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.
Modified: head/devel/gdb/files/kgdb/amd64fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/amd64fbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -241,6 +241,7 @@ amd64fbsd_kernel_init_abi(struct gdbarch_info info, st
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb);
}
+void _initialize_amd64_kgdb_tdep(void);
void
_initialize_amd64_kgdb_tdep(void)
{
Modified: head/devel/gdb/files/kgdb/fbsd-kld.c
==============================================================================
--- head/devel/gdb/files/kgdb/fbsd-kld.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/fbsd-kld.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -88,7 +88,7 @@ get_kld_info (void)
}
static int
-kld_ok (char *path)
+kld_ok (const char *path)
{
struct stat sb;
@@ -106,66 +106,60 @@ static const char *kld_suffixes[] = {
".debug",
".symbols",
"",
- NULL
};
-static int
-check_kld_path (char *path, size_t path_size)
+static bool
+check_kld_path (std::string &path)
{
- const char **suffix;
- char *ep;
-
- ep = path + strlen(path);
- suffix = kld_suffixes;
- while (*suffix != NULL) {
- if (strlcat(path, *suffix, path_size) < path_size) {
- if (kld_ok(path))
- return (1);
- }
-
- /* Restore original path to remove suffix. */
- *ep = '\0';
- suffix++;
- }
- return (0);
+ for (const char *suffix : kld_suffixes) {
+ std::string new_path = path + suffix;
+ if (kld_ok (new_path.c_str ())) {
+ path = new_path;
+ return true;
+ }
+ }
+ return false;
}
/*
* Try to find the path for a kld by looking in the kernel's directory and
* in the various paths in the module path.
*/
-static int
-find_kld_path (const char *filename, char *path, size_t path_size)
+static gdb::optional<std::string>
+find_kld_path (const char *filename)
{
- struct kld_info *info;
- gdb::unique_xmalloc_ptr<char> module_path;
- char *module_dir, *cp;
- int error;
+ if (exec_bfd)
+ {
+ std::string kernel_dir = ldirname (bfd_get_filename (exec_bfd));
+ if (!kernel_dir.empty ())
+ {
+ std::string path = string_printf("%s/%s", kernel_dir.c_str (),
+ filename);
+ if (check_kld_path (path))
+ return path;
+ }
+ }
- info = get_kld_info();
- if (exec_bfd) {
- std::string kernel_dir = ldirname(bfd_get_filename(exec_bfd));
- if (!kernel_dir.empty()) {
- snprintf(path, path_size, "%s/%s", kernel_dir.c_str(),
- filename);
- if (check_kld_path(path, path_size))
- return (1);
- }
+ struct kld_info *info = get_kld_info ();
+ if (info->module_path_addr != 0)
+ {
+ gdb::unique_xmalloc_ptr<char> module_path
+ = target_read_string(info->module_path_addr, PATH_MAX);
+
+ if (module_path != nullptr)
+ {
+ char *cp = module_path.get();
+ char *module_dir;
+ while ((module_dir = strsep(&cp, ";")) != NULL)
+ {
+ std::string path = string_printf("%s/%s", module_dir, filename);
+ if (check_kld_path (path))
+ return path;
+ }
}
- if (info->module_path_addr != 0) {
- target_read_string(info->module_path_addr, &module_path,
- PATH_MAX, &error);
- if (error == 0) {
- cp = module_path.get();
- while ((module_dir = strsep(&cp, ";")) != NULL) {
- snprintf(path, path_size, "%s/%s", module_dir,
- filename);
- if (check_kld_path(path, path_size))
- return (1);
- }
- }
- }
- return (0);
+ }
+
+ return {};
}
/*
@@ -193,28 +187,23 @@ read_pointer (CORE_ADDR address)
static int
find_kld_address (const char *arg, CORE_ADDR *address)
{
- struct kld_info *info;
- CORE_ADDR kld;
- gdb::unique_xmalloc_ptr<char> kld_filename;
- const char *filename;
- int error;
-
- info = get_kld_info();
+ struct kld_info *info = get_kld_info();
if (info->linker_files_addr == 0 || info->off_address == 0 ||
info->off_filename == 0 || info->off_next == 0)
return (0);
- filename = lbasename(arg);
- for (kld = read_pointer(info->linker_files_addr); kld != 0;
+ const char *filename = lbasename(arg);
+ for (CORE_ADDR kld = read_pointer(info->linker_files_addr); kld != 0;
kld = read_pointer(kld + info->off_next)) {
/* Try to read this linker file's filename. */
- target_read_string(read_pointer(kld + info->off_filename),
- &kld_filename, PATH_MAX, &error);
- if (error)
+ gdb::unique_xmalloc_ptr<char> kld_filename =
+ target_read_string (read_pointer (kld + info->off_filename),
+ PATH_MAX);
+ if (kld_filename == nullptr)
continue;
/* Compare this kld's filename against our passed in name. */
- if (strcmp(kld_filename.get(), filename) != 0)
+ if (strcmp(kld_filename.get (), filename) != 0)
continue;
/*
@@ -249,7 +238,7 @@ adjust_section_address (struct target_section *sec, CO
}
static void
-load_kld (char *path, CORE_ADDR base_addr, int from_tty)
+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;
@@ -301,24 +290,25 @@ load_kld (char *path, CORE_ADDR base_addr, int from_tt
static void
kgdb_add_kld_cmd (const char *arg, int from_tty)
{
- char path[PATH_MAX];
CORE_ADDR base_addr;
if (!exec_bfd)
error("No kernel symbol file");
/* Try to open the raw path to handle absolute paths first. */
- snprintf(path, sizeof(path), "%s", arg);
- if (!check_kld_path(path, sizeof(path))) {
+ std::string path (arg);
+ if (!check_kld_path(path)) {
/*
* If that didn't work, look in the various possible
* paths for the module.
*/
- if (!find_kld_path(arg, path, sizeof(path))) {
+ gdb::optional<std::string> found = find_kld_path (arg);
+ if (!found) {
error("Unable to locate kld");
return;
}
+ path = std::move(*found);
}
if (!find_kld_address(arg, &base_addr)) {
@@ -326,7 +316,7 @@ kgdb_add_kld_cmd (const char *arg, int from_tty)
return;
}
- load_kld(path, base_addr, from_tty);
+ load_kld(path.c_str (), base_addr, from_tty);
reinit_frame_cache();
}
@@ -435,33 +425,27 @@ kld_solib_create_inferior_hook (int from_tty)
static struct so_list *
kld_current_sos (void)
{
- struct so_list *head, **prev, *newobj;
- struct kld_info *info;
- CORE_ADDR kld, kernel;
- gdb::unique_xmalloc_ptr<char> path;
- int error;
-
- info = get_kld_info();
+ struct kld_info *info = get_kld_info();
if (info->linker_files_addr == 0 || info->kernel_file_addr == 0 ||
info->off_address == 0 || info->off_filename == 0 ||
info->off_next == 0)
return (NULL);
- head = NULL;
- prev = &head;
+ struct so_list *head = NULL;
+ struct so_list **prev = &head;
/*
* Walk the list of linker files creating so_list entries for
* each non-kernel file.
*/
- kernel = read_pointer(info->kernel_file_addr);
- for (kld = read_pointer(info->linker_files_addr); kld != 0;
+ CORE_ADDR kernel = read_pointer(info->kernel_file_addr);
+ for (CORE_ADDR kld = read_pointer(info->linker_files_addr); kld != 0;
kld = read_pointer(kld + info->off_next)) {
/* Skip the main kernel file. */
if (kld == kernel)
continue;
- newobj = XCNEW (struct so_list);
+ struct so_list *newobj = XCNEW (struct so_list);
lm_info_kld *li = new lm_info_kld;
li->base_address = 0;
@@ -469,11 +453,11 @@ kld_current_sos (void)
newobj->lm_info = li;
/* Read the base filename and store it in so_original_name. */
- target_read_string(read_pointer(kld + info->off_filename),
- &path, sizeof(newobj->so_original_name), &error);
- if (error != 0) {
- warning("kld_current_sos: Can't read filename: %s\n",
- safe_strerror(error));
+ gdb::unique_xmalloc_ptr<char> path =
+ target_read_string (read_pointer (kld + info->off_filename),
+ sizeof(newobj->so_original_name));
+ if (path == nullptr) {
+ warning("kld_current_sos: Can't read filename\n");
free_so(newobj);
continue;
}
@@ -484,18 +468,14 @@ kld_current_sos (void)
* Try to read the pathname (if it exists) and store
* it in so_name.
*/
- if (find_kld_path(newobj->so_original_name, newobj->so_name,
- sizeof(newobj->so_name))) {
- /* we found the kld */;
- } else if (info->off_pathname != 0) {
- target_read_string(read_pointer(kld +
+ if (info->off_pathname != 0) {
+ path = target_read_string (read_pointer (kld +
info->off_pathname),
- &path, sizeof(newobj->so_name), &error);
- if (error != 0) {
+ sizeof(newobj->so_name));
+ if (path == nullptr) {
warning(
- "kld_current_sos: Can't read pathname for \"%s\": %s\n",
- newobj->so_original_name,
- safe_strerror(error));
+ "kld_current_sos: Can't read pathname for \"%s\"\n",
+ newobj->so_original_name);
strlcpy(newobj->so_name, newobj->so_original_name,
sizeof(newobj->so_name));
} else {
@@ -542,20 +522,19 @@ static int
kld_find_and_open_solib (const char *solib, unsigned o_flags,
gdb::unique_xmalloc_ptr<char> *temp_pathname)
{
- char path[PATH_MAX];
- int fd;
-
- temp_pathname->reset (NULL);
- if (!find_kld_path(solib, path, sizeof(path))) {
- errno = ENOENT;
- return (-1);
- }
- fd = open(path, o_flags, 0);
- if (fd >= 0)
- temp_pathname->reset(xstrdup(path));
- return (fd);
+ temp_pathname->reset (NULL);
+ gdb::optional<std::string> found = find_kld_path (solib);
+ if (!found) {
+ errno = ENOENT;
+ return (-1);
+ }
+ int fd = open(found->c_str (), o_flags, 0);
+ if (fd >= 0)
+ temp_pathname->reset (xstrdup (found->c_str ()));
+ return (fd);
}
+void _initialize_kld_target(void);
void
_initialize_kld_target(void)
{
Modified: head/devel/gdb/files/kgdb/fbsd-kthr.c
==============================================================================
--- head/devel/gdb/files/kgdb/fbsd-kthr.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/fbsd-kthr.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -340,27 +340,27 @@ kgdb_thr_next(struct kthr *kt)
const char *
kgdb_thr_extra_thread_info(int tid)
{
- char comm[MAXCOMLEN + 1];
- char td_name[MAXCOMLEN + 1];
- struct kthr *kt;
- static char buf[64];
+ static char buf[64];
- kt = kgdb_thr_lookup_tid(tid);
- if (kt == NULL)
- return (NULL);
- snprintf(buf, sizeof(buf), "PID=%d", kt->pid);
- try {
- read_memory_string (kt->paddr + proc_off_p_comm, comm,
- sizeof(comm));
- strlcat(buf, ": ", sizeof(buf));
- strlcat(buf, comm, sizeof(buf));
- read_memory_string (kt->kaddr + thread_off_td_name, td_name,
- sizeof(td_name));
- if (strcmp(comm, td_name) != 0) {
- strlcat(buf, "/", sizeof(buf));
- strlcat(buf, td_name, sizeof(buf));
- }
- } catch (const gdb_exception_error &e) {
+ struct kthr *kt = kgdb_thr_lookup_tid(tid);
+ if (kt == nullptr)
+ return (nullptr);
+
+ snprintf(buf, sizeof (buf), "PID=%d", kt->pid);
+ gdb::unique_xmalloc_ptr<char> comm
+ = target_read_string (kt->paddr + proc_off_p_comm, MAXCOMLEN + 1);
+ if (comm != nullptr)
+ {
+ strlcat(buf, ": ", sizeof (buf));
+ strlcat(buf, comm.get (), sizeof (buf));
+
+ gdb::unique_xmalloc_ptr<char> td_name
+ = target_read_string (kt->kaddr + thread_off_td_name, MAXCOMLEN + 1);
+ if (td_name != nullptr && strcmp (comm.get (), td_name.get ()) != 0)
+ {
+ strlcat(buf, "/", sizeof (buf));
+ strlcat(buf, td_name.get (), sizeof (buf));
}
- return (buf);
+ }
+ return (buf);
}
Modified: head/devel/gdb/files/kgdb/fbsd-kvm.c
==============================================================================
--- head/devel/gdb/files/kgdb/fbsd-kvm.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/fbsd-kvm.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -186,11 +186,13 @@ fbsd_kernel_osabi_sniffer(bfd *abfd)
&osabi);
/*
- * aarch64 kernels don't have the right note tag for
- * kernels so just look for /red/herring anyway.
+ * aarch64 and RISC-V kernels don't have the right
+ * note tag for kernels so just look for /red/herring
+ * anyway.
*/
if (osabi == GDB_OSABI_UNKNOWN &&
- elf_elfheader(abfd)->e_machine == EM_AARCH64)
+ ((elf_elfheader(abfd)->e_machine == EM_AARCH64) ||
+ (elf_elfheader(abfd)->e_machine == EM_RISCV)))
break;
if (osabi != GDB_OSABI_FREEBSD)
return (GDB_OSABI_UNKNOWN);
@@ -249,7 +251,7 @@ class fbsd_kvm_target final : public process_stratum_t
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
- bool has_execution (ptid_t) override { return false; }
+ bool has_execution (inferior *inf) override { return false; }
};
/* Target ops for libkvm interface. */
@@ -405,14 +407,16 @@ fbsd_kvm_target_open (const char *args, int from_tty)
inf->fake_pid_p = 1;
}
solib_create_inferior_hook(0);
- init_thread_list();
kt = kgdb_thr_init(ops->cpu_pcb_addr);
+ thread_info *curthr = nullptr;
while (kt != NULL) {
- add_thread_silent(fbsd_vmcore_ptid(kt->tid));
+ thread_info *thr = add_thread_silent(&fbsd_kvm_ops,
+ fbsd_vmcore_ptid(kt->tid));
+ if (kt == curkthr)
+ curthr = thr;
kt = kgdb_thr_next(kt);
}
- if (curkthr != 0)
- inferior_ptid = fbsd_vmcore_ptid(curkthr->tid);
+ switch_to_thread (curthr);
target_fetch_registers (get_current_regcache (), -1);
@@ -434,7 +438,8 @@ fbsd_kvm_target::close()
vmcore = NULL;
}
- inferior_ptid = null_ptid;
+ switch_to_no_thread ();
+ exit_inferior_silent (current_inferior ());
}
#if 0
@@ -530,7 +535,7 @@ fbsd_kvm_target::fetch_registers(struct regcache *regc
if (ops->supply_pcb == NULL)
return;
- kt = kgdb_thr_lookup_tid(inferior_ptid.tid());
+ kt = kgdb_thr_lookup_tid(regcache->ptid().tid());
if (kt == NULL)
return;
ops->supply_pcb(regcache, kt->pcb);
@@ -590,7 +595,7 @@ kgdb_switch_to_thread(const char *arg, int tid)
{
struct thread_info *tp;
- tp = find_thread_ptid (fbsd_vmcore_ptid (tid));
+ tp = find_thread_ptid (&fbsd_kvm_ops, fbsd_vmcore_ptid (tid));
if (tp == NULL)
error ("invalid tid");
thread_select (arg, tp);
@@ -642,11 +647,13 @@ kgdb_set_tid_cmd (const char *arg, int from_tty)
kgdb_switch_to_thread(arg, addr);
}
+void _initialize_kgdb_target(void);
void
_initialize_kgdb_target(void)
{
- add_target(fbsd_kvm_target_info, fbsd_kvm_target_open);
+ add_target(fbsd_kvm_target_info, fbsd_kvm_target_open,
+ filename_completer);
fbsd_vmcore_data = gdbarch_data_register_pre_init(fbsd_vmcore_init);
Modified: head/devel/gdb/files/kgdb/i386fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/i386fbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/i386fbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -467,6 +467,7 @@ i386fbsd_kernel_init_abi(struct gdbarch_info info, str
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb);
}
+void _initialize_i386_kgdb_tdep(void);
void
_initialize_i386_kgdb_tdep(void)
{
Modified: head/devel/gdb/files/kgdb/mipsfbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/mipsfbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/mipsfbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -25,11 +25,10 @@
* 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
+ *
+ * $FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c 249878 2013-04-25 04:53:01Z imp $
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c 249878 2013-04-25 04:53:01Z imp $");
-
#include "defs.h"
#include "frame-unwind.h"
#include "osabi.h"
@@ -286,6 +285,7 @@ mipsfbsd_kernel_init_abi (struct gdbarch_info info, st
fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb);
}
+void _initialize_mips_kgdb_tdep(void);
void
_initialize_mips_kgdb_tdep (void)
{
Modified: head/devel/gdb/files/kgdb/ppcfbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/ppcfbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/ppcfbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -240,6 +240,7 @@ ppcfbsd_kernel_init_abi(struct gdbarch_info info, stru
}
}
+void _initialize_ppc_kgdb_tdep(void);
void
_initialize_ppc_kgdb_tdep(void)
{
Modified: head/devel/gdb/files/kgdb/riscv-fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/riscv-fbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/riscv-fbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -49,11 +49,8 @@ static const struct regcache_map_entry riscv_fbsd_pcbm
{ 1, RISCV_SP_REGNUM, 0 },
{ 1, RISCV_GP_REGNUM, 0 },
{ 1, RISCV_TP_REGNUM, 0 },
- { 3, 5, 0 }, /* t0 - t2 */
- { 4, 28, 0 }, /* t3 - t6 */
{ 2, RISCV_FP_REGNUM, 0 }, /* s0 - s1 */
{ 10, 18, 0 }, /* s2 - s11 */
- { 8, RISCV_A0_REGNUM, 0 }, /* a0 - a7 */
{ 0 }
};
@@ -66,7 +63,7 @@ static const struct regset riscv_fbsd_pcbregset =
static void
riscv_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
{
- gdb_byte buf[31 * 8];
+ gdb_byte buf[16 * riscv_abi_xlen (regcache->arch ())];
/* Always give a value for PC in case the PCB isn't readable. */
regcache->raw_supply_zeroed (RISCV_PC_REGNUM);
Modified: head/devel/gdb/files/kgdb/sparc64fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/kgdb/sparc64fbsd-kern.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -303,6 +303,7 @@ sparc64fbsd_kernel_init_abi(struct gdbarch_info info,
#endif
}
+void _initialize_sparc64_kgdb_tdep(void);
void
_initialize_sparc64_kgdb_tdep(void)
{
Modified: head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c
==============================================================================
--- head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c Fri Dec 4 22:46:44 2020 (r557027)
+++ head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c Fri Dec 4 23:19:27 2020 (r557028)
@@ -14,17 +14,17 @@
struct reg regs;
+ register_t old_rflags;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
+ if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
+ old_rflags = regs.r_rflags;
amd64_collect_native_gregset (regcache, ®s, regnum);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-ports-all
mailing list