Sunday, December 23, 2018

[wip] devel/gdb update

FWIW, here's a WIP patch to update gdb to 8.2.1. It's still a bit rough
around the edges, but working so far on amd64, i386, powerpc, hppa, and
to some extent on arm and aarch64. It does *not* work on sparc64, which
is a blocker. Feel free to play around with it.


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/gdb/Makefile,v
retrieving revision 1.58
diff -u -p -r1.58 Makefile
--- Makefile 1 Nov 2018 20:36:08 -0000 1.58
+++ Makefile 23 Dec 2018 18:47:08 -0000
@@ -3,8 +3,7 @@
COMMENT= GNU debugger
CATEGORIES= devel

-DISTNAME= gdb-7.12.1
-REVISION= 5
+DISTNAME= gdb-8.2.1

HOMEPAGE= https://www.gnu.org/software/gdb/

@@ -19,7 +18,7 @@ EXTRACT_SUFX= .tar.xz

MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC} ${WRKSRC}/gdb

-WANTLIB = c expat kvm m ncurses pthread ${MODPY_WANTLIB} ${COMPILER_LIBCXX} util
+WANTLIB = c expat kvm m curses pthread ${MODPY_WANTLIB} ${COMPILER_LIBCXX} util

COMPILER = base-clang ports-gcc base-gcc

@@ -29,6 +28,8 @@ CONFIGURE_ARGS= --program-prefix=e \
--disable-nls \
--without-guile \
--without-lzma \
+ --without-gmp \
+ --without-mpfr \
--enable-target=all \
--with-python=${MODPY_BIN}

@@ -38,6 +39,9 @@ MODULES += lang/python
LIB_DEPENDS += ${MODPY_LIB_DEPENDS}
TEST_DEPENDS += devel/dejagnu
MODPY_BUILDDEP = No
+
+# for max_align_t configure test
+CFLAGS += -std=gnu11

