pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gdb-netbsd: Sync patches with gdbserver/NetBSD/amd64 v4



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Sep 8 15:13:10 2020 +0200
Changeset:	1f246b3fd0f94eb7230dd003706e3d8c339c475d

Modified Files:
	gdb-netbsd/distinfo
	gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
	gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
	gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h
	gdb-netbsd/patches/patch-gdb_nbsd-nat.c
	gdb-netbsd/patches/patch-gdbserver_ChangeLog
	gdb-netbsd/patches/patch-gdbserver_Makefile.in
	gdb-netbsd/patches/patch-gdbserver_configure.srv
	gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc
	gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
	gdb-netbsd/patches/patch-gdbsupport_eintr.h
Added Files:
	gdb-netbsd/patches/patch-gdb_testsuite_lib_fortran.exp
	gdb-netbsd/patches/patch-gdbserver_netbsd-amd64-low.cc
Removed Files:
	gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc

Log Message:
gdb-netbsd: Sync patches with gdbserver/NetBSD/amd64 v4

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1f246b3fd0f94eb7230dd003706e3d8c339c475d

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gdb-netbsd/distinfo                                |  23 +--
 gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c   |   4 +-
 gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c      |  36 ++--
 gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h      |  32 +++-
 gdb-netbsd/patches/patch-gdb_nbsd-nat.c            |   2 +-
 .../patches/patch-gdb_testsuite_lib_fortran.exp    |  39 +++++
 gdb-netbsd/patches/patch-gdbserver_ChangeLog       |   4 +-
 gdb-netbsd/patches/patch-gdbserver_Makefile.in     |   2 +-
 gdb-netbsd/patches/patch-gdbserver_configure.srv   |   2 +-
 .../patches/patch-gdbserver_netbsd-amd64-low.cc    | 192 +++++++++++++++++++++
 gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc   |  73 +++-----
 gdb-netbsd/patches/patch-gdbserver_netbsd-low.h    |   2 +-
 .../patches/patch-gdbserver_netbsd-x86__64-low.cc  | 192 ---------------------
 gdb-netbsd/patches/patch-gdbsupport_eintr.h        |  30 +++-
 14 files changed, 352 insertions(+), 281 deletions(-)

diffs:
diff --git a/gdb-netbsd/distinfo b/gdb-netbsd/distinfo
index bee127dce3..57c1f0ed52 100644
--- a/gdb-netbsd/distinfo
+++ b/gdb-netbsd/distinfo
@@ -6,15 +6,16 @@ SHA512 (gdb-8.2.1-c5cd900e4f197870812c2d3e2c194871c171ef42.tar.gz) = be929f01e55
 Size (gdb-8.2.1-c5cd900e4f197870812c2d3e2c194871c171ef42.tar.gz) = 60943579 bytes
 SHA1 (patch-gdb_ChangeLog) = 8eec8e606020f5134aac488b95647496bf98aaf3
 SHA1 (patch-gdb_configure.nat) = ffaac7f26fba75a2eacd8b2b20a25c50b8d024ed
-SHA1 (patch-gdb_nat_fork-inferior.c) = 5e909ad6896922b496d0d2c38336cb9cdb58a0ee
-SHA1 (patch-gdb_nat_netbsd-nat.c) = c74dd5c0cc7614064ebfb32805180579a58dc8f9
-SHA1 (patch-gdb_nat_netbsd-nat.h) = 42e92740762bb22c1d47413cb096aa99baaffddd
-SHA1 (patch-gdb_nbsd-nat.c) = 44b12fa7e7cabf41d24611902495f8a468979983
-SHA1 (patch-gdbserver_ChangeLog) = 8359289c89459e86092d54ad342bea0974e6399c
-SHA1 (patch-gdbserver_Makefile.in) = 1c340ff6681fc5d860d74e9dd7b8ca419097b97f
-SHA1 (patch-gdbserver_configure.srv) = 23dc272de0f96ed4f7de8a4fa8720dca91765d59
-SHA1 (patch-gdbserver_netbsd-low.cc) = 27dbb51a9e4f7bf60c8bc46e759c11e5724855b5
-SHA1 (patch-gdbserver_netbsd-low.h) = 98ecc6c7b7ef458c01234dcaf8a1c3168f695e14
-SHA1 (patch-gdbserver_netbsd-x86__64-low.cc) = 306063768bf7f8e29176593b78cfa8c86fe5e488
+SHA1 (patch-gdb_nat_fork-inferior.c) = ac89754b5dd1a69b0058bedaf512272a8d8d30fe
+SHA1 (patch-gdb_nat_netbsd-nat.c) = 7e3e38976d1c7bc6a1f19e4a80df9cd58c526459
+SHA1 (patch-gdb_nat_netbsd-nat.h) = df8d545ffb2a35ca6c467b15a5893612a596d49f
+SHA1 (patch-gdb_nbsd-nat.c) = 990e2a7028526f22719a7da91d3388c62dca074d
+SHA1 (patch-gdb_testsuite_lib_fortran.exp) = 89362ab7b8e0becba8d5975a81935f22536afd7b
+SHA1 (patch-gdbserver_ChangeLog) = 6328d14345bf070aea1ea1028344ad6e8e0ba68a
+SHA1 (patch-gdbserver_Makefile.in) = 4fe153030dd40b672eae2184c68070be181a9161
+SHA1 (patch-gdbserver_configure.srv) = 003db2c5e3caaf41113d1a353dccac488a1b9948
+SHA1 (patch-gdbserver_netbsd-amd64-low.cc) = 02af27124b13e9eb59eb1037d3eb650d7b6c583f
+SHA1 (patch-gdbserver_netbsd-low.cc) = 6ee33d00356e4710058a4720889666023b377f33
+SHA1 (patch-gdbserver_netbsd-low.h) = debfbeffe74c441d93dbe2335caf89858a0f1c1b
 SHA1 (patch-gdbsupport_ChangeLog) = f32a8af60f2066764deffd6edebb5473416c6a27
