On Sat, 9 Nov 2024 19:23:31 -0500, George Koehler wrote:
> On Sat, 9 Nov 2024 11:50:12 +0100 Jeremie Courreges-Anglas
> <j...@wxcvbn.org> wrote:
> 
> > I propose I commit this update, and then you add your runtime fix for
> > powerpc64 on top.
> 
> Here's my diff on top, with the powerpc thread-switching fix, and the
> powerpc64 runtime fixes. Also, "make update-patches" wants to trim some
> empty lines from patch*aarch64*. Is this ok?
> 
> WRKSRC/gdb/make-init-c was not finding the _initialize_ppc64obsd_*
> functions; change their style to what make-init-c expects. Get rid of
> inferior_ptid, which had pid 0. Drop 32-bit bfd_arch_rs6000.

All of this looks good.  OK.

> I also want to report that 32-bit archs (powerpc but not powerpc64)
> give lots of this warning, | /usr/local/include/xxhash.h:617:16:
> warning: unknown attribute | 'rpl_malloc' ignored [-Wunknown-attributes]
> because <xxhash.h> has "__attribute__((malloc))" but
> WRKSRC/gnulib/import/stdlib.h does "#define malloc rpl_malloc", after
> WRKSRC/gnulib/import/m4/malloc.m4 checks "whether malloc is ptrdiff_t
> safe", which is "no" on 32-bit archs.
> 
> --gkoehler
> 
> Index: Makefile
> =================================================================== RCS
> file: /cvs/ports/devel/gdb/Makefile,v diff -u -p -r1.86 Makefile ---
> Makefile 9 Nov 2024 13:33:19 -0000 1.86 +++ Makefile 9 Nov 2024 21:39:17
> -0000 @@ -2,6 +2,7 @@ COMMENT= GNU debugger CATEGORIES= devel
> 
>  DISTNAME= gdb-13.2 +REVISION= 0
> 
>  HOMEPAGE= https://www.gnu.org/software/gdb/
> 
> Index: patches/patch-gdb_aarch64-obsd-nat_c
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_aarch64-obsd-nat_c,v
> diff -u -p -r1.4 patch-gdb_aarch64-obsd-nat_c ---
> patches/patch-gdb_aarch64-obsd-nat_c 9 Nov 2024 13:33:19
> -0000 1.4 +++ patches/patch-gdb_aarch64-obsd-nat_c 9 Nov 2024
> 21:39:17 -0000 @@ -172,5 +172,3 @@ Index: gdb/aarch64-obsd-nat.c
> +{ + add_inf_child_target (&the_aarch64_obsd_nat_target);
> +} - - Index: patches/patch-gdb_aarch64-obsd-tdep_c
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_aarch64-obsd-tdep_c,v
> diff -u -p -r1.4 patch-gdb_aarch64-obsd-tdep_c ---
> patches/patch-gdb_aarch64-obsd-tdep_c 9 Nov 2024 13:33:19 -0000
> 1.4 +++ patches/patch-gdb_aarch64-obsd-tdep_c 9 Nov 2024 21:39:18
> -0000 @@ -340,4 +340,3 @@ Index: gdb/aarch64-obsd-tdep.c +
> gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_OPENBSD, +
> aarch64obsd_init_abi); +} - Index: patches/patch-gdb_ppc-obsd-nat_c
> ===================================================================
> RCS file: patches/patch-gdb_ppc-obsd-nat_c diff -N
> patches/patch-gdb_ppc-obsd-nat_c --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-gdb_ppc-obsd-nat_c 9 Nov 2024 21:39:18 -0000 @@ -0,0
> +1,23 @@ +When switching threads, use the correct registers. + +Index:
> gdb/ppc-obsd-nat.c +--- gdb/ppc-obsd-nat.c.orig ++++ gdb/ppc-obsd-nat.c
> +@@ -82,7 +82,7 @@ void + ppc_obsd_nat_target::fetch_registers
> (struct regcache *regcache, int regnum) + { + struct reg regs; +-
> pid_t pid = regcache->ptid ().pid (); ++ pid_t pid = get_ptrace_pid
> (regcache->ptid ()); + + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3)
> &regs, 0) == -1) + perror_with_name (_("Couldn't get registers"));
> +@@ -116,7 +116,7 @@ void + ppc_obsd_nat_target::store_registers
> (struct regcache *regcache, int regnum) + { + struct reg
> regs; +- pid_t pid = regcache->ptid ().pid (); ++ pid_t pid =
> get_ptrace_pid (regcache->ptid ()); + + if (ptrace (PT_GETREGS, pid,
> (PTRACE_TYPE_ARG3) &regs, 0) == -1) + perror_with_name (_("Couldn't
> get registers")); Index: patches/patch-gdb_ppc64-obsd-nat_c
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_ppc64-obsd-nat_c,v
> diff -u -p -r1.2 patch-gdb_ppc64-obsd-nat_c ---
> patches/patch-gdb_ppc64-obsd-nat_c 11 Mar 2022 18:50:04 -0000 1.2 +++
> patches/patch-gdb_ppc64-obsd-nat_c 9 Nov 2024 21:39:18 -0000 @@ -1,7
> +1,7 @@ Index: gdb/ppc64-obsd-nat.c --- gdb/ppc64-obsd-nat.c.orig
> +++ gdb/ppc64-obsd-nat.c -@@ -0,0 +1,219 @@ +@@ -0,0 +1,213 @@ +/*
> Native-dependent code for OpenBSD/powerpc64. + + Copyright (C)
> 2004-2020 Free Software Foundation, Inc. @@ -83,9 +83,9 @@ Index:
> gdb/ppc64-obsd-nat.c +ppc64_obsd_nat_target::fetch_registers (struct
> regcache *regcache, int regnum) +{ + struct reg regs; ++ pid_t pid
> = get_ptrace_pid (regcache->ptid ()); + -+ if (ptrace (PT_GETREGS,
> get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &regs, 0)
> == -1) ++ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,
> 0) == -1) + perror_with_name (_("Couldn't get registers")); + +
> ppc64obsd_supply_gregset (&ppc64obsd_gregset, regcache, -1, @@ -97,8
> +97,7 @@ Index: gdb/ppc64-obsd-nat.c + { + struct fpreg fpregs; +
> -+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid), -+
> (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) ++ if (ptrace (PT_GETFPREGS,
> pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) + perror_with_name
> (_("Couldn't get floating point status")); + + ppc64obsd_supply_fpregset
> (&ppc64obsd_fpregset, regcache, -1, @@ -114,16 +113,15 @@ Index:
> gdb/ppc64-obsd-nat.c +ppc64_obsd_nat_target::store_registers
> (struct regcache *regcache, int regnum) +{ + struct reg regs; ++
> pid_t pid = get_ptrace_pid (regcache->ptid ()); + -+ if (ptrace
> (PT_GETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3)
> &regs, 0) == -1) ++ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3)
> &regs, 0) == -1) + perror_with_name (_("Couldn't get registers"));
> + + ppc64obsd_collect_gregset (&ppc64obsd_gregset, regcache,
> + regnum, &regs, sizeof regs); + -+ if (ptrace (PT_SETREGS,
> get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &regs, 0)
> == -1) ++ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs,
> 0) == -1) + perror_with_name (_("Couldn't write registers")); +
> +#if 0 @@ -132,15 +130,13 @@ Index: gdb/ppc64-obsd-nat.c + { +
> struct fpreg fpregs; + -+ if (ptrace (PT_GETFPREGS, get_ptrace_pid
> (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) ++ if
> (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
> + perror_with_name (_("Couldn't get floating point status")); + +
> ppc64obsd_collect_fpregset (&ppc64obsd_fpregset, regcache, + regnum,
> &fpregs, sizeof fpregs); + -+ if (ptrace (PT_SETFPREGS, get_ptrace_pid
> (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) ++ if
> (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) +
> perror_with_name (_("Couldn't write floating point status")); + }
> +#endif @@ -189,11 +185,9 @@ Index: gdb/ppc64-obsd-nat.c +#endif + +
> -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void
> _initialize_ppc64obsd_nat (void); -+ ++void _initialize_ppc64obsd_nat
> (); +void -+_initialize_ppc64obsd_nat (void) ++_initialize_ppc64obsd_nat
> () +{ + add_inf_child_target (&the_ppc64_obsd_nat_target);
> + Index: patches/patch-gdb_ppc64-obsd-tdep_c
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_ppc64-obsd-tdep_c,v
> diff -u -p -r1.3 patch-gdb_ppc64-obsd-tdep_c ---
> patches/patch-gdb_ppc64-obsd-tdep_c 9 Nov 2024 13:33:19 -0000 1.3 +++
> patches/patch-gdb_ppc64-obsd-tdep_c 9 Nov 2024 21:39:18 -0000 @@ -1,7
> +1,7 @@ Index: gdb/ppc64-obsd-tdep.c --- gdb/ppc64-obsd-tdep.c.orig
> +++ gdb/ppc64-obsd-tdep.c -@@ -0,0 +1,411 @@ +@@ -0,0 +1,407 @@ +/*
> Target-dependent code for OpenBSD/powerpc64. + + Copyright (C) 2004,
> 2005, 2006 Free Software Foundation, Inc. @@ -375,14 +375,10 @@ Index:
> gdb/ppc64-obsd-tdep.c +} + + -+/* Provide a prototype to silence
> -Wmissing-prototypes. */ -+void _initialize_ppc64obsd_tdep (void); -+
> ++void _initialize_ppc64obsd_tdep (); +void -+_initialize_ppc64obsd_tdep
> (void) ++_initialize_ppc64obsd_tdep () +{ -+ gdbarch_register_osabi
> (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD, -+ ppc64obsd_init_abi);
> + gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, +
> GDB_OSABI_OPENBSD, ppc64obsd_init_abi); +

Reply via email to