post-install:
${MODPY_BIN} -m compileall ${PREFIX}/share/gdb/python
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/gdb/distinfo,v
retrieving revision 1.22
diff -u -p -r1.22 distinfo
--- distinfo 28 Jan 2017 21:38:15 -0000 1.22
+++ distinfo 23 Dec 2018 18:47:08 -0000
@@ -1,2 +1,2 @@
-SHA256 (gdb/gdb-7.12.1.tar.xz) = RgdoC5c9PsksMK0Cnxt9veOHaGnms6EX2KfpAIERMYY=
-SIZE (gdb/gdb-7.12.1.tar.xz) = 19225392
+SHA256 (gdb/gdb-8.2.1.tar.xz) = CmpDKQegPFyOqtPDz/1QwApAw6XjxAOUQGJLrnA/IgI=
+SIZE (gdb/gdb-8.2.1.tar.xz) = 20170388
Index: patches/patch-bfd_config_bfd
===================================================================
RCS file: /cvs/ports/devel/gdb/patches/patch-bfd_config_bfd,v
retrieving revision 1.3
diff -u -p -r1.3 patch-bfd_config_bfd
--- patches/patch-bfd_config_bfd 10 Jul 2018 11:03:46 -0000 1.3
+++ patches/patch-bfd_config_bfd 23 Dec 2018 18:47:08 -0000
@@ -1,7 +1,16 @@
$OpenBSD: patch-bfd_config_bfd,v 1.3 2018/07/10 11:03:46 kettenis Exp $
---- bfd/config.bfd.orig Sat Jan 21 05:48:42 2017
-+++ bfd/config.bfd Tue Mar 7 22:55:11 2017
-@@ -202,6 +202,11 @@ case "${targ}" in
+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* | \
+@@ -259,6 +258,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
;;
@@ -13,3 +22,12 @@ $OpenBSD: patch-bfd_config_bfd,v 1.3 201
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"
+@@ -354,7 +358,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: /cvs/ports/devel/gdb/patches/patch-bfd_elf_c,v
retrieving revision 1.9
diff -u -p -r1.9 patch-bfd_elf_c
--- patches/patch-bfd_elf_c 9 Oct 2016 11:39:20 -0000 1.9
+++ patches/patch-bfd_elf_c 23 Dec 2018 18:47:08 -0000
@@ -1,7 +1,8 @@
$OpenBSD: patch-bfd_elf_c,v 1.9 2016/10/09 11:39:20 pascal Exp $
---- bfd/elf.c.orig Fri Oct 7 19:09:21 2016
-+++ bfd/elf.c Fri Oct 7 20:53:14 2016
-@@ -9866,6 +9866,11 @@ elfcore_grok_openbsd_procinfo (bfd *abfd, Elf_Internal
+Index: bfd/elf.c
+--- bfd/elf.c.orig
++++ bfd/elf.c
+@@ -10261,6 +10261,11 @@ elfcore_grok_openbsd_procinfo (bfd *abfd, Elf_Internal
static bfd_boolean
elfcore_grok_openbsd_note (bfd *abfd, Elf_Internal_Note *note)
{
Index: patches/patch-gdb_Makefile_in
===================================================================
RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_Makefile_in,v
retrieving revision 1.3
diff -u -p -r1.3 patch-gdb_Makefile_in
--- patches/patch-gdb_Makefile_in 10 Jul 2018 11:03:46 -0000 1.3
+++ patches/patch-gdb_Makefile_in 23 Dec 2018 18:47:08 -0000
@@ -2,23 +2,29 @@ $OpenBSD: patch-gdb_Makefile_in,v 1.3 20
Index: gdb/Makefile.in
--- gdb/Makefile.in.orig
+++ gdb/Makefile.in
-@@ -644,7 +644,8 @@ 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 = \
-- aarch64-tdep.o aarch64-linux-tdep.o aarch64-newlib-tdep.o aarch64-insn.o \
-+ aarch64-tdep.o aarch64-linux-tdep.o \
-+ aarch64-newlib-tdep.o aarch64obsd-tdep.o aarch64-insn.o \
- alphabsd-tdep.o alphafbsd-tdep.o alpha-linux-tdep.o alpha-mdebug-tdep.o \
- alphanbsd-tdep.o alphaobsd-tdep.o alpha-tdep.o \
- amd64fbsd-tdep.o amd64-darwin-tdep.o amd64-dicos-tdep.o \
-@@ -1663,7 +1664,8 @@ MAKEOVERRIDES=
+@@ -117,8 +117,6 @@ srcdir = @srcdir@
+ VPATH = @srcdir@
+ top_srcdir = @top_srcdir@

- ALLDEPFILES = \
- aarch64-tdep.c aarch64-linux-tdep.c aarch64-newlib-tdep.c \
-- aarch64-linux-nat.c \
-+ aarch64obsd-tdep.c \
-+ aarch64-linux-nat.c aarch64obsd-nat.c \
+-include $(srcdir)/silent-rules.mk
+-
+ # Note that these are overridden by GNU make-specific code below if
+ # GNU make is used. The overrides implement dependency tracking.
+ COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
+@@ -646,6 +644,7 @@ ALL_64_TARGET_OBS = \
+ aarch64-fbsd-tdep.o \
+ aarch64-linux-tdep.o \
+ aarch64-newlib-tdep.o \
++ aarch64-obsd-tdep.o \
+ aarch64-tdep.o \
+ alpha-bsd-tdep.o \
+ alpha-linux-tdep.o \
+@@ -2187,6 +2186,8 @@ ALLDEPFILES = \
+ aarch64-linux-nat.c \
+ aarch64-linux-tdep.c \
+ aarch64-newlib-tdep.c \
++ aarch64-obsd-nat.c \
++ aarch64-obsd-tdep.c \
+ aarch64-tdep.c \
aix-thread.c \
- alphabsd-nat.c alpha-linux-nat.c \
- alpha-tdep.c alpha-mdebug-tdep.c \
+ alpha-bsd-nat.c \
Index: patches/patch-gdb_aarch64-obsd-nat_c
===================================================================
RCS file: patches/patch-gdb_aarch64-obsd-nat_c
diff -N patches/patch-gdb_aarch64-obsd-nat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_aarch64-obsd-nat_c 23 Dec 2018 18:47:08 -0000
@@ -0,0 +1,211 @@
+$OpenBSD$
+
+Index: gdb/aarch64-obsd-nat.c
+--- gdb/aarch64-obsd-nat.c.orig
++++ gdb/aarch64-obsd-nat.c
+@@ -0,0 +1,205 @@
++/* Native-dependent code for OpenBSD/arm64 (AArch64)
++
++ Copyright (C) 2011-2017 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 <sys/types.h>
++#include <sys/ptrace.h>
++#include <machine/reg.h>
++
++#include "aarch64-tdep.h"
++#include "inf-ptrace.h"
++
++/* Fill GDB's register array with the general-purpose register values
++ from the current thread. */
++
++static void
++fetch_gregs_from_thread (struct regcache *regcache)
++{
++ struct reg regs;
++ pid_t pid;
++ int regno;
++ int ret;
++
++ pid = ptid_get_pid (inferior_ptid);
++
++ ret = ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0);
++ if (ret < 0)
++ perror_with_name (_("Unable to fetch general registers."));
++
++ for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_FP_REGNUM; regno++)
++ regcache_raw_supply (regcache, regno, &regs.r_reg[regno]);
++ regcache_raw_supply (regcache, AARCH64_LR_REGNUM, &regs.r_lr);
++ regcache_raw_supply (regcache, AARCH64_SP_REGNUM, &regs.r_sp);
++ regcache_raw_supply (regcache, AARCH64_PC_REGNUM, &regs.r_pc);
++ regcache_raw_supply (regcache, AARCH64_CPSR_REGNUM, &regs.r_spsr);
++}
++
++/* Store to the current thread the valid general-purpose register
++ values in the GDB's register array. */
++
++static void
++store_gregs_to_thread (const struct regcache *regcache)
++{
++ struct reg regs;
++ pid_t pid;
++ int regno;
++ int ret;
++
++ pid = ptid_get_pid (inferior_ptid);
++
++ // fetch old values as only 'valid' entries will be replaced.
++ ret = ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0);
++ if (ret < 0) {
++ perror_with_name (_("Unable to store general registers."));
++ return;
++ }
++
++ for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_FP_REGNUM; regno++)
++ if (REG_VALID == regcache_register_status (regcache, regno))
++ regcache_raw_collect (regcache, regno, &regs.r_reg[regno]);
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_LR_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_LR_REGNUM, &regs.r_lr);
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_SP_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_SP_REGNUM, &regs.r_sp);
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_PC_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_PC_REGNUM, &regs.r_pc);
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_CPSR_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_CPSR_REGNUM, &regs.r_spsr);
++
++ ret = ptrace(PT_SETREGS, pid, (caddr_t)&regs, 0);
++ if (ret < 0)
++ perror_with_name (_("Unable to store general registers."));
++}
++
++/* Fill GDB's register array with the fp/simd register values
++ from the current thread. */
++
++static void
++fetch_fpregs_from_thread (struct regcache *regcache)
++{
++ int ret;
++ pid_t pid;
++ int regno;
++ struct fpreg fpregs;
++
++ pid = ptid_get_pid (inferior_ptid);
++
++ ret = ptrace(PT_GETFPREGS, pid, (caddr_t)&fpregs, 0);
++ if (ret < 0) {
++ perror_with_name (_("Unable to fetch general registers."));
++ return;
++ }
++
++ for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
++ regcache_raw_supply (regcache, regno, &fpregs.fp_reg[regno]);
++
++ regcache_raw_supply (regcache, AARCH64_FPSR_REGNUM, &fpregs.fp_sr);
++ regcache_raw_supply (regcache, AARCH64_FPCR_REGNUM, &fpregs.fp_cr);
++}
++
++/* Store to the current thread the valid fp/simd register
++ values in the GDB's register array. */
++
++static void
++store_fpregs_to_thread (const struct regcache *regcache)
++{
++ int ret;
++ pid_t pid;
++ int regno;
++ struct fpreg fpregs;
++
++ pid = ptid_get_pid (inferior_ptid);
++
++ ret = ptrace(PT_GETFPREGS, pid, (caddr_t)&fpregs, 0);
++ if (ret < 0) {
++ perror_with_name (_("Unable to store general registers."));
++ return;
++ }
++
++ for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
++ if (REG_VALID == regcache_register_status (regcache, regno))
++ regcache_raw_collect (regcache, regno, &fpregs.fp_reg[regno]);
++
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_FPSR_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_FPSR_REGNUM, &fpregs.fp_sr);
++ if (REG_VALID == regcache_register_status (regcache, AARCH64_FPCR_REGNUM))
++ regcache_raw_collect (regcache, AARCH64_FPCR_REGNUM, &fpregs.fp_cr);
++
++ ret = ptrace(PT_SETFPREGS, pid, (caddr_t)&fpregs, 0);
++ if (ret < 0)
++ perror_with_name (_("Unable to store general registers."));
++}
++
++/* Implement the "to_fetch_register" target_ops method. */
++
++static void
++aarch64_obsd_fetch_inferior_registers (struct target_ops *ops,
++ struct regcache *regcache,
++ int regno)
++{
++ if (regno == -1)
++ {
++ fetch_gregs_from_thread (regcache);
++ fetch_fpregs_from_thread (regcache);
++ }
++ else if (regno < AARCH64_V0_REGNUM)
++ fetch_gregs_from_thread (regcache);
++ else
++ fetch_fpregs_from_thread (regcache);
++}
++
++/* Implement the "to_store_register" target_ops method. */
++
++static void
++aarch64_obsd_store_inferior_registers (struct target_ops *ops,
++ struct regcache *regcache,
++ int regno)
++{
++ if (regno == -1)
++ {
++ store_gregs_to_thread (regcache);
++ store_fpregs_to_thread (regcache);
++ }
++ else if (regno < AARCH64_V0_REGNUM)
++ store_gregs_to_thread (regcache);
++ else
++ store_fpregs_to_thread (regcache);
++}
++
++
++/* -Wmissing-prototypes. */
++void _initialize_aarch64_obsd_nat (void);
++
++void
++_initialize_aarch64_obsd_nat (void)
++{
++ struct target_ops *t;
++
++ t = inf_ptrace_target ();
++
++ /* Add our register access methods. */
++ t->to_fetch_registers = aarch64_obsd_fetch_inferior_registers;
++ t->to_store_registers = aarch64_obsd_store_inferior_registers;
++
++ /* Register the target. */
++ add_target (t);
++}
Index: patches/patch-gdb_aarch64-obsd-tdep_c
===================================================================
RCS file: patches/patch-gdb_aarch64-obsd-tdep_c
diff -N patches/patch-gdb_aarch64-obsd-tdep_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_aarch64-obsd-tdep_c 23 Dec 2018 18:47:08 -0000
@@ -0,0 +1,117 @@
+$OpenBSD$
+
+Index: gdb/aarch64-obsd-tdep.c
+--- gdb/aarch64-obsd-tdep.c.orig
++++ gdb/aarch64-obsd-tdep.c
+@@ -0,0 +1,111 @@
++/* Target-dependent code for OpenBSD/aarch64.
++
++ Copyright (C) 2006-2017 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 "osabi.h"
++#include "regset.h"
++#include "trad-frame.h"
++#include "tramp-frame.h"
++
++#include "aarch64-tdep.h"
++#include "obsd-tdep.h"
++#include "solib-svr4.h"
++
++/* The general-purpose regset consists of 31 X registers, plus SP, PC,
++ and SPSR and TPIDR registers. */
++#define AARCH64_OBSD_SIZEOF_GREGSET (35 * X_REGISTER_SIZE)
++
++/* The fp regset consists of 32 V registers, plus FPSR and FPCR which
++ are 4 bytes wide each, and the whole structure is padded to 128 bit
++ alignment. */
++#define AARCH64_OBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
++
++/* Register maps. */
++
++static const struct regcache_map_entry aarch64_obsd_gregmap[] =
++ {
++ { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
++ { 1, AARCH64_SP_REGNUM, 8 },
++ { 1, AARCH64_PC_REGNUM, 8 },
++ { 1, AARCH64_CPSR_REGNUM, 8 },
++ { 0 }
++ };
++
++static const struct regcache_map_entry aarch64_obsd_fpregmap[] =
++ {
++ { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
++ { 1, AARCH64_FPSR_REGNUM, 4 },
++ { 1, AARCH64_FPCR_REGNUM, 4 },
++ { 0 }
++ };
++
++/* Register set definitions. */
++
++const struct regset aarch64_obsd_gregset =
++ {
++ aarch64_obsd_gregmap,
++ regcache_supply_regset, regcache_collect_regset
++ };
++
++const struct regset aarch64_obsd_fpregset =
++ {
++ aarch64_obsd_fpregmap,
++ regcache_supply_regset, regcache_collect_regset
++ };
++
++static void
++aarch64_obsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
++ iterate_over_regset_sections_cb *cb,
++ void *cb_data,
++ const struct regcache *regcache)
++{
++ cb (".reg", AARCH64_OBSD_SIZEOF_GREGSET, AARCH64_OBSD_SIZEOF_GREGSET,
++ &aarch64_obsd_gregset, NULL, cb_data);
++ cb (".reg2", AARCH64_OBSD_SIZEOF_FPREGSET, AARCH64_OBSD_SIZEOF_FPREGSET,
++ &aarch64_obsd_fpregset, NULL, cb_data);
++}
++
++
++static void
++aarch64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
++{
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++
++ /* OpenBSD/aarch64 uses SVR4-style shared libraries. */
++ set_solib_svr4_fetch_link_map_offsets
++ (gdbarch, svr4_lp64_fetch_link_map_offsets);
++ set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
++
++ /* Enable longjmp. */
++ tdep->jb_pc = 13;
++
++ set_gdbarch_iterate_over_regset_sections
++ (gdbarch, aarch64_obsd_iterate_over_regset_sections);
++}
++
++
++/* Provide a prototype to silence -Wmissing-prototypes. */
++extern initialize_file_ftype _initialize_aarch64obsd_tdep;
++
++void
++_initialize_aarch64obsd_tdep (void)
++{
++ gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_OPENBSD,
++ aarch64obsd_init_abi);
++}
Index: patches/patch-gdb_aarch64obsd-nat_c
===================================================================
RCS file: patches/patch-gdb_aarch64obsd-nat_c
diff -N patches/patch-gdb_aarch64obsd-nat_c
--- patches/patch-gdb_aarch64obsd-nat_c 10 Jul 2018 11:03:46 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,210 +0,0 @@
-$OpenBSD: patch-gdb_aarch64obsd-nat_c,v 1.1 2018/07/10 11:03:46 kettenis Exp $
-Index: gdb/aarch64obsd-nat.c
---- gdb/aarch64obsd-nat.c.orig
-+++ gdb/aarch64obsd-nat.c
-@@ -0,0 +1,205 @@
-+/* Native-dependent code for OpenBSD/arm64 (AArch64)
-+
-+ Copyright (C) 2011-2017 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 <sys/types.h>
-+#include <sys/ptrace.h>
-+#include <machine/reg.h>
-+
-+#include "aarch64-tdep.h"
-+#include "inf-ptrace.h"
-+
-+/* Fill GDB's register array with the general-purpose register values
-+ from the current thread. */
-+
-+static void
-+fetch_gregs_from_thread (struct regcache *regcache)
-+{
-+ struct reg regs;
-+ pid_t pid;
-+ int regno;
-+ int ret;
-+
-+ pid = ptid_get_pid (inferior_ptid);
-+
-+ ret = ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0);
-+ if (ret < 0)
-+ perror_with_name (_("Unable to fetch general registers."));
-+
-+ for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_FP_REGNUM; regno++)
-+ regcache_raw_supply (regcache, regno, &regs.r_reg[regno]);
-+ regcache_raw_supply (regcache, AARCH64_LR_REGNUM, &regs.r_lr);
-+ regcache_raw_supply (regcache, AARCH64_SP_REGNUM, &regs.r_sp);
-+ regcache_raw_supply (regcache, AARCH64_PC_REGNUM, &regs.r_pc);
-+ regcache_raw_supply (regcache, AARCH64_CPSR_REGNUM, &regs.r_spsr);
-+}
-+
-+/* Store to the current thread the valid general-purpose register
-+ values in the GDB's register array. */
-+
-+static void
-+store_gregs_to_thread (const struct regcache *regcache)
-+{
-+ struct reg regs;
-+ pid_t pid;
-+ int regno;
-+ int ret;
-+
-+ pid = ptid_get_pid (inferior_ptid);
-+
-+ // fetch old values as only 'valid' entries will be replaced.
-+ ret = ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0);
-+ if (ret < 0) {
-+ perror_with_name (_("Unable to store general registers."));
-+ return;
-+ }
-+
-+ for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_FP_REGNUM; regno++)
-+ if (REG_VALID == regcache_register_status (regcache, regno))
-+ regcache_raw_collect (regcache, regno, &regs.r_reg[regno]);
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_LR_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_LR_REGNUM, &regs.r_lr);
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_SP_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_SP_REGNUM, &regs.r_sp);
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_PC_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_PC_REGNUM, &regs.r_pc);
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_CPSR_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_CPSR_REGNUM, &regs.r_spsr);
-+
-+ ret = ptrace(PT_SETREGS, pid, (caddr_t)&regs, 0);
-+ if (ret < 0)
-+ perror_with_name (_("Unable to store general registers."));
-+}
-+
-+/* Fill GDB's register array with the fp/simd register values
-+ from the current thread. */
-+
-+static void
-+fetch_fpregs_from_thread (struct regcache *regcache)
-+{
-+ int ret;
-+ pid_t pid;
-+ int regno;
-+ struct fpreg fpregs;
-+
-+ pid = ptid_get_pid (inferior_ptid);
-+
-+ ret = ptrace(PT_GETFPREGS, pid, (caddr_t)&fpregs, 0);
-+ if (ret < 0) {
-+ perror_with_name (_("Unable to fetch general registers."));
-+ return;
-+ }
-+
-+ for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
-+ regcache_raw_supply (regcache, regno, &fpregs.fp_reg[regno]);
-+
-+ regcache_raw_supply (regcache, AARCH64_FPSR_REGNUM, &fpregs.fp_sr);
-+ regcache_raw_supply (regcache, AARCH64_FPCR_REGNUM, &fpregs.fp_cr);
-+}
-+
-+/* Store to the current thread the valid fp/simd register
-+ values in the GDB's register array. */
-+
-+static void
-+store_fpregs_to_thread (const struct regcache *regcache)
-+{
-+ int ret;
-+ pid_t pid;
-+ int regno;
-+ struct fpreg fpregs;
-+
-+ pid = ptid_get_pid (inferior_ptid);
-+
-+ ret = ptrace(PT_GETFPREGS, pid, (caddr_t)&fpregs, 0);
-+ if (ret < 0) {
-+ perror_with_name (_("Unable to store general registers."));
-+ return;
-+ }
-+
-+ for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
-+ if (REG_VALID == regcache_register_status (regcache, regno))
-+ regcache_raw_collect (regcache, regno, &fpregs.fp_reg[regno]);
-+
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_FPSR_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_FPSR_REGNUM, &fpregs.fp_sr);
-+ if (REG_VALID == regcache_register_status (regcache, AARCH64_FPCR_REGNUM))
-+ regcache_raw_collect (regcache, AARCH64_FPCR_REGNUM, &fpregs.fp_cr);
-+
-+ ret = ptrace(PT_SETFPREGS, pid, (caddr_t)&fpregs, 0);
-+ if (ret < 0)
-+ perror_with_name (_("Unable to store general registers."));
-+}
-+
-+/* Implement the "to_fetch_register" target_ops method. */
-+
-+static void
-+aarch64_obsd_fetch_inferior_registers (struct target_ops *ops,
-+ struct regcache *regcache,
-+ int regno)
-+{
-+ if (regno == -1)
-+ {
-+ fetch_gregs_from_thread (regcache);
-+ fetch_fpregs_from_thread (regcache);
-+ }
-+ else if (regno < AARCH64_V0_REGNUM)
-+ fetch_gregs_from_thread (regcache);
-+ else
-+ fetch_fpregs_from_thread (regcache);
-+}
-+
-+/* Implement the "to_store_register" target_ops method. */
-+
-+static void
-+aarch64_obsd_store_inferior_registers (struct target_ops *ops,
-+ struct regcache *regcache,
-+ int regno)
-+{
-+ if (regno == -1)
-+ {
-+ store_gregs_to_thread (regcache);
-+ store_fpregs_to_thread (regcache);
-+ }
-+ else if (regno < AARCH64_V0_REGNUM)
-+ store_gregs_to_thread (regcache);
-+ else
-+ store_fpregs_to_thread (regcache);
-+}
-+
-+
-+/* -Wmissing-prototypes. */
-+void _initialize_aarch64_obsd_nat (void);
-+
-+void
-+_initialize_aarch64_obsd_nat (void)
-+{
-+ struct target_ops *t;
-+
-+ t = inf_ptrace_target ();
-+
-+ /* Add our register access methods. */
-+ t->to_fetch_registers = aarch64_obsd_fetch_inferior_registers;
-+ t->to_store_registers = aarch64_obsd_store_inferior_registers;
-+
-+ /* Register the target. */
-+ add_target (t);
-+}
Index: patches/patch-gdb_aarch64obsd-tdep_c
===================================================================
RCS file: patches/patch-gdb_aarch64obsd-tdep_c
diff -N patches/patch-gdb_aarch64obsd-tdep_c
--- patches/patch-gdb_aarch64obsd-tdep_c 10 Jul 2018 11:03:46 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-$OpenBSD: patch-gdb_aarch64obsd-tdep_c,v 1.1 2018/07/10 11:03:46 kettenis Exp $
-Index: gdb/aarch64obsd-tdep.c
---- gdb/aarch64obsd-tdep.c.orig
-+++ gdb/aarch64obsd-tdep.c
-@@ -0,0 +1,111 @@
-+/* Target-dependent code for OpenBSD/aarch64.
-+
-+ Copyright (C) 2006-2017 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 "osabi.h"
-+#include "regset.h"
-+#include "trad-frame.h"
-+#include "tramp-frame.h"
-+
-+#include "aarch64-tdep.h"
-+#include "obsd-tdep.h"
-+#include "solib-svr4.h"
-+
-+/* The general-purpose regset consists of 31 X registers, plus SP, PC,
-+ and SPSR and TPIDR registers. */
-+#define AARCH64_OBSD_SIZEOF_GREGSET (35 * X_REGISTER_SIZE)
-+
-+/* The fp regset consists of 32 V registers, plus FPSR and FPCR which
-+ are 4 bytes wide each, and the whole structure is padded to 128 bit
-+ alignment. */
-+#define AARCH64_OBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
-+
-+/* Register maps. */
-+
-+static const struct regcache_map_entry aarch64_obsd_gregmap[] =
-+ {
-+ { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
-+ { 1, AARCH64_SP_REGNUM, 8 },
-+ { 1, AARCH64_PC_REGNUM, 8 },
-+ { 1, AARCH64_CPSR_REGNUM, 8 },
-+ { 0 }
-+ };
-+
-+static const struct regcache_map_entry aarch64_obsd_fpregmap[] =
-+ {
-+ { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
-+ { 1, AARCH64_FPSR_REGNUM, 4 },
-+ { 1, AARCH64_FPCR_REGNUM, 4 },
-+ { 0 }
-+ };
-+
-+/* Register set definitions. */
-+
-+const struct regset aarch64_obsd_gregset =
-+ {
-+ aarch64_obsd_gregmap,
-+ regcache_supply_regset, regcache_collect_regset
-+ };
-+
-+const struct regset aarch64_obsd_fpregset =
-+ {
-+ aarch64_obsd_fpregmap,
-+ regcache_supply_regset, regcache_collect_regset
-+ };
-+
-+static void
-+aarch64_obsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
-+ iterate_over_regset_sections_cb *cb,
-+ void *cb_data,
-+ const struct regcache *regcache)
-+{
-+ cb (".reg", AARCH64_OBSD_SIZEOF_GREGSET, &aarch64_obsd_gregset,
-+ NULL, cb_data);
-+ cb (".reg2", AARCH64_OBSD_SIZEOF_FPREGSET, &aarch64_obsd_fpregset,
-+ NULL, cb_data);
-+}
-+
-+
-+static void
-+aarch64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-+{
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-+
-+ /* OpenBSD/aarch64 uses SVR4-style shared libraries. */
-+ set_solib_svr4_fetch_link_map_offsets
-+ (gdbarch, svr4_lp64_fetch_link_map_offsets);
-+ set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
-+
-+ /* Enable longjmp. */
-+ tdep->jb_pc = 13;
-+
-+ set_gdbarch_iterate_over_regset_sections
-+ (gdbarch, aarch64_obsd_iterate_over_regset_sections);
-+}
-+
-+
-+/* Provide a prototype to silence -Wmissing-prototypes. */
-+extern initialize_file_ftype _initialize_aarch64obsd_tdep;
-+
-+void
-+_initialize_aarch64obsd_tdep (void)
-+{
-+ gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_OPENBSD_ELF,
-+ aarch64obsd_init_abi);
-+}
Index: patches/patch-gdb_alpha-bsd-nat_c
===================================================================
RCS file: patches/patch-gdb_alpha-bsd-nat_c
diff -N patches/patch-gdb_alpha-bsd-nat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_alpha-bsd-nat_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,55 @@
+$OpenBSD$
+
+Index: gdb/alpha-bsd-nat.c
+--- gdb/alpha-bsd-nat.c.orig
++++ gdb/alpha-bsd-nat.c
+@@ -98,7 +98,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache
+ {
+ struct reg gregs;
+
+- if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_GETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ perror_with_name (_("Couldn't get registers"));
+
+@@ -112,7 +112,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache
+ {
+ struct fpreg fpregs;
+
+- if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_GETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+@@ -129,13 +129,13 @@ alpha_bsd_nat_target::store_registers (struct regcache
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg gregs;
+- if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_GETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ perror_with_name (_("Couldn't get registers"));
+
+ alphabsd_fill_reg (regcache, (char *) &gregs, regno);
+
+- if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_SETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ perror_with_name (_("Couldn't write registers"));
+
+@@ -148,13 +148,13 @@ alpha_bsd_nat_target::store_registers (struct regcache
+ {
+ struct fpreg fpregs;
+
+- if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_GETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
+
+- if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
++ if (ptrace (PT_SETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't write floating point status"));
+ }
Index: patches/patch-gdb_alphabsd-nat_c
===================================================================
RCS file: patches/patch-gdb_alphabsd-nat_c
diff -N patches/patch-gdb_alphabsd-nat_c
--- patches/patch-gdb_alphabsd-nat_c 3 Sep 2016 13:48:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-$OpenBSD: patch-gdb_alphabsd-nat_c,v 1.1 2016/09/03 13:48:39 jca Exp $
---- gdb/alphabsd-nat.c.orig Wed Feb 10 04:19:39 2016
-+++ gdb/alphabsd-nat.c Sat May 14 22:54:35 2016
-@@ -91,7 +91,7 @@ alphabsd_fetch_inferior_registers (struct target_ops *
- {
- struct reg gregs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -105,7 +105,7 @@ alphabsd_fetch_inferior_registers (struct target_ops *
- {
- struct fpreg fpregs;
-
-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
-
-@@ -123,13 +123,13 @@ alphabsd_store_inferior_registers (struct target_ops *
- if (regno == -1 || getregs_supplies (regno))
- {
- struct reg gregs;
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
- alphabsd_fill_reg (regcache, (char *) &gregs, regno);
-
-- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
-
-@@ -142,13 +142,13 @@ alphabsd_store_inferior_registers (struct target_ops *
- {
- struct fpreg fpregs;
-
-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
-
- alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
-
-- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
- }
Index: patches/patch-gdb_arm-bsd-tdep_c
===================================================================
RCS file: patches/patch-gdb_arm-bsd-tdep_c
diff -N patches/patch-gdb_arm-bsd-tdep_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_arm-bsd-tdep_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,41 @@
+$OpenBSD$
+
+Index: gdb/arm-bsd-tdep.c
+--- gdb/arm-bsd-tdep.c.orig
++++ gdb/arm-bsd-tdep.c
+@@ -30,15 +30,12 @@
+ #define ARMBSD_SIZEOF_GREGS (17 * 4)
+
+ /* Sizeof `struct fpreg' in <machine/reg.h. */
+-#define ARMBSD_SIZEOF_FPREGS ((1 + (8 * 3)) * 4)
++#define ARMBSD_SIZEOF_FPREGS (32 * 8 + 4 + 4)
+
+ static int
+ armbsd_fpreg_offset (int regnum)
+ {
+- if (regnum == ARM_FPS_REGNUM)
+- return 0;
+-
+- return 4 + (regnum - ARM_F0_REGNUM) * 12;
++ return (regnum - ARM_D0_REGNUM) * 8;
+ }
+
+ /* Supply register REGNUM from the buffer specified by FPREGS and LEN
+@@ -55,7 +52,7 @@ armbsd_supply_fpregset (const struct regset *regset,
+
+ gdb_assert (len >= ARMBSD_SIZEOF_FPREGS);
+
+- for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
++ for (i = ARM_D0_REGNUM; i <= ARM_FPSCR_REGNUM; i++)
+ {
+ if (regnum == i || regnum == -1)
+ regcache->raw_supply (i, regs + armbsd_fpreg_offset (i));
+@@ -83,7 +80,7 @@ armbsd_supply_gregset (const struct regset *regset,
+ }
+
+ if (regnum == ARM_PS_REGNUM || regnum == -1)
+- regcache->raw_supply (i, regs + 16 * 4);
++ regcache->raw_supply (ARM_PS_REGNUM, regs + 16 * 4);
+
+ if (len >= ARMBSD_SIZEOF_GREGS + ARMBSD_SIZEOF_FPREGS)
+ {
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_arm-nbsd-nat_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,158 @@
+$OpenBSD$
+
+Index: gdb/arm-nbsd-nat.c
+--- gdb/arm-nbsd-nat.c.orig
++++ gdb/arm-nbsd-nat.c
+@@ -71,9 +71,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
+@@ -82,7 +82,7 @@ fetch_register (struct regcache *regcache, int regno)
+ struct reg inferior_registers;
+ int ret;
+
+- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+
+ if (ret < 0)
+@@ -131,7 +131,7 @@ fetch_regs (struct regcache *regcache)
+ int ret;
+ int regno;
+
+- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+
+ if (ret < 0)
+@@ -149,7 +149,7 @@ fetch_fp_register (struct regcache *regcache, int regn
+ struct fpreg inferior_fp_registers;
+ int ret;
+
+- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+
+ if (ret < 0)
+@@ -162,12 +162,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;
+ }
+ }
+@@ -179,7 +179,7 @@ fetch_fp_regs (struct regcache *regcache)
+ int ret;
+ int regno;
+
+- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+
+ if (ret < 0)
+@@ -192,7 +192,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)
+ {
+@@ -216,7 +216,7 @@ store_register (const struct regcache *regcache, int r
+ struct reg inferior_registers;
+ int ret;
+
+- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+
+ if (ret < 0)
+@@ -274,7 +274,7 @@ store_register (const struct regcache *regcache, int r
+ break;
+ }
+
+- ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_SETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+
+ if (ret < 0)
+@@ -316,7 +316,7 @@ store_regs (const struct regcache *regcache)
+ inferior_registers.r_pc = pc_val | psr_val;
+ }
+
+- ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_SETREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+
+ if (ret < 0)
+@@ -329,7 +329,7 @@ store_fp_register (const struct regcache *regcache, in
+ struct fpreg inferior_fp_registers;
+ int ret;
+
+- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+
+ if (ret < 0)
+@@ -342,16 +342,16 @@ 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;
+ }
+
+- ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
++ ret = ptrace (PT_SETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+
+ if (ret < 0)
+@@ -368,12 +368,12 @@ 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 (),
++ ret = ptrace (PT_SETFPREGS, get_ptrace_pid (regcache->ptid ()),
+ (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+
+ if (ret < 0)
+@@ -381,7 +381,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_armbsd-tdep_c
===================================================================
RCS file: patches/patch-gdb_armbsd-tdep_c
diff -N patches/patch-gdb_armbsd-tdep_c
--- patches/patch-gdb_armbsd-tdep_c 18 Jun 2018 14:53:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-$OpenBSD: patch-gdb_armbsd-tdep_c,v 1.1 2018/06/18 14:53:12 kettenis Exp $
-
-Index: gdb/armbsd-tdep.c
---- gdb/armbsd-tdep.c.orig
-+++ gdb/armbsd-tdep.c
-@@ -30,15 +30,12 @@
- #define ARMBSD_SIZEOF_GREGS (17 * 4)
-
- /* Sizeof `struct fpreg' in <machine/reg.h. */
--#define ARMBSD_SIZEOF_FPREGS ((1 + (8 * 3)) * 4)
-+#define ARMBSD_SIZEOF_FPREGS (32 * 8 + 4 + 4)
-
- static int
- armbsd_fpreg_offset (int regnum)
- {
-- if (regnum == ARM_FPS_REGNUM)
-- return 0;
--
-- return 4 + (regnum - ARM_F0_REGNUM) * 12;
-+ return (regnum - ARM_D0_REGNUM) * 8;
- }
-
- /* Supply register REGNUM from the buffer specified by FPREGS and LEN
-@@ -55,7 +52,7 @@ armbsd_supply_fpregset (const struct regset *regset,
-
- gdb_assert (len >= ARMBSD_SIZEOF_FPREGS);
-
-- for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
-+ for (i = ARM_D0_REGNUM; i <= ARM_FPSCR_REGNUM; i++)
- {
- if (regnum == i || regnum == -1)
- regcache_raw_supply (regcache, i, regs + armbsd_fpreg_offset (i));
-@@ -83,7 +80,7 @@ armbsd_supply_gregset (const struct regset *regset,
- }
-
- if (regnum == ARM_PS_REGNUM || regnum == -1)
-- regcache_raw_supply (regcache, i, regs + 16 * 4);
-+ regcache_raw_supply (regcache, ARM_PS_REGNUM, regs + 16 * 4);
-
- if (len >= ARMBSD_SIZEOF_GREGS + ARMBSD_SIZEOF_FPREGS)
- {
Index: patches/patch-gdb_armnbsd-nat_c
===================================================================
RCS file: patches/patch-gdb_armnbsd-nat_c
diff -N patches/patch-gdb_armnbsd-nat_c
--- patches/patch-gdb_armnbsd-nat_c 24 Jan 2018 00:19:56 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,140 +0,0 @@
-$OpenBSD: patch-gdb_armnbsd-nat_c,v 1.2 2018/01/24 00:19:56 jca Exp $
-Index: gdb/armnbsd-nat.c
---- gdb/armnbsd-nat.c.orig
-+++ gdb/armnbsd-nat.c
-@@ -65,10 +65,10 @@ arm_supply_fparegset (struct regcache *regcache, struc
-
- for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- regcache_raw_supply (regcache, regno,
-- (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
-+ (char *) &fparegset->fp_reg[regno - ARM_F0_REGNUM]);
-
- regcache_raw_supply (regcache, ARM_FPS_REGNUM,
-- (char *) &fparegset->fpr_fpsr);
-+ (char *) &fparegset->fp_scr);
- }
-
- static void
-@@ -77,7 +77,7 @@ fetch_register (struct regcache *regcache, int regno)
- struct reg inferior_registers;
- int ret;
-
-- ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
-
- if (ret < 0)
-@@ -130,7 +130,7 @@ fetch_regs (struct regcache *regcache)
- int ret;
- int regno;
-
-- ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
-
- if (ret < 0)
-@@ -148,7 +148,7 @@ fetch_fp_register (struct regcache *regcache, int regn
- struct fpreg inferior_fp_registers;
- int ret;
-
-- ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
-
- if (ret < 0)
-@@ -161,12 +161,12 @@ fetch_fp_register (struct regcache *regcache, int regn
- {
- case ARM_FPS_REGNUM:
- regcache_raw_supply (regcache, ARM_FPS_REGNUM,
-- (char *) &inferior_fp_registers.fpr_fpsr);
-+ (char *) &inferior_fp_registers.fp_scr);
- break;
-
- default:
- regcache_raw_supply (regcache, regno,
-- (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
-+ (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
- break;
- }
- }
-@@ -178,7 +178,7 @@ fetch_fp_regs (struct regcache *regcache)
- int ret;
- int regno;
-
-- ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
-
- if (ret < 0)
-@@ -216,7 +216,7 @@ store_register (const struct regcache *regcache, int r
- struct reg inferior_registers;
- int ret;
-
-- ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
-
- if (ret < 0)
-@@ -279,7 +279,7 @@ store_register (const struct regcache *regcache, int r
- break;
- }
-
-- ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
-
- if (ret < 0)
-@@ -327,7 +327,7 @@ store_regs (const struct regcache *regcache)
- inferior_registers.r_pc = pc_val | psr_val;
- }
-
-- ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
-
- if (ret < 0)
-@@ -340,7 +340,7 @@ store_fp_register (const struct regcache *regcache, in
- struct fpreg inferior_fp_registers;
- int ret;
-
-- ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
-
- if (ret < 0)
-@@ -353,16 +353,16 @@ store_fp_register (const struct regcache *regcache, in
- {
- case ARM_FPS_REGNUM:
- regcache_raw_collect (regcache, ARM_FPS_REGNUM,
-- (char *) &inferior_fp_registers.fpr_fpsr);
-+ (char *) &inferior_fp_registers.fp_scr);
- break;
-
- default:
- regcache_raw_collect (regcache, regno,
-- (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
-+ (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
- break;
- }
-
-- ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
-
- if (ret < 0)
-@@ -379,12 +379,12 @@ store_fp_regs (const struct regcache *regcache)
-
- for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- regcache_raw_collect (regcache, regno,
-- (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
-+ (char *) &inferior_fp_registers.fp_reg[regno - ARM_F0_REGNUM]);
-
- regcache_raw_collect (regcache, ARM_FPS_REGNUM,
-- (char *) &inferior_fp_registers.fpr_fpsr);
-+ (char *) &inferior_fp_registers.fp_scr);
-
-- ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
-+ ret = ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
-
- if (ret < 0)
Index: patches/patch-gdb_configure_host
===================================================================
RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_configure_host,v
retrieving revision 1.1
diff -u -p -r1.1 patch-gdb_configure_host
--- patches/patch-gdb_configure_host 10 Jul 2018 11:03:46 -0000 1.1
+++ patches/patch-gdb_configure_host 23 Dec 2018 18:47:09 -0000
@@ -1,11 +1,12 @@
$OpenBSD: patch-gdb_configure_host,v 1.1 2018/07/10 11:03:46 kettenis Exp $
---- gdb/configure.host.orig Sat Jan 21 05:48:42 2017
-+++ gdb/configure.host Tue Mar 7 23:52:43 2017
-@@ -82,6 +82,7 @@ case "${host}" in
- *-*-darwin*) gdb_host=darwin ;;
+Index: gdb/configure.host
+--- gdb/configure.host.orig
++++ gdb/configure.host
+@@ -85,6 +85,7 @@ case "${host}" in

aarch64*-*-linux*) gdb_host=linux ;;
+ aarch64*-*-freebsd*) gdb_host=fbsd ;;
+aarch64*-*-openbsd*) gdb_host=obsd ;;

alpha*-*-linux*) gdb_host=alpha-linux ;;
- alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
Index: patches/patch-gdb_configure_tgt
===================================================================
RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_configure_tgt,v
retrieving revision 1.1
diff -u -p -r1.1 patch-gdb_configure_tgt
--- patches/patch-gdb_configure_tgt 10 Jul 2018 11:03:46 -0000 1.1
+++ patches/patch-gdb_configure_tgt 23 Dec 2018 18:47:09 -0000
@@ -2,17 +2,17 @@ $OpenBSD: patch-gdb_configure_tgt,v 1.1
Index: gdb/configure.tgt
--- gdb/configure.tgt.orig
+++ gdb/configure.tgt
-@@ -51,6 +51,13 @@ aarch64*-*-linux*)
+@@ -124,6 +124,13 @@ aarch64*-*-linux*)
build_gdbserver=yes
;;

+aarch64*-*-openbsd*)
+ # Target: OpenBSD/arm64
-+ gdb_target_obs="aarch64-tdep.o aarch64obsd-tdep.o aarch64-insn.o \
++ gdb_target_obs="aarch64-tdep.o aarch64-obsd-tdep.o \
+ obsd-tdep.o solib-svr4.o \
-+ symfile-mem.o aarch64-insn.o"
++ symfile-mem.o"
+ ;;
+
alpha*-*-linux*)
# Target: Little-endian Alpha running Linux
- gdb_target_obs="alpha-tdep.o alpha-mdebug-tdep.o alpha-linux-tdep.o \
+ gdb_target_obs="alpha-mdebug-tdep.o alpha-linux-tdep.o \
Index: patches/patch-gdb_data-directory_Makefile_in
===================================================================
RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_data-directory_Makefile_in,v
retrieving revision 1.9
diff -u -p -r1.9 patch-gdb_data-directory_Makefile_in
--- patches/patch-gdb_data-directory_Makefile_in 9 Oct 2016 11:39:20 -0000 1.9
+++ patches/patch-gdb_data-directory_Makefile_in 23 Dec 2018 18:47:09 -0000
@@ -1,7 +1,8 @@
$OpenBSD: patch-gdb_data-directory_Makefile_in,v 1.9 2016/10/09 11:39:20 pascal Exp $
---- gdb/data-directory/Makefile.in.orig Mon Aug 1 17:50:20 2016
-+++ gdb/data-directory/Makefile.in Fri Oct 7 20:53:14 2016
-@@ -187,7 +187,7 @@ stamp-syscalls: Makefile $(SYSCALLS_FILES)
+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)
for file in $$files ; do \
f=$(SYSCALLS_SRCDIR)/$$file ; \
if test -f $$f ; then \
@@ -10,7 +11,7 @@ $OpenBSD: patch-gdb_data-directory_Makef
fi ; \
done
touch $@
-@@ -229,8 +229,8 @@ stamp-python: Makefile $(PYTHON_FILES)
+@@ -240,8 +240,8 @@ stamp-python: Makefile $(PYTHON_FILES)
if test "x$$files" != x ; then \
for file in $$files ; do \
dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
@@ -21,7 +22,7 @@ $OpenBSD: patch-gdb_data-directory_Makef
done ; \
fi
touch $@
-@@ -323,7 +323,7 @@ stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
+@@ -334,7 +334,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_hppa-obsd-nat_c
===================================================================
RCS file: patches/patch-gdb_hppa-obsd-nat_c
diff -N patches/patch-gdb_hppa-obsd-nat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_hppa-obsd-nat_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,59 @@
+$OpenBSD$
+
+Index: gdb/hppa-obsd-nat.c
+--- gdb/hppa-obsd-nat.c.orig
++++ gdb/hppa-obsd-nat.c
+@@ -57,7 +57,7 @@ static void
+ hppaobsd_supply_gregset (struct regcache *regcache, const void *gregs)
+ {
+ gdb_byte zero[4] = { 0 };
+- const char *regs = gregs;
++ const char *regs = (const char *)gregs;
+ int regnum;
+
+ regcache->raw_supply (HPPA_R0_REGNUM, &zero);
+@@ -96,7 +96,7 @@ hppaobsd_supply_gregset (struct regcache *regcache, co
+ static void
+ hppaobsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
+ {
+- const char *regs = fpregs;
++ const char *regs = (const char *)fpregs;
+ int regnum;
+
+ for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM;
+@@ -114,7 +114,7 @@ static void
+ hppaobsd_collect_gregset (const struct regcache *regcache,
+ void *gregs, int regnum)
+ {
+- char *regs = gregs;
++ char *regs = (char *)gregs;
+ int i;
+
+ for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++)
+@@ -176,7 +176,7 @@ static void
+ hppaobsd_collect_fpregset (struct regcache *regcache,
+ void *fpregs, int regnum)
+ {
+- char *regs = fpregs;
++ char *regs = (char *)fpregs;
+ int i;
+
+ for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8)
+@@ -196,7 +196,7 @@ hppaobsd_collect_fpregset (struct regcache *regcache,
+ void
+ hppa_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
+ {
+- pid_t pid = regcache->ptid ().pid ();
++ pid_t pid = get_ptrace_pid (regcache->ptid ());
+
+ if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
+ {
+@@ -225,6 +225,8 @@ hppa_obsd_nat_target::fetch_registers (struct regcache
+ void
+ hppa_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
+ {
++ pid_t pid = get_ptrace_pid (regcache->ptid ());
++
+ if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
+ {
+ struct reg regs;
Index: patches/patch-gdb_hppaobsd-nat_c
===================================================================
RCS file: patches/patch-gdb_hppaobsd-nat_c
diff -N patches/patch-gdb_hppaobsd-nat_c
--- patches/patch-gdb_hppaobsd-nat_c 3 Sep 2016 13:48:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-$OpenBSD: patch-gdb_hppaobsd-nat_c,v 1.1 2016/09/03 13:48:39 jca Exp $
---- gdb/hppaobsd-nat.c.orig Wed Feb 10 04:19:39 2016
-+++ gdb/hppaobsd-nat.c Sat May 14 22:54:35 2016
-@@ -193,7 +193,7 @@ hppaobsd_fetch_registers (struct target_ops *ops,
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -204,7 +204,7 @@ hppaobsd_fetch_registers (struct target_ops *ops,
- {
- struct fpreg fpregs;
-
-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
-
-@@ -223,13 +223,13 @@ hppaobsd_store_registers (struct target_ops *ops,
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
- hppaobsd_collect_gregset (regcache, &regs, regnum);
-
-- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
- }
-@@ -238,13 +238,13 @@ hppaobsd_store_registers (struct target_ops *ops,
- {
- struct fpreg fpregs;
-
-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
-
- hppaobsd_collect_fpregset (regcache, &fpregs, regnum);
-
-- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
- }
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_i386-bsd-nat_h 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+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: patches/patch-gdb_i386-obsd-nat_c
diff -N patches/patch-gdb_i386-obsd-nat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_i386-obsd-nat_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+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
+ void
+ _initialize_i386obsd_nat (void)
+ {
+- add_inf_child_target (&i386_obsd_nat_target);
++ add_inf_child_target (&the_i386_obsd_nat_target);
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (i386obsd_supply_pcb);
Index: patches/patch-gdb_m88kbsd-nat_c
===================================================================
RCS file: patches/patch-gdb_m88kbsd-nat_c
diff -N patches/patch-gdb_m88kbsd-nat_c
--- patches/patch-gdb_m88kbsd-nat_c 3 Sep 2016 13:48:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-$OpenBSD: patch-gdb_m88kbsd-nat_c,v 1.1 2016/09/03 13:48:39 jca Exp $
---- gdb/m88kbsd-nat.c.orig Wed Feb 10 04:19:39 2016
-+++ gdb/m88kbsd-nat.c Sat May 14 22:54:35 2016
-@@ -68,7 +68,7 @@ m88kbsd_fetch_inferior_registers (struct target_ops *o
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -84,13 +84,13 @@ m88kbsd_store_inferior_registers (struct target_ops *o
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
- m88kbsd_collect_gregset (regcache, &regs, regnum);
-
-- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
- }
Index: patches/patch-gdb_mips64-obsd-nat_c
===================================================================
RCS file: patches/patch-gdb_mips64-obsd-nat_c
diff -N patches/patch-gdb_mips64-obsd-nat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gdb_mips64-obsd-nat_c 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,41 @@
+$OpenBSD$
+
+Index: gdb/mips64-obsd-nat.c
+--- gdb/mips64-obsd-nat.c.orig
++++ gdb/mips64-obsd-nat.c
+@@ -48,7 +48,7 @@ static mips64_obsd_nat_target the_mips64_obsd_nat_targ
+ static void
+ mips64obsd_supply_gregset (struct regcache *regcache, const void *gregs)
+ {
+- const char *regs = gregs;
++ const char *regs = (const char *) gregs;
+ int regnum;
+
+ for (regnum = MIPS_ZERO_REGNUM; regnum <= MIPS_PC_REGNUM; regnum++)
+@@ -65,7 +65,7 @@ static void
+ mips64obsd_collect_gregset (const struct regcache *regcache,
+ void *gregs, int regnum)
+ {
+- char *regs = gregs;
++ char *regs = (char *) gregs;
+ int i;
+
+ for (i = MIPS_ZERO_REGNUM; i <= MIPS_PC_REGNUM; i++)
+@@ -89,7 +89,7 @@ void
+ mips64_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"));
+@@ -104,7 +104,7 @@ static void
+ mips64_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_mips64obsd-nat_c
===================================================================
RCS file: patches/patch-gdb_mips64obsd-nat_c
diff -N patches/patch-gdb_mips64obsd-nat_c
--- patches/patch-gdb_mips64obsd-nat_c 21 Oct 2016 13:13:31 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-$OpenBSD: patch-gdb_mips64obsd-nat_c,v 1.2 2016/10/21 13:13:31 visa Exp $
---- gdb/mips64obsd-nat.c.orig Mon Aug 1 09:50:20 2016
-+++ gdb/mips64obsd-nat.c Tue Oct 18 07:24:31 2016
-@@ -40,7 +40,7 @@
- static void
- mips64obsd_supply_gregset (struct regcache *regcache, const void *gregs)
- {
-- const char *regs = gregs;
-+ const char *regs = (const char *) gregs;
- int regnum;
-
- for (regnum = MIPS_ZERO_REGNUM; regnum <= MIPS_PC_REGNUM; regnum++)
-@@ -57,7 +57,7 @@ static void
- mips64obsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
- {
-- char *regs = gregs;
-+ char *regs = (char *) gregs;
- int i;
-
- for (i = MIPS_ZERO_REGNUM; i <= MIPS_PC_REGNUM; i++)
-@@ -83,7 +83,7 @@ mips64obsd_fetch_inferior_registers (struct target_ops
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -99,13 +99,13 @@ mips64obsd_store_inferior_registers (struct target_ops
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
- mips64obsd_collect_gregset (regcache, &regs, regnum);
-
-- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
- }
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 23 Dec 2018 18:47:09 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+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_ppcobsd-nat_c
===================================================================
RCS file: patches/patch-gdb_ppcobsd-nat_c
diff -N patches/patch-gdb_ppcobsd-nat_c
--- patches/patch-gdb_ppcobsd-nat_c 3 Sep 2016 13:48:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-$OpenBSD: patch-gdb_ppcobsd-nat_c,v 1.1 2016/09/03 13:48:39 jca Exp $
---- gdb/ppcobsd-nat.c.orig Wed Feb 10 04:19:39 2016
-+++ gdb/ppcobsd-nat.c Sat May 14 22:54:35 2016
-@@ -76,7 +76,7 @@ ppcobsd_fetch_registers (struct target_ops *ops,
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -93,7 +93,7 @@ ppcobsd_fetch_registers (struct target_ops *ops,
- {
- struct fpreg fpregs;
-
-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
-
-@@ -112,7 +112,7 @@ ppcobsd_store_registers (struct target_ops *ops,
- {
- struct reg regs;
-
-- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
-+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
-@@ -123,7 +123,7 @@ ppcobsd_store_registers (struct target_ops *ops,
- regnum, &regs, sizeof regs);
-

No comments:

Post a Comment