-SHA1 (patch-gdbsupport_eintr.h) = e8892a3499fc84cbc43cf5293874d18964a90959
+SHA1 (patch-gdbsupport_eintr.h) = dc8f7e8c97c473fea1997facecab37814b2b0f88
diff --git a/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c b/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
index 2546c0526c..7dc991a8c1 100644
--- a/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
+++ b/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
@@ -7,8 +7,8 @@ $NetBSD$
  	  case TARGET_WAITKIND_EXECD:
  	    /* Handle EXEC signals as if they were SIGTRAP signals.  */
 -	    xfree (ws.value.execd_pathname);
-+	    /* Do not free the last execd pathname as it will be used in
-+	       prepare_resume_reply(), after attaching a client side.  */
++	    /* Free the exec'ed pathname, but only if this isn't the
++	       waitstatus we are returning to the caller.  */
 +	    if (pending_execs != 1)
 +	      xfree (ws.value.execd_pathname);
  	    resume_signal = GDB_SIGNAL_TRAP;
diff --git a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
index 5f87adc4a7..27bde0fe26 100644
--- a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
+++ b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- gdb/nat/netbsd-nat.c.orig	2020-09-04 21:53:29.055817757 +0000
+--- gdb/nat/netbsd-nat.c.orig	2020-09-08 13:10:45.226850952 +0000
 +++ gdb/nat/netbsd-nat.c
 @@ -0,0 +1,213 @@
 +/* Internal interfaces for the NetBSD code.
@@ -37,22 +37,25 @@ $NetBSD$
 +namespace netbsd_nat
 +{
 +
-+/* Return the executable file name of a process specified by PID.  Returns the
-+   string in a static buffer.  */
++/* See netbsd-nat.h.  */
 +
-+char *
++const char *
 +pid_to_exec_file (pid_t pid)
 +{
 +  static char buf[PATH_MAX];
 +  int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_PATHNAME};
 +  size_t buflen = sizeof (buf);
-+  if (::sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0))
++  if (::sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0) != 0)
 +    return NULL;
 +  return buf;
 +}
 +
-+/* Generic thread (LWP) lister within a specified process.  The callback
-+   parameters is a C++ function that is called for each detected thread.  */
++/* Generic thread (LWP) lister within a specified PID.  The CALLBACK
++   parameters is a C++ function that is called for each detected thread.
++   When the CALLBACK function returns true, the iteration is interrupted.
++
++   This function assumes internally that the queried process is stopped
++   and the number of threads does not change between two sysctl () calls.  */
 +
 +static bool
 +netbsd_thread_lister (const pid_t pid,
@@ -106,7 +109,7 @@ $NetBSD$
 +  return false;
 +}
 +
-+/* Return true if PTID is still active in the inferior.  */
++/* See netbsd-nat.h.  */
 +
 +bool
 +thread_alive (ptid_t ptid)
@@ -115,7 +118,7 @@ $NetBSD$
 +  lwpid_t lwp = ptid.lwp ();
 +
 +  auto fn
-+    = [&lwp] (const struct kinfo_lwp *kl)
++    = [=] (const struct kinfo_lwp *kl)
 +      {
 +        return kl->l_lid == lwp;
 +      };
@@ -123,8 +126,7 @@ $NetBSD$
 +  return netbsd_thread_lister (pid, fn);
 +}
 +
-+/* Return the name assigned to a thread by an application.  Returns
-+   the string in a static buffer.  */
++/* See netbsd-nat.h.  */
 +
 +const char *
 +thread_name (ptid_t ptid)
@@ -135,7 +137,7 @@ $NetBSD$
 +  static char buf[KI_LNAMELEN] = {};
 +
 +  auto fn
-+    = [&lwp] (const struct kinfo_lwp *kl)
++    = [=] (const struct kinfo_lwp *kl)
 +      {
 +	if (kl->l_lid == lwp)
 +	  {
@@ -151,14 +153,13 @@ $NetBSD$
 +    return NULL;
 +}
 +
-+/* A generic thread lister within a specific PID.  The CALLBACK parameter
-+   is a C++ function that is called for each detected thread.  */
++/* See netbsd-nat.h.  */
 +
 +void
 +for_each_thread (pid_t pid, gdb::function_view<void (ptid_t)> callback)
 +{
 +  auto fn
-+    = [&callback, &pid] (const struct kinfo_lwp *kl)
++    = [=, &callback] (const struct kinfo_lwp *kl)
 +      {
 +	ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
 +	callback (ptid);
@@ -168,7 +169,7 @@ $NetBSD$
 +  netbsd_thread_lister (pid, fn);
 +}
 +
-+/* Enable additional event reporting in a new process specified by PID.  */
++/* See netbsd-nat.h.  */
 +
 +void
 +enable_proc_events (pid_t pid)
@@ -185,8 +186,7 @@ $NetBSD$
 +    perror_with_name (("ptrace"));
 +}
 +
-+/* Implement reading and writing of inferior's siginfo_t specified by PID.
-+   Returns -1 on failure and the number of bytes on a successful transfer.  */
++/* See netbsd-nat.h.  */
 +
 +int
 +qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
diff --git a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h
index a1597b10aa..c1218ab119 100644
--- a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h
+++ b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- gdb/nat/netbsd-nat.h.orig	2020-09-04 21:53:29.055935316 +0000
+--- gdb/nat/netbsd-nat.h.orig	2020-09-08 13:10:45.226975075 +0000
 +++ gdb/nat/netbsd-nat.h
-@@ -0,0 +1,46 @@
+@@ -0,0 +1,72 @@
 +/* Internal interfaces for the NetBSD code.
 +
 +   Copyright (C) 2006-2020 Free Software Foundation, Inc.
@@ -32,17 +32,43 @@ $NetBSD$
 +namespace netbsd_nat
 +{
 +
-+extern char *pid_to_exec_file (pid_t pid);
++/* Return the executable file name of a process specified by PID.  Returns the
++   string in a static buffer.  */
++
++extern const char *pid_to_exec_file (pid_t pid);
++
++/* Return true if PTID is still active in the inferior.  */
 +
 +extern bool thread_alive (ptid_t ptid);
 +
++/* Return the name assigned to a thread by an application.  Returns
++   the string in a static buffer.
++
++   This function assumes internally that the queried process is stopped.  */
++
 +extern const char *thread_name (ptid_t ptid);
 +
++/* A generic thread lister within a specific PID.  The CALLBACK parameter
++   is a C++ function that is called for each detected thread.
++
++   This function assumes internally that the queried process is stopped.  */
++
 +extern void for_each_thread (pid_t pid,
 +			     gdb::function_view<void (ptid_t)> callback);
 +
++/* Enable additional event reporting in a new process specified by PID.
++
++   This function assumes internally that the queried process is stopped and
++   traced.  */
++
 +extern void enable_proc_events (pid_t pid);
 +
++/* Implement reading and writing of inferior's siginfo_t specified by PID.
++   Returns -1 on failure and the number of bytes on a successful transfer.
++
++   This function assumes internally that the queried process is stopped and
++   traced.  */
++
 +extern int qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
 +			  unsigned const char *writebuf, CORE_ADDR offset,
 +			  int len);
