Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Re: Update to gdb-13.2 - tests wanted
To:
George Koehler <kernigh@gmail.com>
Cc:
ports@openbsd.org, Pascal Stumpf <pascal@stumpf.co>, tb@openbsd.org, gkoehler@openbsd.org, kettenis@openbsd.org, miod@openbsd.org, visa@openbsd.org
Date:
Sat, 9 Nov 2024 11:50:12 +0100

Download raw body.

Thread
  • George Koehler:

    Update to gdb-13.2 - tests wanted

  • On Sat, Nov 09, 2024 at 12:57:56AM -0500, George Koehler wrote:
    > On Fri, 8 Nov 2024 14:03:17 +0100
    > Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
    > 
    > > I can't infer from gkoehler's report and yours whether 32 bits powerpc
    > > support is fine.
    > 
    > It was fine until I tried switching threads.  gdb-13.2 on powerpc gets
    > registers from only the 1st thread, so thread switches have the wrong
    > registers and backtrace.  A fix might be to change
    > 	regcache->ptid ().pid()
    > to
    > 	get_ptrace_pid (regcache->ptid ())
    > to match other archs, which I will try later, when I have a few hours
    > to rebuild gdb.
    
    Ah, yes, that's definitely something we want to fix on all platforms.
    But that's not a regression introduced by 13.2, and I suggest you
    handle this in a subsequent commit.
    
    > On powerpc64, gdb-13.2 refusing to run programs or load core dumps was
    > a regression from 9.2.  I have edited my ppc64-obsd-*.c and my 13.2 now
    > works about as well as 9.2, so I will mail my patches later.
    
    That's great.  As far as I know, besides arm native support, it is the
    last missing piece for this update.  I propose I commit this update,
    and then you add your runtime fix for powerpc64 on top.  And I'll
    handle arm later, as time permits.
    
    kettenis@ has confirmed that using the latest diff, gdb compiles on arm
    but with no runtime support.  Here's the diff again for convenience.
    (~jca/p/gdb-13-jca9.diff)
    
    ok?
    
    
    Index: Makefile
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/Makefile,v
    diff -u -p -r1.85 Makefile
    --- Makefile	1 Oct 2024 07:41:42 -0000	1.85
    +++ Makefile	8 Nov 2024 17:11:35 -0000
    @@ -1,8 +1,7 @@
     COMMENT=	GNU debugger
     CATEGORIES=	devel
     
    -DISTNAME=	gdb-9.2
    -REVISION=	7
    +DISTNAME=	gdb-13.2
     
     HOMEPAGE=	https://www.gnu.org/software/gdb/
     
    @@ -17,7 +16,8 @@ EXTRACT_SUFX=	.tar.xz
     
     MODGNU_CONFIG_GUESS_DIRS=	${WRKSRC} ${WRKSRC}/gdb
     
    -WANTLIB = c curses expat kvm intl m pthread ${MODPY_WANTLIB} ${COMPILER_LIBCXX} util
    +WANTLIB += ${MODPY_WANTLIB} ${COMPILER_LIBCXX}
    +WANTLIB += c curses expat gmp kvm iconv intl m pthread util zstd
     
     DEBUG_PACKAGES=	${BUILD_PACKAGES}
     
    @@ -29,23 +29,25 @@ CONFIGURE_STYLE=gnu
     CONFIGURE_ARGS=	--program-prefix=e \
     		--disable-nls \
     		--disable-sim \
    -		--without-gmp \
     		--without-guile \
     		--without-isl \
     		--without-lzma \
     		--without-mpc \
     		--without-mpfr \
    +		--with-libgmp-type=shared \
     		--with-auto-load-dir=${TRUEPREFIX}/share/gdb/auto-load \
     		--enable-target=all \
     		--with-python=${MODPY_BIN}
     
     USE_GMAKE=	Yes
    -MAKE_FLAGS=	V=1 LDFLAGS="${LDFLAGS}"
    +MAKE_FLAGS=	V=1 LDFLAGS="-L${LOCALBASE}/lib ${LDFLAGS}"
     
     MODULES +=	lang/python
     
     BUILD_DEPENDS =	sysutils/xxhash
    -LIB_DEPENDS +=	${MODPY_LIB_DEPENDS}
    +LIB_DEPENDS +=	${MODPY_LIB_DEPENDS} \
    +		archivers/zstd \
    +		devel/gmp,-main
     TEST_DEPENDS +=	devel/dejagnu
     
     post-install:
    Index: distinfo
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/distinfo,v
    diff -u -p -r1.23 distinfo
    --- distinfo	22 Oct 2021 18:30:35 -0000	1.23
    +++ distinfo	8 Nov 2024 15:50:17 -0000
    @@ -1,2 +1,2 @@
    -SHA256 (gdb/gdb-9.2.tar.xz) = NgzXrnm3dpiOidj5oByYXQsfohx2ekKV5fiMtJF1xVU=
    -SIZE (gdb/gdb-9.2.tar.xz) = 20979436
    +SHA256 (gdb/gdb-13.2.tar.xz) = /Vvrt74YM6vbbgI8L0mKNUSYKB350FUj2JFbq+uJPwo=
    +SIZE (gdb/gdb-13.2.tar.xz) = 23664644
    Index: patches/patch-bfd_coff-rs6000_c
    ===================================================================
    RCS file: patches/patch-bfd_coff-rs6000_c
    diff -N patches/patch-bfd_coff-rs6000_c
    --- patches/patch-bfd_coff-rs6000_c	11 Mar 2022 18:50:04 -0000	1.4
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,10 +0,0 @@
    ---- bfd/coff-rs6000.c.orig	Tue Jul 29 14:37:42 2014
    -+++ bfd/coff-rs6000.c	Tue Jul 29 20:27:50 2014
    -@@ -26,6 +26,7 @@
    - #include "bfd.h"
    - #include "bfdlink.h"
    - #include "libbfd.h"
    -+#include "bfd_stdint.h"
    - #include "coff/internal.h"
    - #include "coff/xcoff.h"
    - #include "coff/rs6000.h"
    Index: patches/patch-bfd_config_bfd
    ===================================================================
    RCS file: patches/patch-bfd_config_bfd
    diff -N patches/patch-bfd_config_bfd
    --- patches/patch-bfd_config_bfd	11 Mar 2022 18:50:04 -0000	1.5
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,32 +0,0 @@
    -Index: bfd/config.bfd
    ---- bfd/config.bfd.orig
    -+++ bfd/config.bfd
    -@@ -81,7 +81,6 @@ case $targ in
    -  arm*-*-aout | \
    -  arm-*-coff | \
    -  arm-*-netbsd* | \
    -- arm-*-openbsd* | \
    -  arm-*-oabi | \
    -  arm-*-riscix* | \
    -  arm-epoc-pe* | \
    -@@ -257,6 +256,11 @@ case "${targ}" in
    -     targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
    -     want64=true
    -     ;;
    -+  aarch64-*-openbsd*)
    -+    targ_defvec=aarch64_elf64_le_vec
    -+    targ_selvecs="aarch64_elf32_le_vec arm_elf32_le_vec"
    -+    want64=true
    -+    ;;
    -   aarch64_be-*-linux*)
    -     targ_defvec=aarch64_elf64_be_vec
    -     targ_selvecs="aarch64_elf64_le_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_be_vec arm_elf32_le_vec"
    -@@ -352,7 +356,7 @@ case "${targ}" in
    -     targ_defvec=arm_elf32_be_vec
    -     targ_selvecs="arm_elf32_le_vec"
    -     ;;
    --  arm-*-netbsdelf*)
    -+  arm-*-netbsdelf* | arm-*-openbsd*)
    -     targ_defvec=arm_elf32_le_vec
    -     targ_selvecs="arm_elf32_be_vec"
    -     ;;
    Index: patches/patch-bfd_elf_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-bfd_elf_c,v
    diff -u -p -r1.12 patch-bfd_elf_c
    --- patches/patch-bfd_elf_c	10 Jun 2023 19:19:12 -0000	1.12
    +++ patches/patch-bfd_elf_c	8 Nov 2024 15:50:17 -0000
    @@ -1,8 +1,8 @@
     Index: bfd/elf.c
     --- bfd/elf.c.orig
     +++ bfd/elf.c
    -@@ -10758,6 +10758,11 @@ elfcore_grok_openbsd_procinfo (bfd *abfd, Elf_Internal
    - static bfd_boolean
    +@@ -11438,6 +11438,11 @@ elfcore_grok_solaris_note (bfd *abfd, Elf_Internal_Not
    + static bool
      elfcore_grok_openbsd_note (bfd *abfd, Elf_Internal_Note *note)
      {
     +  int lwp;
    @@ -13,13 +13,13 @@ Index: bfd/elf.c
        if (note->type == NT_OPENBSD_PROCINFO)
          return elfcore_grok_openbsd_procinfo (abfd, note);
      
    -@@ -10786,6 +10791,9 @@ elfcore_grok_openbsd_note (bfd *abfd, Elf_Internal_Not
    +@@ -11466,6 +11471,9 @@ elfcore_grok_openbsd_note (bfd *abfd, Elf_Internal_Not
      
    -       return TRUE;
    +       return true;
          }
     +
     +  if (note->type == NT_OPENBSD_PACMASK)
     +    return elfcore_make_note_pseudosection (abfd, ".reg-aarch-pauth", note);
      
    -   return TRUE;
    +   return true;
      }
    Index: patches/patch-bfd_peXXigen_c
    ===================================================================
    RCS file: patches/patch-bfd_peXXigen_c
    diff -N patches/patch-bfd_peXXigen_c
    --- patches/patch-bfd_peXXigen_c	11 Mar 2022 18:50:04 -0000	1.8
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,22 +0,0 @@
    -Fix out-of-bounds memcpys (FILNMLEN is 18, sizeof x_fname is 14).
    -Index: bfd/peXXigen.c
    ---- bfd/peXXigen.c.orig
    -+++ bfd/peXXigen.c
    -@@ -318,7 +318,7 @@ _bfd_XXi_swap_aux_in (bfd *	abfd,
    - 	  in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
    - 	}
    -       else
    --	memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
    -+	memcpy (in->x_file.x_fname, ext->x_file.x_fname, sizeof in->x_file.x_fname);
    -       return;
    - 
    -     case C_STAT:
    -@@ -392,7 +392,7 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
    - 	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
    - 	}
    -       else
    --	memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
    -+	memcpy (ext->x_file.x_fname, in->x_file.x_fname, sizeof ext->x_file.x_fname);
    - 
    -       return AUXESZ;
    - 
    Index: patches/patch-gdb_Makefile_in
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_Makefile_in,v
    diff -u -p -r1.5 patch-gdb_Makefile_in
    --- patches/patch-gdb_Makefile_in	11 Mar 2022 18:50:04 -0000	1.5
    +++ patches/patch-gdb_Makefile_in	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,11 @@
    +
    +Add support for aarch64, powerpc64 and riscv64.
    +TODO Use OpenBSD-specific files for arm.
    +
     Index: gdb/Makefile.in
     --- gdb/Makefile.in.orig
     +++ gdb/Makefile.in
    -@@ -651,6 +651,7 @@ ALL_64_TARGET_OBS = \
    +@@ -699,6 +699,7 @@ ALL_64_TARGET_OBS = \
      	aarch64-fbsd-tdep.o \
      	aarch64-linux-tdep.o \
      	aarch64-newlib-tdep.o \
    @@ -9,23 +13,23 @@ Index: gdb/Makefile.in
      	aarch64-ravenscar-thread.o \
      	aarch64-tdep.o \
      	alpha-bsd-tdep.o \
    -@@ -675,6 +676,7 @@ ALL_64_TARGET_OBS = \
    - 	ia64-tdep.o \
    - 	ia64-vms-tdep.o \
    - 	mips64-obsd-tdep.o \
    +@@ -737,6 +738,7 @@ ALL_64_TARGET_OBS = \
    + 	riscv-fbsd-tdep.o \
    + 	riscv-linux-tdep.o \
    + 	riscv-none-tdep.o \
     +	riscv-obsd-tdep.o \
    + 	riscv-ravenscar-thread.o \
    + 	riscv-tdep.o \
      	sparc64-fbsd-tdep.o \
    - 	sparc64-linux-tdep.o \
    - 	sparc64-nbsd-tdep.o \
    -@@ -1381,6 +1383,7 @@ HFILES_NO_SRCDIR = \
    - 	remote-notif.h \
    +@@ -1436,6 +1438,7 @@ HFILES_NO_SRCDIR = \
      	riscv-fbsd-tdep.h \
    + 	riscv-ravenscar-thread.h \
      	riscv-tdep.h \
     +	riscv-obsd-tdep.h \
      	rs6000-aix-tdep.h \
    - 	rs6000-tdep.h \
      	run-on-main-thread.h \
    -@@ -2157,6 +2160,8 @@ ALLDEPFILES = \
    + 	s390-linux-tdep.h \
    +@@ -1627,6 +1630,8 @@ ALLDEPFILES = \
      	aarch64-linux-nat.c \
      	aarch64-linux-tdep.c \
      	aarch64-newlib-tdep.c \
    @@ -34,12 +38,12 @@ Index: gdb/Makefile.in
      	aarch64-ravenscar-thread.c \
      	aarch64-tdep.c \
      	aix-thread.c \
    -@@ -2300,6 +2305,8 @@ ALLDEPFILES = \
    - 	riscv-linux-nat.c \
    - 	riscv-linux-tdep.c \
    +@@ -1776,6 +1781,8 @@ ALLDEPFILES = \
    + 	riscv-none-tdep.c \
    + 	riscv-ravenscar-thread.c \
      	riscv-tdep.c \
     +	riscv-obsd-nat.c \
     +	riscv-obsd-tdep.c \
      	rl78-tdep.c \
    + 	rs6000-aix-nat.c \
      	rs6000-lynx178-tdep.c \
    - 	rs6000-nat.c \
    Index: patches/patch-gdb_aarch64-obsd-nat_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_aarch64-obsd-nat_c,v
    diff -u -p -r1.3 patch-gdb_aarch64-obsd-nat_c
    --- patches/patch-gdb_aarch64-obsd-nat_c	10 Jun 2023 19:19:12 -0000	1.3
    +++ patches/patch-gdb_aarch64-obsd-nat_c	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/aarch64-obsd-nat.c
     --- gdb/aarch64-obsd-nat.c.orig
     +++ gdb/aarch64-obsd-nat.c
    -@@ -0,0 +1,162 @@
    +@@ -0,0 +1,170 @@
     +/* Native-dependent code for OpenBSD/aarch64.
     +
     +   Copyright (C) 2017-2020 Free Software Foundation, Inc.
    @@ -27,6 +27,7 @@ Index: gdb/aarch64-obsd-nat.c
     +#include "target.h"
     +
     +#include <sys/types.h>
    ++#include <sys/auxv.h>
     +#include <sys/ptrace.h>
     +#include <machine/reg.h>
     +
    @@ -69,7 +70,8 @@ Index: gdb/aarch64-obsd-nat.c
     +					  int regnum)
     +{
     +#ifdef PT_PACMASK
    -+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
    ++  gdbarch *gdbarch = regcache->arch ();
    ++  aarch64_gdbarch_tdep *tdep = gdbarch_tdep <aarch64_gdbarch_tdep> (gdbarch);
     +#endif
     +  pid_t pid = get_ptrace_pid (regcache->ptid ());
     +
    @@ -156,11 +158,19 @@ Index: gdb/aarch64-obsd-nat.c
     +const struct target_desc *
     +aarch64_obsd_nat_target::read_description ()
     +{
    -+  return aarch64_read_description(0, true);
    ++  aarch64_features features;
    ++  unsigned long hwcap;
    ++
    ++  if (elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap) == 0)
    ++    features.pauth = hwcap & HWCAP_PACA;
    ++
    ++  return aarch64_read_description (features);
     +}
     +
     +void
    -+_initialize_aarch64_obsd_nat (void)
    ++_initialize_aarch64_obsd_nat ()
     +{
     +  add_inf_child_target (&the_aarch64_obsd_nat_target);
     +}
    +
    +
    Index: patches/patch-gdb_aarch64-obsd-tdep_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_aarch64-obsd-tdep_c,v
    diff -u -p -r1.3 patch-gdb_aarch64-obsd-tdep_c
    --- patches/patch-gdb_aarch64-obsd-tdep_c	10 Jun 2023 19:19:12 -0000	1.3
    +++ patches/patch-gdb_aarch64-obsd-tdep_c	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/aarch64-obsd-tdep.c
     --- gdb/aarch64-obsd-tdep.c.orig
     +++ gdb/aarch64-obsd-tdep.c
    -@@ -0,0 +1,334 @@
    +@@ -0,0 +1,338 @@
     +/* Target-dependent code for OpenBSD/aarch64.
     +
     +   Copyright (C) 2006-2017 Free Software Foundation, Inc.
    @@ -59,7 +59,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +
     +static int
     +aarch64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
    -+				    struct frame_info *this_frame,
    ++				    frame_info_ptr this_frame,
     +				    void **this_cache)
     +{
     +  struct gdbarch *gdbarch = get_frame_arch (this_frame);
    @@ -78,8 +78,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +      gdb_byte buf[8];
     +      unsigned long insn;
     +
    -+      if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
    -+				     buf, sizeof buf))
    ++      if (!safe_frame_unwind_memory (this_frame, start_pc + *offset, buf))
     +	continue;
     +
     +      /* Check for "mov x8, #SYS_sigreturn".  */
    @@ -134,10 +133,10 @@ Index: gdb/aarch64-obsd-tdep.c
     +#define AARCH64_SIGCONTEXT_X0_OFFSET		40
     +
     +static struct trad_frame_cache *
    -+aarch64obsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
    ++aarch64obsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
     +{
     +  struct gdbarch *gdbarch = get_frame_arch (this_frame);
    -+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
    ++  aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
     +  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
     +  struct trad_frame_cache *cache;
     +  CORE_ADDR sp, sigcontext_addr, x0_addr, func;
    @@ -153,7 +152,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +
     +  func = get_frame_pc (this_frame);
     +  func &= ~(aarch64obsd_page_size - 1);
    -+  if (!safe_frame_unwind_memory (this_frame, func, buf, sizeof buf))
    ++  if (!safe_frame_unwind_memory (this_frame, func, buf))
     +    return cache;
     +
     +  /* Calculate the offset where we can find `struct sigframe'.  In 6.1
    @@ -188,7 +187,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +}
     +
     +static void
    -+aarch64obsd_sigtramp_frame_this_id (struct frame_info *this_frame,
    ++aarch64obsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
     +				    void **this_cache,
     +				    struct frame_id *this_id)
     +{
    @@ -199,7 +198,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +}
     +
     +static struct value *
    -+aarch64obsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
    ++aarch64obsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
     +				      void **this_cache, int regnum)
     +{
     +  struct trad_frame_cache *cache =
    @@ -209,6 +208,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +}
     +
     +static const struct frame_unwind aarch64obsd_sigtramp_frame_unwind = {
    ++  "aarch64 openbsd tramp",
     +  SIGTRAMP_FRAME,
     +  default_frame_unwind_stop_reason,
     +  aarch64obsd_sigtramp_frame_this_id,
    @@ -268,7 +268,7 @@ Index: gdb/aarch64-obsd-tdep.c
     +					   void *cb_data,
     +					   const struct regcache *regcache)
     +{
    -+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
    ++  aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
     +
     +  cb (".reg", AARCH64_OBSD_SIZEOF_GREGSET, AARCH64_OBSD_SIZEOF_GREGSET,
     +      &aarch64_obsd_gregset, NULL, cb_data);
    @@ -299,14 +299,19 @@ Index: gdb/aarch64-obsd-tdep.c
     +aarch64_obsd_core_read_description (struct gdbarch *gdbarch,
     +				    struct target_ops *target, bfd *abfd)
     +{
    -+  return aarch64_read_description (0, true);
    ++  asection *pauth = bfd_get_section_by_name (abfd, ".reg-aarch-pauth");
    ++
    ++  aarch64_features features;
    ++  features.pauth = pauth != nullptr ? 1 : 0;
    ++
    ++  return aarch64_read_description (features);
     +}
     +␌
     +
     +static void
     +aarch64obsd_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);
     +
     +  obsd_init_abi (info, gdbarch);
     +
    @@ -327,12 +332,12 @@ Index: gdb/aarch64-obsd-tdep.c
     +}
     +␌
     +
    -+/* Provide a prototype to silence -Wmissing-prototypes.  */
    -+extern initialize_file_ftype _initialize_aarch64obsd_tdep;
    ++void _initialize_aarch64_obsd_tdep ();
     +
     +void
    -+_initialize_aarch64obsd_tdep (void)
    ++_initialize_aarch64_obsd_tdep ()
     +{
     +  gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_OPENBSD,
     +			  aarch64obsd_init_abi);
     +}
    +
    Index: patches/patch-gdb_amd64-obsd-tdep_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_amd64-obsd-tdep_c,v
    diff -u -p -r1.3 patch-gdb_amd64-obsd-tdep_c
    --- patches/patch-gdb_amd64-obsd-tdep_c	10 Dec 2023 12:06:58 -0000	1.3
    +++ patches/patch-gdb_amd64-obsd-tdep_c	8 Nov 2024 15:50:17 -0000
    @@ -47,7 +47,7 @@ Index: gdb/amd64-obsd-tdep.c
      /* Return whether THIS_FRAME corresponds to an OpenBSD sigtramp
         routine.  */
      
    -@@ -49,20 +85,8 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
    +@@ -49,20 +85,8 @@ amd64obsd_sigtramp_p (frame_info_ptr this_frame)
      {
        CORE_ADDR pc = get_frame_pc (this_frame);
        CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
    @@ -70,19 +70,19 @@ Index: gdb/amd64-obsd-tdep.c
        const char *name;
      
        /* If the function has a valid symbol name, it isn't a
    -@@ -76,22 +100,21 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
    +@@ -76,22 +100,21 @@ amd64obsd_sigtramp_p (frame_info_ptr this_frame)
        if (find_pc_section (pc) != NULL)
          return 0;
      
     -  /* If we can't read the instructions at START_PC, return zero.  */
     -  buf = (gdb_byte *) alloca ((sizeof sigreturn) + 1);
    --  if (!safe_frame_unwind_memory (this_frame, start_pc + 6, buf, buflen))
    +-  if (!safe_frame_unwind_memory (this_frame, start_pc + 6, {buf, buflen}))
     -    return 0;
     +  for (info = amd64obsd_sigreturn_info; info->offset != -1; info++)
     +    {
     +      /* If we can't read the instructions, return zero.  */
     +      if (!safe_frame_unwind_memory (this_frame,
    -+        start_pc + info->offset, buf, sizeof buf))
    ++        start_pc + info->offset, buf))
     +        continue;
      
     -  /* Check for sigreturn(2).  Depending on how the assembler encoded
    @@ -107,7 +107,7 @@ Index: gdb/amd64-obsd-tdep.c
      
      /* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
     @@ -101,7 +124,10 @@ static CORE_ADDR
    - amd64obsd_sigcontext_addr (struct frame_info *this_frame)
    + amd64obsd_sigcontext_addr (frame_info_ptr this_frame)
      {
        CORE_ADDR pc = get_frame_pc (this_frame);
     +  CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
    @@ -117,7 +117,7 @@ Index: gdb/amd64-obsd-tdep.c
      
        /* The %rsp register points at `struct sigcontext' upon entry of a
           signal trampoline.  The relevant part of the trampoline is
    -@@ -115,10 +141,22 @@ amd64obsd_sigcontext_addr (struct frame_info *this_fra
    +@@ -115,10 +141,22 @@ amd64obsd_sigcontext_addr (frame_info_ptr this_frame)
           (see /usr/src/sys/arch/amd64/amd64/locore.S).  The `pushq'
           instruction clobbers %rsp, but its value is saved in `%rdi'.  */
      
    @@ -129,7 +129,7 @@ Index: gdb/amd64-obsd-tdep.c
     +    {
     +      /* If we can't read the instructions, return %rsp.  */
     +      if (!safe_frame_unwind_memory (this_frame,
    -+        start_pc + info->offset, buf, sizeof buf))
    ++        start_pc + info->offset, buf))
     +        continue;
     +
     +      /* Check for sigreturn(2).  */
    Index: patches/patch-gdb_arm-nbsd-nat_c
    ===================================================================
    RCS file: patches/patch-gdb_arm-nbsd-nat_c
    diff -N patches/patch-gdb_arm-nbsd-nat_c
    --- patches/patch-gdb_arm-nbsd-nat_c	11 Mar 2022 18:50:04 -0000	1.2
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,76 +0,0 @@
    -Index: gdb/arm-nbsd-nat.c
    ---- gdb/arm-nbsd-nat.c.orig
    -+++ gdb/arm-nbsd-nat.c
    -@@ -69,9 +69,9 @@ arm_supply_fparegset (struct regcache *regcache, struc
    - 
    -   for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
    -     regcache->raw_supply (regno,
    --			  (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
    -+			  (char *) &fparegset->fp_reg[regno - ARM_F0_REGNUM]);
    - 
    --  regcache->raw_supply (ARM_FPS_REGNUM, (char *) &fparegset->fpr_fpsr);
    -+  regcache->raw_supply (ARM_FPS_REGNUM, (char *) &fparegset->fp_scr);
    - }
    - 
    - static void
    -@@ -160,12 +160,12 @@ fetch_fp_register (struct regcache *regcache, int regn
    -     {
    -     case ARM_FPS_REGNUM:
    -       regcache->raw_supply (ARM_FPS_REGNUM,
    --			    (char *) &inferior_fp_registers.fpr_fpsr);
    -+			    (char *) &inferior_fp_registers.fp_scr);
    -       break;
    - 
    -     default:
    -       regcache->raw_supply
    --	(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
    -+	(regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    -       break;
    -     }
    - }
    -@@ -190,7 +190,7 @@ fetch_fp_regs (struct regcache *regcache)
    - }
    - 
    - void
    --arm_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
    -+arm_netbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
    - {
    -   if (regno >= 0)
    -     {
    -@@ -340,12 +340,12 @@ store_fp_register (const struct regcache *regcache, in
    -     {
    -     case ARM_FPS_REGNUM:
    -       regcache->raw_collect (ARM_FPS_REGNUM,
    --			     (char *) &inferior_fp_registers.fpr_fpsr);
    -+			     (char *) &inferior_fp_registers.fp_scr);
    -       break;
    - 
    -     default:
    -       regcache->raw_collect
    --	(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
    -+	(regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    -       break;
    -     }
    - 
    -@@ -366,10 +366,10 @@ store_fp_regs (const struct regcache *regcache)
    - 
    -   for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
    -     regcache->raw_collect
    --      (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
    -+      (regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    - 
    -   regcache->raw_collect (ARM_FPS_REGNUM,
    --			 (char *) &inferior_fp_registers.fpr_fpsr);
    -+			 (char *) &inferior_fp_registers.fp_scr);
    - 
    -   ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
    - 		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    -@@ -379,7 +379,7 @@ store_fp_regs (const struct regcache *regcache)
    - }
    - 
    - void
    --arm_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
    -+arm_netbsd_nat_target::store_registers (struct regcache *regcache, int regno)
    - {
    -   if (regno >= 0)
    -     {
    Index: patches/patch-gdb_arm-obsd-nat_c
    ===================================================================
    RCS file: patches/patch-gdb_arm-obsd-nat_c
    diff -N patches/patch-gdb_arm-obsd-nat_c
    --- /dev/null	1 Jan 1970 00:00:00 -0000
    +++ patches/patch-gdb_arm-obsd-nat_c	8 Nov 2024 15:50:17 -0000
    @@ -0,0 +1,428 @@
    +
    +TODO Reinstate OpenBSD/arm native support.
    +
    +Index: gdb/arm-obsd-nat.c
    +--- gdb/arm-obsd-nat.c.orig
    ++++ gdb/arm-obsd-nat.c
    +@@ -0,0 +1,421 @@
    ++/* Native-dependent code for BSD Unix running on ARM's, for GDB.
    ++
    ++   Copyright (C) 1988-2020 Free Software Foundation, Inc.
    ++
    ++   This file is part of GDB.
    ++
    ++   This program is free software; you can redistribute it and/or modify
    ++   it under the terms of the GNU General Public License as published by
    ++   the Free Software Foundation; either version 3 of the License, or
    ++   (at your option) any later version.
    ++
    ++   This program is distributed in the hope that it will be useful,
    ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
    ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ++   GNU General Public License for more details.
    ++
    ++   You should have received a copy of the GNU General Public License
    ++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    ++
    ++#include "defs.h"
    ++#include "gdbcore.h"
    ++#include "inferior.h"
    ++#include "regcache.h"
    ++#include "target.h"
    ++#include <sys/types.h>
    ++#include <sys/ptrace.h>
    ++#include <machine/reg.h>
    ++#include <machine/frame.h>
    ++
    ++#include "arm-tdep.h"
    ++#include "inf-ptrace.h"
    ++#include "obsd-nat.h"
    ++
    ++class arm_openbsd_nat_target final : public obsd_nat_target
    ++{
    ++public:
    ++  /* Add our register access methods.  */
    ++  void fetch_registers (struct regcache *, int) override;
    ++  void store_registers (struct regcache *, int) override;
    ++
    ++  const struct target_desc *read_description () override;
    ++};
    ++
    ++static arm_openbsd_nat_target the_arm_openbsd_nat_target;
    ++
    ++static void
    ++arm_supply_gregset (struct regcache *regcache, struct reg *gregset)
    ++{
    ++  int regno;
    ++  CORE_ADDR r_pc;
    ++
    ++  /* Integer registers.  */
    ++  for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
    ++    regcache->raw_supply (regno, (char *) &gregset->r[regno]);
    ++
    ++  regcache->raw_supply (ARM_SP_REGNUM, (char *) &gregset->r_sp);
    ++  regcache->raw_supply (ARM_LR_REGNUM, (char *) &gregset->r_lr);
    ++  /* This is ok: we're running native...  */
    ++  r_pc = gdbarch_addr_bits_remove (regcache->arch (), gregset->r_pc);
    ++  regcache->raw_supply (ARM_PC_REGNUM, (char *) &r_pc);
    ++
    ++  if (arm_apcs_32)
    ++    regcache->raw_supply (ARM_PS_REGNUM, (char *) &gregset->r_cpsr);
    ++  else
    ++    regcache->raw_supply (ARM_PS_REGNUM, (char *) &gregset->r_pc);
    ++}
    ++
    ++static void
    ++arm_supply_fparegset (struct regcache *regcache, struct fpreg *fparegset)
    ++{
    ++  int regno;
    ++
    ++  for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
    ++    regcache->raw_supply (regno,
    ++			  (char *) &fparegset->fp_reg[regno - ARM_F0_REGNUM]);
    ++
    ++  regcache->raw_supply (ARM_FPS_REGNUM, (char *) &fparegset->fp_scr);
    ++}
    ++
    ++static void
    ++fetch_register (struct regcache *regcache, int regno)
    ++{
    ++  struct reg inferior_registers;
    ++  int ret;
    ++
    ++  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch general register"));
    ++      return;
    ++    }
    ++
    ++  switch (regno)
    ++    {
    ++    case ARM_SP_REGNUM:
    ++      regcache->raw_supply (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
    ++      break;
    ++
    ++    case ARM_LR_REGNUM:
    ++      regcache->raw_supply (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
    ++      break;
    ++
    ++    case ARM_PC_REGNUM:
    ++      /* This is ok: we're running native...  */
    ++      inferior_registers.r_pc = gdbarch_addr_bits_remove
    ++				  (regcache->arch (),
    ++				   inferior_registers.r_pc);
    ++      regcache->raw_supply (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
    ++      break;
    ++
    ++    case ARM_PS_REGNUM:
    ++      if (arm_apcs_32)
    ++	regcache->raw_supply (ARM_PS_REGNUM,
    ++			      (char *) &inferior_registers.r_cpsr);
    ++      else
    ++	regcache->raw_supply (ARM_PS_REGNUM,
    ++			      (char *) &inferior_registers.r_pc);
    ++      break;
    ++
    ++    default:
    ++      regcache->raw_supply (regno, (char *) &inferior_registers.r[regno]);
    ++      break;
    ++    }
    ++}
    ++
    ++static void
    ++fetch_regs (struct regcache *regcache)
    ++{
    ++  struct reg inferior_registers;
    ++  int ret;
    ++  int regno;
    ++
    ++  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch general registers"));
    ++      return;
    ++    }
    ++
    ++  arm_supply_gregset (regcache, &inferior_registers);
    ++}
    ++
    ++static void
    ++fetch_fp_register (struct regcache *regcache, int regno)
    ++{
    ++  struct fpreg inferior_fp_registers;
    ++  int ret;
    ++
    ++  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch floating-point register"));
    ++      return;
    ++    }
    ++
    ++  switch (regno)
    ++    {
    ++    case ARM_FPS_REGNUM:
    ++      regcache->raw_supply (ARM_FPS_REGNUM,
    ++			    (char *) &inferior_fp_registers.fp_scr);
    ++      break;
    ++
    ++    default:
    ++      regcache->raw_supply
    ++	(regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    ++      break;
    ++    }
    ++}
    ++
    ++static void
    ++fetch_fp_regs (struct regcache *regcache)
    ++{
    ++  struct fpreg inferior_fp_registers;
    ++  int ret;
    ++  int regno;
    ++
    ++  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch general registers"));
    ++      return;
    ++    }
    ++
    ++  arm_supply_fparegset (regcache, &inferior_fp_registers);
    ++}
    ++
    ++void
    ++arm_openbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
    ++{
    ++  if (regno >= 0)
    ++    {
    ++      if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
    ++	fetch_register (regcache, regno);
    ++      else
    ++	fetch_fp_register (regcache, regno);
    ++    }
    ++  else
    ++    {
    ++      fetch_regs (regcache);
    ++      fetch_fp_regs (regcache);
    ++    }
    ++}
    ++
    ++
    ++static void
    ++store_register (const struct regcache *regcache, int regno)
    ++{
    ++  gdbarch *gdbarch = regcache->arch ();
    ++  struct reg inferior_registers;
    ++  int ret;
    ++
    ++  ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch general registers"));
    ++      return;
    ++    }
    ++
    ++  switch (regno)
    ++    {
    ++    case ARM_SP_REGNUM:
    ++      regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
    ++      break;
    ++
    ++    case ARM_LR_REGNUM:
    ++      regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
    ++      break;
    ++
    ++    case ARM_PC_REGNUM:
    ++      if (arm_apcs_32)
    ++	regcache->raw_collect (ARM_PC_REGNUM,
    ++			       (char *) &inferior_registers.r_pc);
    ++      else
    ++	{
    ++	  unsigned pc_val;
    ++
    ++	  regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val);
    ++	  
    ++	  pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
    ++	  inferior_registers.r_pc ^= gdbarch_addr_bits_remove
    ++				       (gdbarch, inferior_registers.r_pc);
    ++	  inferior_registers.r_pc |= pc_val;
    ++	}
    ++      break;
    ++
    ++    case ARM_PS_REGNUM:
    ++      if (arm_apcs_32)
    ++	regcache->raw_collect (ARM_PS_REGNUM,
    ++			       (char *) &inferior_registers.r_cpsr);
    ++      else
    ++	{
    ++	  unsigned psr_val;
    ++
    ++	  regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val);
    ++
    ++	  psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
    ++	  inferior_registers.r_pc = gdbarch_addr_bits_remove
    ++				      (gdbarch, inferior_registers.r_pc);
    ++	  inferior_registers.r_pc |= psr_val;
    ++	}
    ++      break;
    ++
    ++    default:
    ++      regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]);
    ++      break;
    ++    }
    ++
    ++  ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
    ++
    ++  if (ret < 0)
    ++    warning (_("unable to write register %d to inferior"), regno);
    ++}
    ++
    ++static void
    ++store_regs (const struct regcache *regcache)
    ++{
    ++  struct gdbarch *gdbarch = regcache->arch ();
    ++  struct reg inferior_registers;
    ++  int ret;
    ++  int regno;
    ++
    ++
    ++  for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
    ++    regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]);
    ++
    ++  regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
    ++  regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
    ++
    ++  if (arm_apcs_32)
    ++    {
    ++      regcache->raw_collect (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
    ++      regcache->raw_collect (ARM_PS_REGNUM,
    ++			     (char *) &inferior_registers.r_cpsr);
    ++    }
    ++  else
    ++    {
    ++      unsigned pc_val;
    ++      unsigned psr_val;
    ++
    ++      regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val);
    ++      regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val);
    ++	  
    ++      pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
    ++      psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
    ++
    ++      inferior_registers.r_pc = pc_val | psr_val;
    ++    }
    ++
    ++  ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_registers, 0);
    ++
    ++  if (ret < 0)
    ++    warning (_("unable to store general registers"));
    ++}
    ++
    ++static void
    ++store_fp_register (const struct regcache *regcache, int regno)
    ++{
    ++  struct fpreg inferior_fp_registers;
    ++  int ret;
    ++
    ++  ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    ++
    ++  if (ret < 0)
    ++    {
    ++      warning (_("unable to fetch floating-point registers"));
    ++      return;
    ++    }
    ++
    ++  switch (regno)
    ++    {
    ++    case ARM_FPS_REGNUM:
    ++      regcache->raw_collect (ARM_FPS_REGNUM,
    ++			     (char *) &inferior_fp_registers.fp_scr);
    ++      break;
    ++
    ++    default:
    ++      regcache->raw_collect
    ++	(regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    ++      break;
    ++    }
    ++
    ++  ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    ++
    ++  if (ret < 0)
    ++    warning (_("unable to write register %d to inferior"), regno);
    ++}
    ++
    ++static void
    ++store_fp_regs (const struct regcache *regcache)
    ++{
    ++  struct fpreg inferior_fp_registers;
    ++  int ret;
    ++  int regno;
    ++
    ++
    ++  for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
    ++    regcache->raw_collect
    ++      (regno, (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
    ++
    ++  regcache->raw_collect (ARM_FPS_REGNUM,
    ++			 (char *) &inferior_fp_registers.fp_scr);
    ++
    ++  ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
    ++		(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
    ++
    ++  if (ret < 0)
    ++    warning (_("unable to store floating-point registers"));
    ++}
    ++
    ++void
    ++arm_openbsd_nat_target::store_registers (struct regcache *regcache, int regno)
    ++{
    ++  if (regno >= 0)
    ++    {
    ++      if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
    ++	store_register (regcache, regno);
    ++      else
    ++	store_fp_register (regcache, regno);
    ++    }
    ++  else
    ++    {
    ++      store_regs (regcache);
    ++      store_fp_regs (regcache);
    ++    }
    ++}
    ++
    ++const struct target_desc *
    ++arm_openbsd_nat_target::read_description ()
    ++{
    ++#ifdef notyet
    ++/*
    ++ * XXX clang on OpenBSD/arm enables NEON by default
    ++ * Should we try to use that code path?
    ++ */
    ++  if (neon)
    ++    return aarch32_read_description ();
    ++#endif
    ++
    ++  return arm_read_description (ARM_FP_TYPE_VFPV3, false);
    ++}
    ++
    ++void _initialize_arm_openbsd_nat ();
    ++void
    ++_initialize_arm_openbsd_nat ()
    ++{
    ++  add_inf_child_target (&the_arm_openbsd_nat_target);
    ++}
    Index: patches/patch-gdb_cli_cli-cmds_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_cli_cli-cmds_c,v
    diff -u -p -r1.1 patch-gdb_cli_cli-cmds_c
    --- patches/patch-gdb_cli_cli-cmds_c	1 Oct 2024 07:41:42 -0000	1.1
    +++ patches/patch-gdb_cli_cli-cmds_c	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/cli/cli-cmds.c
     --- gdb/cli/cli-cmds.c.orig
     +++ gdb/cli/cli-cmds.c
    -@@ -956,7 +956,7 @@ edit_command (const char *arg, int from_tty)
    +@@ -1043,7 +1043,7 @@ edit_command (const char *arg, int from_tty)
          }
      
        if ((editor = getenv ("EDITOR")) == NULL)
    Index: patches/patch-gdb_configure_host
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_configure_host,v
    diff -u -p -r1.4 patch-gdb_configure_host
    --- patches/patch-gdb_configure_host	11 Mar 2022 18:50:04 -0000	1.4
    +++ patches/patch-gdb_configure_host	8 Nov 2024 15:50:17 -0000
    @@ -1,16 +1,29 @@
    +
    +Add support for aarch64, powerpc64 and riscv64.
    +Use OpenBSD-specific files for arm (TBD).
    +
     Index: gdb/configure.host
     --- gdb/configure.host.orig
     +++ gdb/configure.host
    -@@ -85,6 +85,7 @@ case "${host}" in
    +@@ -81,6 +81,7 @@ case "${host}" in
      
      aarch64*-*-linux*)	gdb_host=linux ;;
      aarch64*-*-freebsd*)	gdb_host=fbsd ;;
     +aarch64*-*-openbsd*)	gdb_host=obsd64 ;;
      
      alpha*-*-linux*)	gdb_host=alpha-linux ;;
    - alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
    -@@ -139,12 +140,14 @@ powerpc*-*-freebsd*)	gdb_host=fbsd ;;
    - powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
    + alpha*-*-netbsdaout* | alpha*-*-knetbsdaout*-gnu)
    +@@ -93,7 +94,7 @@ arm*-*-freebsd*)	gdb_host=fbsd ;;
    + arm*-*-linux*)		gdb_host=linux ;;
    + arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
    + 			gdb_host=nbsdelf ;;
    +-arm*-*-openbsd*)	gdb_host=nbsdelf ;;
    ++arm*-*-openbsd*)	gdb_host=obsd ;;
    + 
    + hppa*-*-linux*)		gdb_host=linux ;;
    + hppa*-*-netbsd*)	gdb_host=nbsd ;;
    +@@ -141,12 +142,14 @@ powerpc*-*-freebsd*)	gdb_host=fbsd ;;
    + powerpc-*-netbsdaout* | powerpc-*-knetbsd*-gnu)
      			gdb_host=nbsd ;;
      powerpc-*-openbsd*)	gdb_host=obsd ;;
     +powerpc64-*-openbsd*)	gdb_host=obsd64 ;;
    Index: patches/patch-gdb_configure_nat
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_configure_nat,v
    diff -u -p -r1.2 patch-gdb_configure_nat
    --- patches/patch-gdb_configure_nat	11 Mar 2022 18:50:04 -0000	1.2
    +++ patches/patch-gdb_configure_nat	8 Nov 2024 15:50:17 -0000
    @@ -1,5 +1,6 @@
     All our targets need obsd-nat.o and kvm etc -> dedup.
    -Add aarch64 and riscv64 support.
    +Add aarch64, powerpc64 and riscv64 support.
    +Use OpenBSD-specific files for arm. (TBD)
     
     Index: gdb/configure.nat
     --- gdb/configure.nat.orig
    @@ -21,9 +22,15 @@ Index: gdb/configure.nat
     +	LOADLIBES='-lkvm'
      	;;
          cygwin*)
    - 	NATDEPFILES='x86-nat.o nat/x86-dregs.o windows-nat.o'
    -@@ -416,49 +416,54 @@ case ${gdb_host} in
    + 	NATDEPFILES='x86-nat.o nat/x86-dregs.o windows-nat.o nat/windows-nat.o'
    +@@ -430,50 +430,60 @@ case ${gdb_host} in
    + 	;;
    +     obsd)
      	case ${gdb_host_cpu} in
    ++	    arm)
    ++		# Host: OpenBSD/arm XXX TODO
    ++		#NATDEPFILES="${NATDEPFILES} arm-obsd-nat.o"
    ++		;;
      	    i386)
      		# Host: OpenBSD/i386 ELF
     -		NATDEPFILES="${NATDEPFILES} obsd-nat.o x86-bsd-nat.o \
    @@ -65,9 +72,8 @@ Index: gdb/configure.nat
     +		;;
      	    i386)
      		# Host: OpenBSD/amd64
    --		NATDEPFILES="${NATDEPFILES} obsd-nat.o amd64-nat.o x86-nat.o \
    --		x86-bsd-nat.o amd64-bsd-nat.o amd64-obsd-nat.o bsd-kvm.o \
    --		nat/x86-dregs.o"
    +-		NATDEPFILES="${NATDEPFILES} obsd-nat.o amd64-nat.o \
    +-		x86-bsd-nat.o amd64-bsd-nat.o amd64-obsd-nat.o bsd-kvm.o"
     -		LOADLIBES='-lkvm'
     +		NATDEPFILES="${NATDEPFILES} amd64-nat.o \
     +		x86-bsd-nat.o amd64-bsd-nat.o amd64-obsd-nat.o"
    Index: patches/patch-gdb_configure_tgt
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_configure_tgt,v
    diff -u -p -r1.4 patch-gdb_configure_tgt
    --- patches/patch-gdb_configure_tgt	11 Mar 2022 18:50:04 -0000	1.4
    +++ patches/patch-gdb_configure_tgt	8 Nov 2024 15:50:17 -0000
    @@ -1,8 +1,10 @@
    +Add support for aarch64, powerpc64 and riscv64.
    +
     Index: gdb/configure.tgt
     --- gdb/configure.tgt.orig
     +++ gdb/configure.tgt
    -@@ -131,6 +131,13 @@ aarch64*-*-linux*)
    - 	build_gdbserver=yes
    +@@ -145,6 +145,13 @@ aarch64*-*-linux*)
    + 			symfile-mem.o linux-record.o"
      	;;
      
     +aarch64*-*-openbsd*)
    @@ -15,7 +17,7 @@ Index: gdb/configure.tgt
      alpha*-*-linux*)
      	# Target: Little-endian Alpha running Linux
      	gdb_target_obs="alpha-mdebug-tdep.o alpha-linux-tdep.o \
    -@@ -506,6 +513,12 @@ powerpc-*-openbsd*)
    +@@ -492,6 +499,12 @@ powerpc-*-openbsd*)
      	gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc-obsd-tdep.o \
      			ravenscar-thread.o ppc-ravenscar-thread.o"
      	;;
    @@ -28,7 +30,7 @@ Index: gdb/configure.tgt
      powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
      	# Target: PowerPC running AIX
      	gdb_target_obs="rs6000-tdep.o rs6000-aix-tdep.o xcoffread.o \
    -@@ -552,6 +565,12 @@ riscv*-*-linux*)
    +@@ -534,6 +547,12 @@ riscv*-*-linux*)
      	# Target: Linux/RISC-V
      	gdb_target_obs="riscv-linux-tdep.o glibc-tdep.o \
       			linux-tdep.o solib-svr4.o symfile-mem.o linux-record.o"
    Index: patches/patch-gdb_data-directory_Makefile_in
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_data-directory_Makefile_in,v
    diff -u -p -r1.11 patch-gdb_data-directory_Makefile_in
    --- patches/patch-gdb_data-directory_Makefile_in	11 Mar 2022 18:50:04 -0000	1.11
    +++ patches/patch-gdb_data-directory_Makefile_in	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/data-directory/Makefile.in
     --- gdb/data-directory/Makefile.in.orig
     +++ gdb/data-directory/Makefile.in
    -@@ -198,7 +198,7 @@ stamp-syscalls: Makefile $(SYSCALLS_FILES)
    +@@ -200,7 +200,7 @@ stamp-syscalls: Makefile $(SYSCALLS_FILES)
      	for file in $$files ; do \
      	  f=$(SYSCALLS_SRCDIR)/$$file ; \
      	  if test -f $$f ; then \
    @@ -10,7 +10,7 @@ Index: gdb/data-directory/Makefile.in
      	  fi ; \
      	done
      	touch $@
    -@@ -240,8 +240,8 @@ stamp-python: Makefile $(PYTHON_FILES)
    +@@ -242,8 +242,8 @@ stamp-python: Makefile $(PYTHON_FILES)
      	if test "x$$files" != x ; then \
      	  for file in $$files ; do \
      	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    @@ -21,7 +21,7 @@ Index: gdb/data-directory/Makefile.in
      	  done ; \
      	fi
      	touch $@
    -@@ -334,7 +334,7 @@ stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
    +@@ -336,7 +336,7 @@ stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
      	for file in $$files ; do \
      	  f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \
      	  if test -f $$f ; then \
    Index: patches/patch-gdb_doc_gdb_info-2
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_doc_gdb_info-2,v
    diff -u -p -r1.1 patch-gdb_doc_gdb_info-2
    --- patches/patch-gdb_doc_gdb_info-2	1 Oct 2024 07:41:42 -0000	1.1
    +++ patches/patch-gdb_doc_gdb_info-2	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/doc/gdb.info-2
     --- gdb/doc/gdb.info-2.orig
     +++ gdb/doc/gdb.info-2
    -@@ -626,7 +626,7 @@ parts of the program:
    +@@ -1156,7 +1156,7 @@ parts of the program:
      --------------------------
      
      You can customize GDB to use any editor you want (1).  By default, it is
    Index: patches/patch-gdb_gdbsupport_enum-flags_h
    ===================================================================
    RCS file: patches/patch-gdb_gdbsupport_enum-flags_h
    diff -N patches/patch-gdb_gdbsupport_enum-flags_h
    --- patches/patch-gdb_gdbsupport_enum-flags_h	6 Sep 2023 21:03:04 -0000	1.1
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,22 +0,0 @@
    -From 12e3f3bc6ec74eb50e04675f5bcf962482d3ff25 Mon Sep 17 00:00:00 2001
    -From: Simon Marchi <simon.marchi@efficios.com>
    -Date: Thu, 23 Feb 2023 12:35:40 -0500
    -Subject: [PATCH] gdbsupport: ignore -Wenum-constexpr-conversion in
    - enum-flags.h
    -
    -Index: gdb/gdbsupport/enum-flags.h
    ---- gdb/gdbsupport/enum-flags.h.orig
    -+++ gdb/gdbsupport/enum-flags.h
    -@@ -81,9 +81,12 @@ template<> struct integer_for_size<8, 1> { typedef int
    - template<typename T>
    - struct enum_underlying_type
    - {
    -+  DIAGNOSTIC_PUSH
    -+  DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION
    -   typedef typename
    -     integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
    -     type;
    -+  DIAGNOSTIC_POP
    - };
    - 
    - template <typename E>
    Index: patches/patch-gdb_i386-bsd-nat_h
    ===================================================================
    RCS file: patches/patch-gdb_i386-bsd-nat_h
    diff -N patches/patch-gdb_i386-bsd-nat_h
    --- patches/patch-gdb_i386-bsd-nat_h	11 Mar 2022 18:50:04 -0000	1.2
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,14 +0,0 @@
    -Missing include.
    -
    -Index: gdb/i386-bsd-nat.h
    ---- gdb/i386-bsd-nat.h.orig
    -+++ gdb/i386-bsd-nat.h
    -@@ -20,6 +20,8 @@
    - #ifndef I386_BSD_NAT_H
    - #define I386_BSD_NAT_H
    - 
    -+#include "x86-bsd-nat.h"
    -+
    - /* Helper functions.  See definitions.  */
    - extern void i386bsd_fetch_inferior_registers (struct regcache *regcache,
    - 					      int regnum);
    Index: patches/patch-gdb_i386-obsd-nat_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_i386-obsd-nat_c,v
    diff -u -p -r1.2 patch-gdb_i386-obsd-nat_c
    --- patches/patch-gdb_i386-obsd-nat_c	11 Mar 2022 18:50:04 -0000	1.2
    +++ patches/patch-gdb_i386-obsd-nat_c	8 Nov 2024 15:50:17 -0000
    @@ -3,9 +3,9 @@ Bogus variable name.
     Index: gdb/i386-obsd-nat.c
     --- gdb/i386-obsd-nat.c.orig
     +++ gdb/i386-obsd-nat.c
    -@@ -93,7 +93,7 @@ static i386_bsd_nat_target<obsd_nat_target> the_i386_o
    +@@ -94,7 +94,7 @@ void _initialize_i386obsd_nat ();
      void
    - _initialize_i386obsd_nat (void)
    + _initialize_i386obsd_nat ()
      {
     -  add_inf_child_target (&i386_obsd_nat_target);
     +  add_inf_child_target (&the_i386_obsd_nat_target);
    Index: patches/patch-gdb_ppc64-obsd-tdep_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_ppc64-obsd-tdep_c,v
    diff -u -p -r1.2 patch-gdb_ppc64-obsd-tdep_c
    --- patches/patch-gdb_ppc64-obsd-tdep_c	11 Mar 2022 18:50:04 -0000	1.2
    +++ patches/patch-gdb_ppc64-obsd-tdep_c	8 Nov 2024 15:50:17 -0000
    @@ -72,7 +72,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +		      int regnum, const void *gregs, size_t len)
     +{
     +  struct gdbarch *gdbarch = regcache->arch ();
    -+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
    ++  ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
     +  const struct ppc_reg_offsets *offsets
     +    = (const struct ppc_reg_offsets *) regset->regmap;
     +  size_t offset;
    @@ -117,7 +117,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +		       int regnum, void *gregs, size_t len)
     +{
     +  struct gdbarch *gdbarch = regcache->arch ();
    -+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
    ++  ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
     +  const struct ppc_reg_offsets *offsets
     +    = (const struct ppc_reg_offsets *) regset->regmap;
     +  size_t offset;
    @@ -230,7 +230,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +
     +static int
     +ppc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
    -+				  struct frame_info *this_frame,
    ++				  frame_info_ptr this_frame,
     +				  void **this_cache)
     +{
     +  struct gdbarch *gdbarch = get_frame_arch (this_frame);
    @@ -249,8 +249,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +      gdb_byte buf[2 * PPC_INSN_SIZE];
     +      unsigned long insn;
     +
    -+      if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
    -+				     buf, sizeof buf))
    ++      if (!safe_frame_unwind_memory (this_frame, start_pc + *offset, buf))
     +	continue;
     +
     +      /* Check for "li r0,SYS_sigreturn".  */
    @@ -271,11 +270,11 @@ Index: gdb/ppc64-obsd-tdep.c
     +}
     +
     +static struct trad_frame_cache *
    -+ppc64obsd_sigtramp_frame_cache (struct frame_info *this_frame,
    ++ppc64obsd_sigtramp_frame_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);
     +  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
     +  struct trad_frame_cache *cache;
     +  CORE_ADDR addr, base, func;
    @@ -291,7 +290,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +
     +  func = get_frame_pc (this_frame);
     +  func &= ~(ppc64obsd_page_size - 1);
    -+  if (!safe_frame_unwind_memory (this_frame, func, buf, sizeof buf))
    ++  if (!safe_frame_unwind_memory (this_frame, func, buf))
     +    return cache;
     +
     +  /* Calculate the offset where we can find `struct sigcontext'.  We
    @@ -326,7 +325,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +}
     +
     +static void
    -+ppc64obsd_sigtramp_frame_this_id (struct frame_info *this_frame,
    ++ppc64obsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
     +				void **this_cache, struct frame_id *this_id)
     +{
     +  struct trad_frame_cache *cache =
    @@ -336,7 +335,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +}
     +
     +static struct value *
    -+ppc64obsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
    ++ppc64obsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
     +					void **this_cache, int regnum)
     +{
     +  struct trad_frame_cache *cache =
    @@ -346,6 +345,7 @@ Index: gdb/ppc64-obsd-tdep.c
     +}
     +
     +static const struct frame_unwind ppc64obsd_sigtramp_frame_unwind = {
    ++  "ppc64 openbsd sigtramp",
     +  SIGTRAMP_FRAME,
     +  default_frame_unwind_stop_reason,
     +  ppc64obsd_sigtramp_frame_this_id,
    Index: patches/patch-gdb_python_python-config_py
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_python_python-config_py,v
    diff -u -p -r1.6 patch-gdb_python_python-config_py
    --- patches/patch-gdb_python_python-config_py	11 Mar 2022 18:50:04 -0000	1.6
    +++ patches/patch-gdb_python_python-config_py	8 Nov 2024 15:50:17 -0000
    @@ -1,12 +1,12 @@
     Index: gdb/python/python-config.py
     --- gdb/python/python-config.py.orig
     +++ gdb/python/python-config.py
    -@@ -71,6 +71,8 @@ for opt in opt_flags:
    -                     libs.insert(0, '-L' + getvar('LIBPL'))
    -                 elif os.name == 'nt':
    -                     libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
    +@@ -77,6 +77,8 @@ for opt in opt_flags:
    +                     libs.insert(0, "-L" + getvar("LIBPL"))
    +                 elif os.name == "nt":
    +                     libs.insert(0, "-L" + os.path.normpath(sys.prefix) + "/libs")
     +            if getvar('CONFIGURE_LDFLAGS') is not None:
     +                libs.insert(0, getvar('CONFIGURE_LDFLAGS'))
    -             if getvar('LINKFORSHARED') is not None:
    -                 libs.extend(getvar('LINKFORSHARED').split())
    -         print (to_unix_path(' '.join(libs)))
    +             if getvar("LINKFORSHARED") is not None:
    +                 libs.extend(getvar("LINKFORSHARED").split())
    +         print(to_unix_path(" ".join(libs)))
    Index: patches/patch-gdb_python_python_c
    ===================================================================
    RCS file: patches/patch-gdb_python_python_c
    diff -N patches/patch-gdb_python_python_c
    --- patches/patch-gdb_python_python_c	11 Mar 2022 18:50:04 -0000	1.4
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,99 +0,0 @@
    -From c47bae859a5af0d95224d90000df0e529f7c5aa0 Mon Sep 17 00:00:00 2001
    -From: Kevin Buettner <kevinb@redhat.com>
    -Date: Wed, 27 May 2020 20:05:40 -0700
    -Subject: [PATCH] Fix Python3.9 related runtime problems
    -
    -Index: gdb/python/python.c
    ---- gdb/python/python.c.orig
    -+++ gdb/python/python.c
    -@@ -234,6 +234,30 @@ gdbpy_enter::~gdbpy_enter ()
    -   PyGILState_Release (m_state);
    - }
    - 
    -+/* A helper class to save and restore the GIL, but without touching
    -+   the other globals that are handled by gdbpy_enter.  */
    -+
    -+class gdbpy_gil
    -+{
    -+public:
    -+
    -+  gdbpy_gil ()
    -+    : m_state (PyGILState_Ensure ())
    -+  {
    -+  }
    -+
    -+  ~gdbpy_gil ()
    -+  {
    -+    PyGILState_Release (m_state);
    -+  }
    -+
    -+  DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
    -+
    -+private:
    -+
    -+  PyGILState_STATE m_state;
    -+};
    -+
    - /* Set the quit flag.  */
    - 
    - static void
    -@@ -247,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_d
    - static int
    - gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
    - {
    -+  if (!gdb_python_initialized)
    -+    return 0;
    -+
    -+  gdbpy_gil gil;
    -   return PyOS_InterruptOccurred ();
    - }
    - 
    -@@ -924,30 +952,6 @@ gdbpy_source_script (const struct extension_language_d
    - 
    - /* Posting and handling events.  */
    - 
    --/* A helper class to save and restore the GIL, but without touching
    --   the other globals that are handled by gdbpy_enter.  */
    --
    --class gdbpy_gil
    --{
    --public:
    --
    --  gdbpy_gil ()
    --    : m_state (PyGILState_Ensure ())
    --  {
    --  }
    --
    --  ~gdbpy_gil ()
    --  {
    --    PyGILState_Release (m_state);
    --  }
    --
    --  DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
    --
    --private:
    --
    --  PyGILState_STATE m_state;
    --};
    --
    - /* A single event.  */
    - struct gdbpy_event
    - {
    -@@ -1548,6 +1552,7 @@ finalize_python (void *ignore)
    - 
    -   Py_Finalize ();
    - 
    -+  gdb_python_initialized = false;
    -   restore_active_ext_lang (previous_active);
    - }
    - 
    -@@ -1715,8 +1720,7 @@ do_start_initialization ()
    -     return false;
    - 
    -   /* Release the GIL while gdb runs.  */
    --  PyThreadState_Swap (NULL);
    --  PyEval_ReleaseLock ();
    -+  PyEval_SaveThread ();
    - 
    -   make_final_cleanup (finalize_python, NULL);
    - 
    Index: patches/patch-gdb_riscv-obsd-tdep_c
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-gdb_riscv-obsd-tdep_c,v
    diff -u -p -r1.2 patch-gdb_riscv-obsd-tdep_c
    --- patches/patch-gdb_riscv-obsd-tdep_c	11 Mar 2022 18:50:04 -0000	1.2
    +++ patches/patch-gdb_riscv-obsd-tdep_c	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: gdb/riscv-obsd-tdep.c
     --- gdb/riscv-obsd-tdep.c.orig
     +++ gdb/riscv-obsd-tdep.c
    -@@ -0,0 +1,235 @@
    +@@ -0,0 +1,219 @@
     +/* Target-dependent code for OpenBSD on RISC-V processors.
     +   Copyright (C) 2018-2021 Free Software Foundation, Inc.
     +
    @@ -57,32 +57,16 @@ Index: gdb/riscv-obsd-tdep.c
     +    { 0 }
     +  };
     +
    -+/* Supply the general-purpose registers stored in GREGS to REGCACHE.
    -+   This function only exists to supply the always-zero x0 in addition
    -+   to the registers in GREGS.  */
    -+
    -+static void
    -+riscv_obsd_supply_gregset (const struct regset *regset,
    -+			   struct regcache *regcache, int regnum,
    -+			   const void *gregs, size_t len)
    -+{
    -+  regcache->supply_regset (&riscv_obsd_gregset, regnum, gregs, len);
    -+  if (regnum == -1 || regnum == RISCV_ZERO_REGNUM)
    -+    regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM);
    -+}
    -+
     +/* Register set definitions.  */
     +
     +const struct regset riscv_obsd_gregset =
     +  {
    -+    riscv_obsd_gregmap,
    -+    riscv_obsd_supply_gregset, regcache_collect_regset
    ++    riscv_obsd_gregmap, riscv_supply_regset, regcache_collect_regset
     +  };
     +
     +const struct regset riscv_obsd_fpregset =
     +  {
    -+    riscv_obsd_fpregmap,
    -+    regcache_supply_regset, regcache_collect_regset
    ++    riscv_obsd_fpregmap, riscv_supply_regset, regcache_collect_regset
     +  };
     +
     +/* Implement the "iterate_over_regset_sections" gdbarch method.  */
    @@ -128,7 +112,7 @@ Index: gdb/riscv-obsd-tdep.c
     +
     +static void
     +riscv_obsd_sigframe_init (const struct tramp_frame *self,
    -+			  struct frame_info *this_frame,
    ++			  frame_info_ptr this_frame,
     +			  struct trad_frame_cache *this_cache,
     +			  CORE_ADDR func)
     +{
    Index: patches/patch-gdb_x86-bsd-nat_h
    ===================================================================
    RCS file: patches/patch-gdb_x86-bsd-nat_h
    diff -N patches/patch-gdb_x86-bsd-nat_h
    --- patches/patch-gdb_x86-bsd-nat_h	11 Mar 2022 18:50:04 -0000	1.2
    +++ /dev/null	1 Jan 1970 00:00:00 -0000
    @@ -1,32 +0,0 @@
    -Don't compile x86 debug register support on OpenBSD.
    -Upstream commit 757e686afb4ac97bcf9333b10a6a0880bdd310f8
    -
    -Index: gdb/x86-bsd-nat.h
    ---- gdb/x86-bsd-nat.h.orig
    -+++ gdb/x86-bsd-nat.h
    -@@ -27,18 +27,23 @@ extern size_t x86bsd_xsave_len;
    - 
    - /* A prototype *BSD/x86 target.  */
    - 
    -+#ifdef HAVE_PT_GETDBREGS
    - template<typename BaseTarget>
    - class x86bsd_nat_target : public x86_nat_target<BaseTarget>
    - {
    -   using base_class = x86_nat_target<BaseTarget>;
    - public:
    --#ifdef HAVE_PT_GETDBREGS
    -   void mourn_inferior () override
    -   {
    -     x86_cleanup_dregs ();
    -     base_class::mourn_inferior ();
    -   }
    --#endif /* HAVE_PT_GETDBREGS */
    - };
    -+#else /* !HAVE_PT_GETDBREGS */
    -+template<typename BaseTarget>
    -+class x86bsd_nat_target : public BaseTarget
    -+{
    -+};
    -+#endif /* HAVE_PT_GETDBREGS */
    - 
    - #endif /* x86-bsd-nat.h */
    Index: patches/patch-include_diagnostics_h
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-include_diagnostics_h,v
    diff -u -p -r1.1 patch-include_diagnostics_h
    --- patches/patch-include_diagnostics_h	6 Sep 2023 21:03:04 -0000	1.1
    +++ patches/patch-include_diagnostics_h	8 Nov 2024 15:50:17 -0000
    @@ -7,9 +7,9 @@ Subject: [PATCH] gdbsupport: ignore -Wen
     Index: include/diagnostics.h
     --- include/diagnostics.h.orig
     +++ include/diagnostics.h
    -@@ -63,6 +63,11 @@
    - # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
    -   DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
    +@@ -81,6 +81,11 @@
    +    DIAGNOSTIC_IGNORE ("-Wenum-constexpr-conversion")
    + # endif
      
     +# if __has_warning ("-Wenum-constexpr-conversion")
     +#  define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION \
    @@ -18,8 +18,8 @@ Index: include/diagnostics.h
     +
      #elif defined (__GNUC__) /* GCC */
      
    - # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
    -@@ -102,6 +107,10 @@
    + # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \
    +@@ -146,6 +151,10 @@
      
      #ifndef DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
      # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
    @@ -29,4 +29,4 @@ Index: include/diagnostics.h
     +# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION
      #endif
      
    - #endif /* DIAGNOSTICS_H */
    + #ifndef DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS
    Index: patches/patch-include_elf_common_h
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-include_elf_common_h,v
    diff -u -p -r1.1 patch-include_elf_common_h
    --- patches/patch-include_elf_common_h	10 Jun 2023 19:19:12 -0000	1.1
    +++ patches/patch-include_elf_common_h	8 Nov 2024 15:50:17 -0000
    @@ -1,11 +1,11 @@
     Index: include/elf/common.h
     --- include/elf/common.h.orig
     +++ include/elf/common.h
    -@@ -698,6 +698,7 @@
    +@@ -763,6 +763,7 @@
      #define NT_OPENBSD_FPREGS	21
      #define NT_OPENBSD_XFPREGS	22
      #define NT_OPENBSD_WCOOKIE	23
     +#define NT_OPENBSD_PACMASK	24
      
      
    - /* Note segments for core files on SPU systems.  Note name
    + /* Note segments for core files on Solaris systems.  Note name
    Index: patches/patch-include_filenames_h
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-include_filenames_h,v
    diff -u -p -r1.3 patch-include_filenames_h
    --- patches/patch-include_filenames_h	11 Mar 2022 18:50:04 -0000	1.3
    +++ patches/patch-include_filenames_h	8 Nov 2024 15:50:17 -0000
    @@ -6,7 +6,7 @@ Fixes linking against libbfd with our sy
     Index: include/filenames.h
     --- include/filenames.h.orig
     +++ include/filenames.h
    -@@ -80,11 +80,10 @@ extern "C" {
    +@@ -81,11 +81,10 @@ extern "C" {
        (IS_DIR_SEPARATOR_1 (dos_based, (f)[0])		 \
         || HAS_DRIVE_SPEC_1 (dos_based, f))
      
    Index: patches/patch-libiberty_Makefile_in
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/patches/patch-libiberty_Makefile_in,v
    diff -u -p -r1.9 patch-libiberty_Makefile_in
    --- patches/patch-libiberty_Makefile_in	11 Mar 2022 18:50:04 -0000	1.9
    +++ patches/patch-libiberty_Makefile_in	8 Nov 2024 15:50:17 -0000
    @@ -1,7 +1,7 @@
     Index: libiberty/Makefile.in
     --- libiberty/Makefile.in.orig
     +++ libiberty/Makefile.in
    -@@ -355,7 +355,7 @@ libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
    +@@ -376,7 +376,7 @@ libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
      @MAINT@	echo stamp > stamp-functions
      
      INSTALL_DEST = @INSTALL_DEST@
    Index: pkg/PLIST
    ===================================================================
    RCS file: /home/cvs/ports/devel/gdb/pkg/PLIST,v
    diff -u -p -r1.25 PLIST
    --- pkg/PLIST	28 May 2024 16:48:39 -0000	1.25
    +++ pkg/PLIST	8 Nov 2024 17:04:46 -0000
    @@ -2,7 +2,6 @@
     bin/egdb-add-index
     include/ansidecl.h
     include/bfd.h
    -include/bfd_stdint.h
     include/bfdlink.h
     include/ctf-api.h
     include/ctf.h
    @@ -11,10 +10,14 @@ include/dis-asm.h
     include/gdb/
     include/gdb/jit-reader.h
     include/plugin-api.h
    +include/sframe-api.h
    +include/sframe.h
     include/symcat.h
     @info info/annotate.info
     @info info/bfd.info
    +@info info/ctf-spec.info
     @info info/gdb.info
    +@comment @info info/sframe-spec.info
     @info info/stabs.info
     @comment lib/charset.alias
     @static-lib lib/libbfd.a
    @@ -25,6 +28,8 @@ lib/libctf-nobfd.la
     lib/libctf.la
     @static-lib lib/libopcodes.a
     lib/libopcodes.la
    +@static-lib lib/libsframe.a
    +lib/libsframe.la
     @man man/man1/egdb-add-index.1
     @man man/man1/egdb.1
     @man man/man1/egdbserver.1
    @@ -41,12 +46,16 @@ share/gdb/python/gdb/${MODPY_PYCACHE}Fra
     share/gdb/python/gdb/${MODPY_PYCACHE}FrameIterator.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
     share/gdb/python/gdb/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
    +share/gdb/python/gdb/${MODPY_PYCACHE}disassembler.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
    +share/gdb/python/gdb/${MODPY_PYCACHE}disassembler.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}frames.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
     share/gdb/python/gdb/${MODPY_PYCACHE}frames.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}printing.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
     share/gdb/python/gdb/${MODPY_PYCACHE}printing.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}prompt.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
     share/gdb/python/gdb/${MODPY_PYCACHE}prompt.${MODPY_PYC_MAGIC_TAG}pyc
    +share/gdb/python/gdb/${MODPY_PYCACHE}styling.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
    +share/gdb/python/gdb/${MODPY_PYCACHE}styling.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}types.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
     share/gdb/python/gdb/${MODPY_PYCACHE}types.${MODPY_PYC_MAGIC_TAG}pyc
     share/gdb/python/gdb/${MODPY_PYCACHE}unwinder.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}
    @@ -79,6 +88,7 @@ share/gdb/python/gdb/command/prompt.py
     share/gdb/python/gdb/command/type_printers.py
     share/gdb/python/gdb/command/unwinders.py
     share/gdb/python/gdb/command/xmethods.py
    +share/gdb/python/gdb/disassembler.py
     share/gdb/python/gdb/frames.py
     share/gdb/python/gdb/function/
     share/gdb/python/gdb/function/__init__.py
    @@ -104,6 +114,7 @@ share/gdb/python/gdb/printer/${MODPY_PYC
     share/gdb/python/gdb/printer/bound_registers.py
     share/gdb/python/gdb/printing.py
     share/gdb/python/gdb/prompt.py
    +share/gdb/python/gdb/styling.py
     share/gdb/python/gdb/types.py
     share/gdb/python/gdb/unwinder.py
     share/gdb/python/gdb/xmethod.py
    @@ -117,6 +128,7 @@ share/gdb/syscalls/i386-linux.xml
     share/gdb/syscalls/mips-n32-linux.xml
     share/gdb/syscalls/mips-n64-linux.xml
     share/gdb/syscalls/mips-o32-linux.xml
    +share/gdb/syscalls/netbsd.xml
     share/gdb/syscalls/ppc-linux.xml
     share/gdb/syscalls/ppc64-linux.xml
     share/gdb/syscalls/s390-linux.xml
    
    -- 
    jca
    
    
    
  • George Koehler:

    Update to gdb-13.2 - tests wanted