diff --git a/gdb-netbsd/patches/patch-gdb_nbsd-nat.c b/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
index 0543378116..1ac4141a61 100644
--- a/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
+++ b/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
@@ -21,7 +21,7 @@ $NetBSD$
 -  if (sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0))
 -    return NULL;
 -  return buf;
-+  return netbsd_nat::pid_to_exec_file (pid);
++  return const_cast<char *> (netbsd_nat::pid_to_exec_file (pid));
  }
  
  /* Return the current directory for the process identified by PID.  */
diff --git a/gdb-netbsd/patches/patch-gdb_testsuite_lib_fortran.exp b/gdb-netbsd/patches/patch-gdb_testsuite_lib_fortran.exp
new file mode 100644
index 0000000000..000caf45c2
--- /dev/null
+++ b/gdb-netbsd/patches/patch-gdb_testsuite_lib_fortran.exp
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- gdb/testsuite/lib/fortran.exp.orig	2020-09-03 16:35:18.000000000 +0000
++++ gdb/testsuite/lib/fortran.exp
+@@ -127,6 +127,34 @@ proc fortran_complex16 {} {
+     }
+ }
+ 
++proc fortran_complex8 {} {
++    if {[test_compiler_info {gcc-4-[012]-*}]} {
++	return "complex8"
++    } elseif {[test_compiler_info {gcc-*}]} {
++	return "complex\\(kind=8\\)"
++    } elseif {[test_compiler_info {clang-*}]} {
++	return "double complex"
++    } elseif {[test_compiler_info {icc-*}]} {
++	return "COMPLEX\\(8\\)"
++    } else {
++	return "unknown"
++    }
++}
++
++proc fortran_complex16 {} {
++    if {[test_compiler_info {gcc-4-[012]-*}]} {
++	return "complex16"
++    } elseif {[test_compiler_info {gcc-*}]} {
++	return "complex\\(kind=16\\)"
++    } elseif {[test_compiler_info {clang-*}]} {
++	return "quad complex"
++    } elseif {[test_compiler_info {icc-*}]} {
++	return "COMPLEX\\(16\\)"
++    } else {
++	return "unknown"
++    }
++}
++
+ proc fortran_logical4 {} {
+     if {[test_compiler_info {gcc-4-[012]-*}]} {
+ 	return "logical4"
diff --git a/gdb-netbsd/patches/patch-gdbserver_ChangeLog b/gdb-netbsd/patches/patch-gdbserver_ChangeLog
index 1527f08273..c497e7de73 100644
--- a/gdb-netbsd/patches/patch-gdbserver_ChangeLog
+++ b/gdb-netbsd/patches/patch-gdbserver_ChangeLog
@@ -7,9 +7,9 @@ $NetBSD$
 +
 +	* netbsd-low.cc: Add.
 +	* netbsd-low.h: Likewise.
-+	* netbsd-x86_64-low.cc: Likewise.
++	* netbsd-amd64-low.cc: Likewise.
 +	* Makefile.in (SFILES): Register "netbsd-low.cc", "netbsd-low.h",
-+	"netbsd-x86_64-low.cc".
++	"netbsd-amd64-low.cc".
 +	* configure.srv: Add x86_64-*-netbsd*.
 +
  2020-08-13  Simon Marchi  <simon.marchi%polymtl.ca@localhost>
diff --git a/gdb-netbsd/patches/patch-gdbserver_Makefile.in b/gdb-netbsd/patches/patch-gdbserver_Makefile.in
index 647a2142a8..eb78a8b26d 100644
--- a/gdb-netbsd/patches/patch-gdbserver_Makefile.in
+++ b/gdb-netbsd/patches/patch-gdbserver_Makefile.in
@@ -6,9 +6,9 @@ $NetBSD$
  	$(srcdir)/linux-x86-low.cc \
  	$(srcdir)/linux-xtensa-low.cc \
  	$(srcdir)/mem-break.cc \
++	$(srcdir)/netbsd-amd64-low.cc \
 +	$(srcdir)/netbsd-low.cc \
 +	$(srcdir)/netbsd-low.h \
-+	$(srcdir)/netbsd-x86_64-low.cc \
  	$(srcdir)/proc-service.cc \
  	$(srcdir)/proc-service.list \
  	$(srcdir)/regcache.cc \
diff --git a/gdb-netbsd/patches/patch-gdbserver_configure.srv b/gdb-netbsd/patches/patch-gdbserver_configure.srv
index 6c19c392a7..e3340ea560 100644
--- a/gdb-netbsd/patches/patch-gdbserver_configure.srv
+++ b/gdb-netbsd/patches/patch-gdbserver_configure.srv
@@ -7,7 +7,7 @@ $NetBSD$
  			srv_tgtobj="${srv_tgtobj} arch/amd64.o arch/i386.o"
  			;;
 +  x86_64-*-netbsd*)	srv_regobj=""
-+			srv_tgtobj="netbsd-low.o netbsd-x86_64-low.o fork-child.o"
++			srv_tgtobj="netbsd-low.o netbsd-amd64-low.o fork-child.o"
 +			srv_tgtobj="${srv_tgtobj} nat/fork-inferior.o"
 +			srv_tgtobj="${srv_tgtobj} nat/netbsd-nat.o"
 +			srv_tgtobj="${srv_tgtobj} arch/amd64.o"
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-amd64-low.cc b/gdb-netbsd/patches/patch-gdbserver_netbsd-amd64-low.cc
new file mode 100644
index 0000000000..92a2fa6517
--- /dev/null
+++ b/gdb-netbsd/patches/patch-gdbserver_netbsd-amd64-low.cc
@@ -0,0 +1,192 @@
+$NetBSD$
+
+--- gdbserver/netbsd-amd64-low.cc.orig	2020-09-08 13:10:47.483752505 +0000
++++ gdbserver/netbsd-amd64-low.cc
+@@ -0,0 +1,187 @@
++/* Copyright (C) 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 <sys/types.h>
++#include <sys/ptrace.h>
++#include <limits.h>
++
++#include "server.h"
++#include "netbsd-low.h"
++#include "gdbsupport/x86-xstate.h"
++#include "arch/amd64.h"
++#include "x86-tdesc.h"
++#include "tdesc.h"
++
++/* The index of various registers inside the regcache.  */
++
++enum netbsd_x86_64_gdb_regnum
++{
++  AMD64_RAX_REGNUM,	     /* %rax */
++  AMD64_RBX_REGNUM,	     /* %rbx */
++  AMD64_RCX_REGNUM,	     /* %rcx */
++  AMD64_RDX_REGNUM,	     /* %rdx */
++  AMD64_RSI_REGNUM,	     /* %rsi */
++  AMD64_RDI_REGNUM,	     /* %rdi */
++  AMD64_RBP_REGNUM,	     /* %rbp */
++  AMD64_RSP_REGNUM,	     /* %rsp */
++  AMD64_R8_REGNUM,	      /* %r8 */
++  AMD64_R9_REGNUM,	      /* %r9 */
++  AMD64_R10_REGNUM,	     /* %r10 */
++  AMD64_R11_REGNUM,	     /* %r11 */
++  AMD64_R12_REGNUM,	     /* %r12 */
++  AMD64_R13_REGNUM,	     /* %r13 */
++  AMD64_R14_REGNUM,	     /* %r14 */
++  AMD64_R15_REGNUM,	     /* %r15 */
++  AMD64_RIP_REGNUM,	     /* %rip */
++  AMD64_EFLAGS_REGNUM,	  /* %eflags */
++  AMD64_CS_REGNUM,	      /* %cs */
++  AMD64_SS_REGNUM,	      /* %ss */
++  AMD64_DS_REGNUM,	      /* %ds */
++  AMD64_ES_REGNUM,	      /* %es */
++  AMD64_FS_REGNUM,	      /* %fs */
++  AMD64_GS_REGNUM,	      /* %gs */
++  AMD64_ST0_REGNUM = 24,     /* %st0 */
++  AMD64_ST1_REGNUM,	     /* %st1 */
++  AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
++  AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
++  AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
++  AMD64_XMM0_REGNUM = 40,   /* %xmm0 */
++  AMD64_XMM1_REGNUM,	    /* %xmm1 */
++  AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
++  AMD64_YMM0H_REGNUM,	   /* %ymm0h */
++  AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
++  AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
++  AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
++  AMD64_BNDCFGU_REGNUM,
++  AMD64_BNDSTATUS_REGNUM,
++  AMD64_XMM16_REGNUM,
++  AMD64_XMM31_REGNUM = AMD64_XMM16_REGNUM + 15,
++  AMD64_YMM16H_REGNUM,
++  AMD64_YMM31H_REGNUM = AMD64_YMM16H_REGNUM + 15,
++  AMD64_K0_REGNUM,
++  AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7,
++  AMD64_ZMM0H_REGNUM,
++  AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31,
++  AMD64_PKRU_REGNUM,
++  AMD64_FSBASE_REGNUM,
++  AMD64_GSBASE_REGNUM
++};
++
++/* The fill_function for the general-purpose register set.  */
++
++static void
++netbsd_x86_64_fill_gregset (struct regcache *regcache, char *buf)
++{
++  struct reg *r = (struct reg *) buf;
++
++#define netbsd_x86_64_collect_gp(regnum, fld) do {		\
++    collect_register (regcache, regnum, &r->regs[_REG_##fld]);	\
++  } while (0)
++
++  netbsd_x86_64_collect_gp (AMD64_RAX_REGNUM, RAX);
++  netbsd_x86_64_collect_gp (AMD64_RBX_REGNUM, RBX);
++  netbsd_x86_64_collect_gp (AMD64_RCX_REGNUM, RCX);
++  netbsd_x86_64_collect_gp (AMD64_RDX_REGNUM, RDX);
++  netbsd_x86_64_collect_gp (AMD64_RSI_REGNUM, RSI);
++  netbsd_x86_64_collect_gp (AMD64_RDI_REGNUM, RDI);
++  netbsd_x86_64_collect_gp (AMD64_RBP_REGNUM, RBP);
++  netbsd_x86_64_collect_gp (AMD64_RSP_REGNUM, RSP);
++  netbsd_x86_64_collect_gp (AMD64_R8_REGNUM, R8);
++  netbsd_x86_64_collect_gp (AMD64_R9_REGNUM, R9);
++  netbsd_x86_64_collect_gp (AMD64_R10_REGNUM, R10);
++  netbsd_x86_64_collect_gp (AMD64_R11_REGNUM, R11);
++  netbsd_x86_64_collect_gp (AMD64_R12_REGNUM, R12);
++  netbsd_x86_64_collect_gp (AMD64_R13_REGNUM, R13);
++  netbsd_x86_64_collect_gp (AMD64_R14_REGNUM, R14);
++  netbsd_x86_64_collect_gp (AMD64_R15_REGNUM, R15);
++  netbsd_x86_64_collect_gp (AMD64_RIP_REGNUM, RIP);
++  netbsd_x86_64_collect_gp (AMD64_EFLAGS_REGNUM, RFLAGS);
++  netbsd_x86_64_collect_gp (AMD64_CS_REGNUM, CS);
++  netbsd_x86_64_collect_gp (AMD64_SS_REGNUM, SS);
++  netbsd_x86_64_collect_gp (AMD64_DS_REGNUM, DS);
++  netbsd_x86_64_collect_gp (AMD64_ES_REGNUM, ES);
++  netbsd_x86_64_collect_gp (AMD64_FS_REGNUM, FS);
++  netbsd_x86_64_collect_gp (AMD64_GS_REGNUM, GS);
++}
++
++/* The store_function for the general-purpose register set.  */
++
++static void
++netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf)
++{
++  struct reg *r = (struct reg *) buf;
++
++#define netbsd_x86_64_supply_gp(regnum, fld) do {		\
++    supply_register (regcache, regnum, &r->regs[_REG_##fld]);	\
++  } while(0)
++
++  netbsd_x86_64_supply_gp (AMD64_RAX_REGNUM, RAX);
++  netbsd_x86_64_supply_gp (AMD64_RBX_REGNUM, RBX);
++  netbsd_x86_64_supply_gp (AMD64_RCX_REGNUM, RCX);
++  netbsd_x86_64_supply_gp (AMD64_RDX_REGNUM, RDX);
++  netbsd_x86_64_supply_gp (AMD64_RSI_REGNUM, RSI);
++  netbsd_x86_64_supply_gp (AMD64_RDI_REGNUM, RDI);
++  netbsd_x86_64_supply_gp (AMD64_RBP_REGNUM, RBP);
++  netbsd_x86_64_supply_gp (AMD64_RSP_REGNUM, RSP);
++  netbsd_x86_64_supply_gp (AMD64_R8_REGNUM, R8);
++  netbsd_x86_64_supply_gp (AMD64_R9_REGNUM, R9);
++  netbsd_x86_64_supply_gp (AMD64_R10_REGNUM, R10);
++  netbsd_x86_64_supply_gp (AMD64_R11_REGNUM, R11);
++  netbsd_x86_64_supply_gp (AMD64_R12_REGNUM, R12);
++  netbsd_x86_64_supply_gp (AMD64_R13_REGNUM, R13);
++  netbsd_x86_64_supply_gp (AMD64_R14_REGNUM, R14);
++  netbsd_x86_64_supply_gp (AMD64_R15_REGNUM, R15);
++  netbsd_x86_64_supply_gp (AMD64_RIP_REGNUM, RIP);
++  netbsd_x86_64_supply_gp (AMD64_EFLAGS_REGNUM, RFLAGS);
++  netbsd_x86_64_supply_gp (AMD64_CS_REGNUM, CS);
++  netbsd_x86_64_supply_gp (AMD64_SS_REGNUM, SS);
++  netbsd_x86_64_supply_gp (AMD64_DS_REGNUM, DS);
++  netbsd_x86_64_supply_gp (AMD64_ES_REGNUM, ES);
++  netbsd_x86_64_supply_gp (AMD64_FS_REGNUM, FS);
++  netbsd_x86_64_supply_gp (AMD64_GS_REGNUM, GS);
++}
++
++/* Implements the netbsd_target_ops.arch_setup routine.  */
++
++static void
++netbsd_x86_64_arch_setup (void)
++{
++  struct target_desc *tdesc
++    = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false, false);
++
++  init_target_desc (tdesc, amd64_expedite_regs);
++
++  netbsd_tdesc = tdesc;
++}
++
++/* Description of all the x86-netbsd register sets.  */
++
++struct netbsd_regset_info netbsd_target_regsets[] =
++{
++ /* General Purpose Registers.  */
++ {PT_GETREGS, PT_SETREGS, sizeof (struct reg),
++  netbsd_x86_64_fill_gregset, netbsd_x86_64_store_gregset},
++ /* End of list marker.  */
++ {0, 0, -1, NULL, NULL }
++};
++
++/* The netbsd_target_ops vector for x86-netbsd.  */
++
++struct netbsd_target_ops the_low_target =
++{
++ netbsd_x86_64_arch_setup,
++};
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc
index 7e7c282627..83faed208f 100644
--- a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc
+++ b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- gdbserver/netbsd-low.cc.orig	2020-09-04 21:53:29.059281151 +0000
+--- gdbserver/netbsd-low.cc.orig	2020-09-08 13:10:47.484204564 +0000
 +++ gdbserver/netbsd-low.cc
-@@ -0,0 +1,1348 @@
+@@ -0,0 +1,1327 @@
 +/* Copyright (C) 2020 Free Software Foundation, Inc.
 +
 +   This file is part of GDB.
@@ -93,20 +93,6 @@ $NetBSD$
 +    }
 +}
 +
-+/* Register threads in the process specified by PID.  */
-+
-+static void
-+netbsd_add_threads (pid_t pid)
-+{
-+  auto fn
-+    = [] (ptid_t ptid)
-+      {
-+	add_thread (ptid, nullptr);
-+      };
-+
-+  netbsd_nat::for_each_thread (pid, fn);
-+}
-+
 +/* Implement the create_inferior method of the target_ops vector.  */
 +
 +int
@@ -140,16 +126,8 @@ $NetBSD$
 +int
 +netbsd_process_target::attach (unsigned long pid)
 +{
-+
-+  if (ptrace (PT_ATTACH, pid, nullptr, 0) != 0)
-+    error ("Cannot attach to process %lu: %s (%d)\n", pid,
-+	    safe_strerror (errno), errno);
-+
-+  netbsd_add_process (pid, 1);
-+  netbsd_nat::enable_proc_events (pid);
-+  netbsd_add_threads (pid);
-+
-+  return 0;
++  /* Unimplemented.  */
++  return -1;
 +}
 +
 +/* Returns true if GDB is interested in any child syscalls.  */
@@ -534,13 +512,13 @@ $NetBSD$
 +
 +  while (regset->size >= 0)
 +    {
-+      char *buf = (char *) xmalloc (regset->size);
-+      int res = ptrace (regset->get_request, inferior_ptid.pid (), buf,
++      std::vector<char> buf;
++      buf.resize (regset->size);
++      int res = ptrace (regset->get_request, inferior_ptid.pid (), buf.data (),
 +			inferior_ptid.lwp ());
 +      if (res == -1)
 +	perror_with_name (("ptrace"));
-+      regset->store_function (regcache, buf);
-+      free (buf);
++      regset->store_function (regcache, buf.data ());
 +      regset++;
 +    }
 +}
@@ -555,20 +533,20 @@ $NetBSD$
 +
 +  while (regset->size >= 0)
 +    {
-+      char *buf = (char *)xmalloc (regset->size);
-+      int res = ptrace (regset->get_request, inferior_ptid.pid (), buf,
++      std::vector<char> buf;
++      buf.resize (regset->size);
++      int res = ptrace (regset->get_request, inferior_ptid.pid (), buf.data (),
 +			inferior_ptid.lwp ());
 +      if (res == -1)
 +	perror_with_name (("ptrace"));
-+      if (res == 0)
-+	{
-+	  /* Then overlay our cached registers on that.  */
-+	  regset->fill_function (regcache, buf);
-+	  /* Only now do we write the register set.  */
-+	  res = ptrace (regset->set_request, inferior_ptid.pid (), buf,
-+			inferior_ptid.lwp ());
-+	}
-+      free (buf);
++
++      /* Then overlay our cached registers on that.  */
++      regset->fill_function (regcache, buf.data ());
++      /* Only now do we write the register set.  */
++      res = ptrace (regset->set_request, inferior_ptid.pid (), buf. data (),
++		    inferior_ptid.lwp ());
++      if (res == -1)
++	perror_with_name (("ptrace"));
 +      regset++;
 +    }
 +}
@@ -851,14 +829,17 @@ $NetBSD$
 +  const size_t auxv_size = sizeof (auxv_type);
 +  const size_t auxv_buf_size = 128 * sizeof (auxv_type);
 +
-+  char *auxv_buf = (char *) xmalloc (auxv_buf_size);
++  std::vector<char> auxv_buf;
++  auxv_buf.resize (auxv_buf_size);
 +
-+  netbsd_read_auxv (pid, nullptr, auxv_buf, auxv_buf_size);
++  netbsd_read_auxv (pid, nullptr, auxv_buf.data (), auxv_buf_size);
 +
 +  *phdr_memaddr = 0;
 +  *num_phdr = 0;
 +
-+  for (char *buf = auxv_buf; buf < (auxv_buf + auxv_buf_size); buf += auxv_size)
++  for (char *buf = auxv_buf.data ();
++       buf < (auxv_buf.data () + auxv_buf_size);
++       buf += auxv_size)
 +    {
 +      auxv_type *const aux = (auxv_type *) buf;
 +
@@ -876,8 +857,6 @@ $NetBSD$
 +	break;
 +    }
 +
-+  xfree (auxv_buf);
-+
 +  if (*phdr_memaddr == 0 || *num_phdr == 0)
 +    {
 +      warning ("Unexpected missing AT_PHDR and/or AT_PHNUM: "
@@ -1287,7 +1266,7 @@ $NetBSD$
 +char *
 +netbsd_process_target::pid_to_exec_file (pid_t pid)
 +{
-+  return netbsd_nat::pid_to_exec_file (pid);
++  return const_cast<char *> (netbsd_nat::pid_to_exec_file (pid));
 +}
 +
 +/* Implementation of the target_ops method "supports_pid_to_exec_file".  */
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
index 3d83e25c23..71f0659260 100644
--- a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
+++ b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- gdbserver/netbsd-low.h.orig	2020-09-04 21:53:29.059434433 +0000
+--- gdbserver/netbsd-low.h.orig	2020-09-08 13:10:47.484369884 +0000
 +++ gdbserver/netbsd-low.h
 @@ -0,0 +1,154 @@
 +/* Copyright (C) 2020 Free Software Foundation, Inc.
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc b/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc
deleted file mode 100644
index ca802fcebc..0000000000
--- a/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-$NetBSD$
-
---- gdbserver/netbsd-x86_64-low.cc.orig	2020-09-04 21:53:29.059587469 +0000
-+++ gdbserver/netbsd-x86_64-low.cc
-@@ -0,0 +1,187 @@
-+/* Copyright (C) 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 <sys/types.h>
-+#include <sys/ptrace.h>
-+#include <limits.h>
-+
-+#include "server.h"
-+#include "netbsd-low.h"
-+#include "gdbsupport/x86-xstate.h"
-+#include "arch/amd64.h"
-+#include "x86-tdesc.h"
-+#include "tdesc.h"
-+
-+/* The index of various registers inside the regcache.  */
-+
-+enum netbsd_x86_64_gdb_regnum
-+{
-+  AMD64_RAX_REGNUM,	     /* %rax */
-+  AMD64_RBX_REGNUM,	     /* %rbx */
-+  AMD64_RCX_REGNUM,	     /* %rcx */
-+  AMD64_RDX_REGNUM,	     /* %rdx */
-+  AMD64_RSI_REGNUM,	     /* %rsi */
-+  AMD64_RDI_REGNUM,	     /* %rdi */
-+  AMD64_RBP_REGNUM,	     /* %rbp */
-+  AMD64_RSP_REGNUM,	     /* %rsp */
-+  AMD64_R8_REGNUM,	      /* %r8 */
-+  AMD64_R9_REGNUM,	      /* %r9 */
-+  AMD64_R10_REGNUM,	     /* %r10 */
-+  AMD64_R11_REGNUM,	     /* %r11 */
-+  AMD64_R12_REGNUM,	     /* %r12 */
-+  AMD64_R13_REGNUM,	     /* %r13 */
-+  AMD64_R14_REGNUM,	     /* %r14 */
-+  AMD64_R15_REGNUM,	     /* %r15 */
-+  AMD64_RIP_REGNUM,	     /* %rip */
-+  AMD64_EFLAGS_REGNUM,	  /* %eflags */
-+  AMD64_CS_REGNUM,	      /* %cs */
-+  AMD64_SS_REGNUM,	      /* %ss */
-+  AMD64_DS_REGNUM,	      /* %ds */
-+  AMD64_ES_REGNUM,	      /* %es */
-+  AMD64_FS_REGNUM,	      /* %fs */
-+  AMD64_GS_REGNUM,	      /* %gs */
-+  AMD64_ST0_REGNUM = 24,     /* %st0 */
-+  AMD64_ST1_REGNUM,	     /* %st1 */
-+  AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
-+  AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
-+  AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
-+  AMD64_XMM0_REGNUM = 40,   /* %xmm0 */
-+  AMD64_XMM1_REGNUM,	    /* %xmm1 */
-+  AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
-+  AMD64_YMM0H_REGNUM,	   /* %ymm0h */
-+  AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
-+  AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
-+  AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
-+  AMD64_BNDCFGU_REGNUM,
-+  AMD64_BNDSTATUS_REGNUM,
-+  AMD64_XMM16_REGNUM,
-+  AMD64_XMM31_REGNUM = AMD64_XMM16_REGNUM + 15,
-+  AMD64_YMM16H_REGNUM,
-+  AMD64_YMM31H_REGNUM = AMD64_YMM16H_REGNUM + 15,
-+  AMD64_K0_REGNUM,
-+  AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7,
-+  AMD64_ZMM0H_REGNUM,
-+  AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31,
-+  AMD64_PKRU_REGNUM,
-+  AMD64_FSBASE_REGNUM,
-+  AMD64_GSBASE_REGNUM
-+};
-+
-+/* The fill_function for the general-purpose register set.  */
-+
-+static void
-+netbsd_x86_64_fill_gregset (struct regcache *regcache, char *buf)
-+{
-+  struct reg *r = (struct reg *) buf;
-+
-+#define netbsd_x86_64_collect_gp(regnum, fld) do {		\
-+    collect_register (regcache, regnum, &r->regs[_REG_##fld]);	\
-+  } while (0)
-+
-+  netbsd_x86_64_collect_gp (AMD64_RAX_REGNUM, RAX);
-+  netbsd_x86_64_collect_gp (AMD64_RBX_REGNUM, RBX);
-+  netbsd_x86_64_collect_gp (AMD64_RCX_REGNUM, RCX);
-+  netbsd_x86_64_collect_gp (AMD64_RDX_REGNUM, RDX);
-+  netbsd_x86_64_collect_gp (AMD64_RSI_REGNUM, RSI);
-+  netbsd_x86_64_collect_gp (AMD64_RDI_REGNUM, RDI);
-+  netbsd_x86_64_collect_gp (AMD64_RBP_REGNUM, RBP);
-+  netbsd_x86_64_collect_gp (AMD64_RSP_REGNUM, RSP);
-+  netbsd_x86_64_collect_gp (AMD64_R8_REGNUM, R8);
-+  netbsd_x86_64_collect_gp (AMD64_R9_REGNUM, R9);
-+  netbsd_x86_64_collect_gp (AMD64_R10_REGNUM, R10);
-+  netbsd_x86_64_collect_gp (AMD64_R11_REGNUM, R11);
-+  netbsd_x86_64_collect_gp (AMD64_R12_REGNUM, R12);
-+  netbsd_x86_64_collect_gp (AMD64_R13_REGNUM, R13);
-+  netbsd_x86_64_collect_gp (AMD64_R14_REGNUM, R14);
-+  netbsd_x86_64_collect_gp (AMD64_R15_REGNUM, R15);
-+  netbsd_x86_64_collect_gp (AMD64_RIP_REGNUM, RIP);
-+  netbsd_x86_64_collect_gp (AMD64_EFLAGS_REGNUM, RFLAGS);
-+  netbsd_x86_64_collect_gp (AMD64_CS_REGNUM, CS);
-+  netbsd_x86_64_collect_gp (AMD64_SS_REGNUM, SS);
-+  netbsd_x86_64_collect_gp (AMD64_DS_REGNUM, DS);
-+  netbsd_x86_64_collect_gp (AMD64_ES_REGNUM, ES);
-+  netbsd_x86_64_collect_gp (AMD64_FS_REGNUM, FS);
-+  netbsd_x86_64_collect_gp (AMD64_GS_REGNUM, GS);
-+}
-+
-+/* The store_function for the general-purpose register set.  */
-+
-+static void
-+netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf)
-+{
-+  struct reg *r = (struct reg *) buf;
-+
-+#define netbsd_x86_64_supply_gp(regnum, fld) do {		\
-+    supply_register (regcache, regnum, &r->regs[_REG_##fld]);	\
-+  } while(0)
-+
-+  netbsd_x86_64_supply_gp (AMD64_RAX_REGNUM, RAX);
-+  netbsd_x86_64_supply_gp (AMD64_RBX_REGNUM, RBX);
-+  netbsd_x86_64_supply_gp (AMD64_RCX_REGNUM, RCX);
-+  netbsd_x86_64_supply_gp (AMD64_RDX_REGNUM, RDX);
-+  netbsd_x86_64_supply_gp (AMD64_RSI_REGNUM, RSI);
-+  netbsd_x86_64_supply_gp (AMD64_RDI_REGNUM, RDI);
-+  netbsd_x86_64_supply_gp (AMD64_RBP_REGNUM, RBP);
-+  netbsd_x86_64_supply_gp (AMD64_RSP_REGNUM, RSP);
-+  netbsd_x86_64_supply_gp (AMD64_R8_REGNUM, R8);
-+  netbsd_x86_64_supply_gp (AMD64_R9_REGNUM, R9);
-+  netbsd_x86_64_supply_gp (AMD64_R10_REGNUM, R10);
-+  netbsd_x86_64_supply_gp (AMD64_R11_REGNUM, R11);
-+  netbsd_x86_64_supply_gp (AMD64_R12_REGNUM, R12);
-+  netbsd_x86_64_supply_gp (AMD64_R13_REGNUM, R13);
-+  netbsd_x86_64_supply_gp (AMD64_R14_REGNUM, R14);
-+  netbsd_x86_64_supply_gp (AMD64_R15_REGNUM, R15);
-+  netbsd_x86_64_supply_gp (AMD64_RIP_REGNUM, RIP);
-+  netbsd_x86_64_supply_gp (AMD64_EFLAGS_REGNUM, RFLAGS);
-+  netbsd_x86_64_supply_gp (AMD64_CS_REGNUM, CS);
-+  netbsd_x86_64_supply_gp (AMD64_SS_REGNUM, SS);
-+  netbsd_x86_64_supply_gp (AMD64_DS_REGNUM, DS);
-+  netbsd_x86_64_supply_gp (AMD64_ES_REGNUM, ES);
-+  netbsd_x86_64_supply_gp (AMD64_FS_REGNUM, FS);
-+  netbsd_x86_64_supply_gp (AMD64_GS_REGNUM, GS);
-+}
-+
-+/* Implements the netbsd_target_ops.arch_setup routine.  */
-+
-+static void
-+netbsd_x86_64_arch_setup (void)
-+{
-+  struct target_desc *tdesc
-+    = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false, false);
-+
-+  init_target_desc (tdesc, amd64_expedite_regs);
-+
-+  netbsd_tdesc = tdesc;
-+}
-+
-+/* Description of all the x86-netbsd register sets.  */
-+
-+struct netbsd_regset_info netbsd_target_regsets[] =
-+{
-+ /* General Purpose Registers.  */
-+ {PT_GETREGS, PT_SETREGS, sizeof (struct reg),
-+  netbsd_x86_64_fill_gregset, netbsd_x86_64_store_gregset},
-+ /* End of list marker.  */
-+ {0, 0, -1, NULL, NULL }
-+};
-+
-+/* The netbsd_target_ops vector for x86-netbsd.  */
-+
-+struct netbsd_target_ops the_low_target =
-+{
-+ netbsd_x86_64_arch_setup,
-+};
diff --git a/gdb-netbsd/patches/patch-gdbsupport_eintr.h b/gdb-netbsd/patches/patch-gdbsupport_eintr.h
index 1c28555680..1be725a990 100644
--- a/gdb-netbsd/patches/patch-gdbsupport_eintr.h
+++ b/gdb-netbsd/patches/patch-gdbsupport_eintr.h
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- gdbsupport/eintr.h.orig	2020-09-04 21:53:29.059799516 +0000
+--- gdbsupport/eintr.h.orig	2020-09-08 13:10:47.484579232 +0000
 +++ gdbsupport/eintr.h
-@@ -0,0 +1,41 @@
+@@ -0,0 +1,67 @@
 +/* Utility for handling interrupted syscalls by signals.
 +
 +   Copyright (C) 2020 Free Software Foundation, Inc.
@@ -29,6 +29,32 @@ $NetBSD$
 +
 +namespace gdb
 +{
++/* Repeat a system call interrupted with a signal.
++
++   A utility for handling interrupted syscalls, which return with error
++   and set the errno to EINTR.  The interrupted syscalls can be repeated,
++   until successful completion.  This utility avoids wrapping code with
++   manual checks for such errors which are highly repetitive.
++
++   For example, with:
++
++   ssize_t ret;
++   do
++     {
++       errno = 0;
++       ret = ::write (pipe[1], "+", 1);
++     }
++   while (ret == -1 && errno == EINTR);
++
++   You could wrap it by writing the wrapped form:
++
++   ssize_t ret = gdb::handle_eintr<ssize_t> (-1, ::write, pipe[1], "+", 1);
++
++   The RET typename specifies the return type of the wrapped system call, which
++   is typically int or ssize_t.  The R argument specifies the failure value
++   indicating the interrupted syscall when calling the F function with
++   the A... arguments.  */
++
 +template <typename Ret, typename Fun, typename... Args>
 +inline Ret handle_eintr (const Ret &R, const Fun &F, const Args &... A)
 +{


Home | Main Index | Thread Index | Old Index