pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
gdb-netbsd: Update to c5cd900e4f197870812c2d3e2c194871c171ef42
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Fri Sep 4 23:55:56 2020 +0200
Changeset: c82a25bb1a0e9d71c6b33607e59fcc2547aa246b
Modified Files:
gdb-netbsd/Makefile
gdb-netbsd/distinfo
gdb-netbsd/patches/patch-gdb_configure.nat
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_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-gdbserver_netbsd-x86__64-low.cc
gdb-netbsd/patches/patch-gdbsupport_eintr.h
Added Files:
gdb-netbsd/patches/patch-gdb_ChangeLog
gdb-netbsd/patches/patch-gdbserver_ChangeLog
gdb-netbsd/patches/patch-gdbsupport_ChangeLog
Log Message:
gdb-netbsd: Update to c5cd900e4f197870812c2d3e2c194871c171ef42
Sync with the gdbserver code that has been submitted upstream, iteration v2.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c82a25bb1a0e9d71c6b33607e59fcc2547aa246b
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
gdb-netbsd/Makefile | 2 +-
gdb-netbsd/distinfo | 33 +++----
gdb-netbsd/patches/patch-gdb_ChangeLog | 61 +++++++++++++
gdb-netbsd/patches/patch-gdb_configure.nat | 2 +-
gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c | 2 +-
gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c | 8 +-
gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h | 9 +-
gdb-netbsd/patches/patch-gdb_nbsd-nat.c | 4 +-
gdb-netbsd/patches/patch-gdbserver_ChangeLog | 17 ++++
gdb-netbsd/patches/patch-gdbserver_Makefile.in | 2 +-
gdb-netbsd/patches/patch-gdbserver_configure.srv | 5 +-
gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc | 100 ++++++++++-----------
gdb-netbsd/patches/patch-gdbserver_netbsd-low.h | 7 +-
.../patches/patch-gdbserver_netbsd-x86__64-low.cc | 71 +--------------
gdb-netbsd/patches/patch-gdbsupport_ChangeLog | 12 +++
gdb-netbsd/patches/patch-gdbsupport_eintr.h | 10 +--
16 files changed, 184 insertions(+), 161 deletions(-)
diffs:
diff --git a/gdb-netbsd/Makefile b/gdb-netbsd/Makefile
index 7108a29758..ba14b8f077 100644
--- a/gdb-netbsd/Makefile
+++ b/gdb-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=bminor/}
GITHUB_PROJECT= binutils-gdb
-GITHUB_TAG= 05fd99cc80b1955e8c846dacfa57fe52816d4869
+GITHUB_TAG= c5cd900e4f197870812c2d3e2c194871c171ef42
HOMEPAGE= https://www.gnu.org/software/gdb/gdb.html
COMMENT= Symbolic debugger for multiple language frontends
diff --git a/gdb-netbsd/distinfo b/gdb-netbsd/distinfo
index 8c4270b59c..bee127dce3 100644
--- a/gdb-netbsd/distinfo
+++ b/gdb-netbsd/distinfo
@@ -1,17 +1,20 @@
$NetBSD$
-SHA1 (gdb-8.2.1-05fd99cc80b1955e8c846dacfa57fe52816d4869.tar.gz) = 8e5ba0ea9f513822d8f5e1b61f1e086832da4fd5
-RMD160 (gdb-8.2.1-05fd99cc80b1955e8c846dacfa57fe52816d4869.tar.gz) = 90987ca409c82bc96c5f3aad04b2d38afce8e5a4
-SHA512 (gdb-8.2.1-05fd99cc80b1955e8c846dacfa57fe52816d4869.tar.gz) = eaa4eaa9a8db968f216077cad4b730b2d6d273cf5205075bcef102c9ca21e85ed2b22e85d5be6bda7c3c4069290f6b7294550e5e6095dcd4401c8d70998162c1
-Size (gdb-8.2.1-05fd99cc80b1955e8c846dacfa57fe52816d4869.tar.gz) = 60902858 bytes
-SHA1 (patch-gdb_configure.nat) = 7806b08e423fca823f3b525c0018fa9fe9aaa41c
-SHA1 (patch-gdb_nat_fork-inferior.c) = 3d800887af4fa8ce3d18f7b4416cba2fa8b6f487
-SHA1 (patch-gdb_nat_netbsd-nat.c) = 42048f8f0184d4aa8c7fbbfb4e5656151be39707
-SHA1 (patch-gdb_nat_netbsd-nat.h) = c2def3bb32c67fd02c7e9ea242c7ccceee26d18c
-SHA1 (patch-gdb_nbsd-nat.c) = 6313f30db292b466e2f2dd00f975bf3e45f0d0c5
-SHA1 (patch-gdbserver_Makefile.in) = 94d6abcf997fdc3cbf9c9ddab34cb242b7f54c76
-SHA1 (patch-gdbserver_configure.srv) = 14937ff7334c5efc013ba30cc6d1116c034e0618
-SHA1 (patch-gdbserver_netbsd-low.cc) = 13cb703fda319fc50f3927cd51a464659cc10b1b
-SHA1 (patch-gdbserver_netbsd-low.h) = 6bae8bf34714db16c667387f12aafaaad8c1f0dd
-SHA1 (patch-gdbserver_netbsd-x86__64-low.cc) = 860e3bb6ce5ca28ca2bab98ed6b975886847759e
-SHA1 (patch-gdbsupport_eintr.h) = 57ee80d3335f49636fd570459fbe72fa434f93ba
+SHA1 (gdb-8.2.1-c5cd900e4f197870812c2d3e2c194871c171ef42.tar.gz) = a22b30c4bd636cff1a8f5116091146c81758e15c
+RMD160 (gdb-8.2.1-c5cd900e4f197870812c2d3e2c194871c171ef42.tar.gz) = c903097d45bd580b588f9aaf73ad94e0a134f8ed
+SHA512 (gdb-8.2.1-c5cd900e4f197870812c2d3e2c194871c171ef42.tar.gz) = be929f01e55df3e98fbdbbb2f93324c0a46c28cd651d1632d05cc41bdb8d1a2a778de7c26f4303b710cb80bff8c0596aa60b4b1167c390ec225dcf73955aceea
+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-gdbsupport_ChangeLog) = f32a8af60f2066764deffd6edebb5473416c6a27
+SHA1 (patch-gdbsupport_eintr.h) = e8892a3499fc84cbc43cf5293874d18964a90959
diff --git a/gdb-netbsd/patches/patch-gdb_ChangeLog b/gdb-netbsd/patches/patch-gdb_ChangeLog
new file mode 100644
index 0000000000..2451f1f196
--- /dev/null
+++ b/gdb-netbsd/patches/patch-gdb_ChangeLog
@@ -0,0 +1,61 @@
+$NetBSD$
+
+--- gdb/ChangeLog.orig 2020-09-03 16:35:18.000000000 +0000
++++ gdb/ChangeLog
+@@ -1,3 +1,56 @@
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * nbsd-nat.c: Include "nat/netbsd-nat.h".
++ * (nbsd_nat_target::pid_to_exec_file)
++ (nbsd_nat_target::thread_alive, nbsd_nat_target::thread_name)
++ (nbsd_nat_target::post_startup_inferior)
++ (nbsd_nat_target::post_attach, nbsd_nat_target::xfer_partial)
++ (nbsd_add_threads): Switch local code to common gdb/nat functions.
++ * (nbsd_pid_to_cmdline): Call sysctl from the global namespace.
++ * (nbsd_thread_lister): Remove.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * fork-inferior.c (startup_inferior): Avoid double free.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.
++ * netbsd-nat.c (netbsd_nat::qxfer_siginfo): Likewise.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-nat.h (netbsd_nat::enable_proc_events): Add.
++ * netbsd-nat.c: Include <sys/ptrace.h>.
++ * (netbsd_nat::enable_proc_events): Add.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-nat.h: Include "gdbsupport/function-view.h".
++ * (netbsd_nat::thread_alive, netbsd_nat::thread_name)
++ (netbsd_nat::for_each_thread): Add.
++ * netbsd-nat.c: Include "gdbsupport/common-defs.h" and
++ "gdbsupport/common-debug.h".
++ * (netbsd_nat::netbsd_thread_lister)
++ (netbsd_nat::thread_alive, netbsd_nat::thread_name)
++ (netbsd_nat::for_each_thread): Add.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-nat.h: Include <unistd.h>.
++ * (netbsd_nat::pid_to_exec_file): Add.
++ * netbsd-nat.c: Include <sys/types.h> and <sys/sysctl.h>.
++ * (netbsd_nat::pid_to_exec_file) Add.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * configure.nat (NATDEPFILES): Add nat/netbsd-nat.o when needed.
++
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-nat.h: New file.
++ * netbsd-nat.c: Likewise.
++
+ 2020-09-03 Alok Kumar Sharma <AlokKumar.Sharma%amd.com@localhost>
+
+ * gdb/i386-tdep.c (i386_floatformat_for_type): Added conditions
diff --git a/gdb-netbsd/patches/patch-gdb_configure.nat b/gdb-netbsd/patches/patch-gdb_configure.nat
index 25888b0a95..a870cca0f9 100644
--- a/gdb-netbsd/patches/patch-gdb_configure.nat
+++ b/gdb-netbsd/patches/patch-gdb_configure.nat
@@ -1,6 +1,6 @@
$NetBSD$
---- gdb/configure.nat.orig 2020-08-26 18:57:35.000000000 +0000
+--- gdb/configure.nat.orig 2020-09-03 16:35:18.000000000 +0000
+++ gdb/configure.nat
@@ -68,7 +68,7 @@ case ${gdb_host} in
LOADLIBES='-lkvm'
diff --git a/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c b/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
index 9e37bdcb25..2546c0526c 100644
--- a/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
+++ b/gdb-netbsd/patches/patch-gdb_nat_fork-inferior.c
@@ -1,6 +1,6 @@
$NetBSD$
---- gdb/nat/fork-inferior.c.orig 2020-08-26 18:57:35.000000000 +0000
+--- gdb/nat/fork-inferior.c.orig 2020-09-03 16:35:18.000000000 +0000
+++ gdb/nat/fork-inferior.c
@@ -526,7 +526,10 @@ startup_inferior (process_stratum_target
diff --git a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
index 371b6260e8..5f87adc4a7 100644
--- a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
+++ b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.c
@@ -1,8 +1,8 @@
$NetBSD$
---- gdb/nat/netbsd-nat.c.orig 2020-09-02 16:10:13.481373355 +0000
+--- gdb/nat/netbsd-nat.c.orig 2020-09-04 21:53:29.055817757 +0000
+++ gdb/nat/netbsd-nat.c
-@@ -0,0 +1,211 @@
+@@ -0,0 +1,213 @@
+/* Internal interfaces for the NetBSD code.
+
+ Copyright (C) 2006-2020 Free Software Foundation, Inc.
@@ -30,6 +30,8 @@ $NetBSD$
+#include <sys/ptrace.h>
+#include <sys/sysctl.h>
+
++#include <cstring>
++
+#include "gdbsupport/function-view.h"
+
+namespace netbsd_nat
@@ -153,7 +155,7 @@ $NetBSD$
+ is a C++ function that is called for each detected thread. */
+
+void
-+list_threads (pid_t pid, gdb::function_view<void (ptid_t)> callback)
++for_each_thread (pid_t pid, gdb::function_view<void (ptid_t)> callback)
+{
+ auto fn
+ = [&callback, &pid] (const struct kinfo_lwp *kl)
diff --git a/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h b/gdb-netbsd/patches/patch-gdb_nat_netbsd-nat.h
index 44460e15f6..a1597b10aa 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-02 16:10:13.481487586 +0000
+--- gdb/nat/netbsd-nat.h.orig 2020-09-04 21:53:29.055935316 +0000
+++ gdb/nat/netbsd-nat.h
-@@ -0,0 +1,47 @@
+@@ -0,0 +1,46 @@
+/* Internal interfaces for the NetBSD code.
+
+ Copyright (C) 2006-2020 Free Software Foundation, Inc.
@@ -38,15 +38,14 @@ $NetBSD$
+
+extern const char *thread_name (ptid_t ptid);
+
-+extern void list_threads (pid_t pid,
-+ gdb::function_view<void (ptid_t)> callback);
++extern void for_each_thread (pid_t pid,
++ gdb::function_view<void (ptid_t)> callback);
+
+extern void enable_proc_events (pid_t pid);
+
+extern int qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len);
-+
+}
+
+#endif
diff --git a/gdb-netbsd/patches/patch-gdb_nbsd-nat.c b/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
index 0498fb7f57..0543378116 100644
--- a/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
+++ b/gdb-netbsd/patches/patch-gdb_nbsd-nat.c
@@ -1,6 +1,6 @@
$NetBSD$
---- gdb/nbsd-nat.c.orig 2020-08-26 18:57:35.000000000 +0000
+--- gdb/nbsd-nat.c.orig 2020-09-03 16:35:18.000000000 +0000
+++ gdb/nbsd-nat.c
@@ -20,6 +20,7 @@
#include "defs.h"
@@ -182,7 +182,7 @@ $NetBSD$
-
- if (ptrace (PT_SET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
- perror_with_name (("ptrace"));
-+ netbsd_nat::list_threads (pid, fn);
++ netbsd_nat::for_each_thread (pid, fn);
}
/* Implement the "post_startup_inferior" target_ops method. */
diff --git a/gdb-netbsd/patches/patch-gdbserver_ChangeLog b/gdb-netbsd/patches/patch-gdbserver_ChangeLog
new file mode 100644
index 0000000000..1527f08273
--- /dev/null
+++ b/gdb-netbsd/patches/patch-gdbserver_ChangeLog
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- gdbserver/ChangeLog.orig 2020-09-03 16:35:18.000000000 +0000
++++ gdbserver/ChangeLog
+@@ -1,3 +1,12 @@
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * netbsd-low.cc: Add.
++ * netbsd-low.h: Likewise.
++ * netbsd-x86_64-low.cc: Likewise.
++ * Makefile.in (SFILES): Register "netbsd-low.cc", "netbsd-low.h",
++ "netbsd-x86_64-low.cc".
++ * configure.srv: Add x86_64-*-netbsd*.
++
+ 2020-08-13 Simon Marchi <simon.marchi%polymtl.ca@localhost>
+
+ * server.cc (captured_main): Accept multiple `--selftest=`
diff --git a/gdb-netbsd/patches/patch-gdbserver_Makefile.in b/gdb-netbsd/patches/patch-gdbserver_Makefile.in
index 21d6b593ec..647a2142a8 100644
--- a/gdb-netbsd/patches/patch-gdbserver_Makefile.in
+++ b/gdb-netbsd/patches/patch-gdbserver_Makefile.in
@@ -1,6 +1,6 @@
$NetBSD$
---- gdbserver/Makefile.in.orig 2020-08-26 18:57:35.000000000 +0000
+--- gdbserver/Makefile.in.orig 2020-09-03 16:35:18.000000000 +0000
+++ gdbserver/Makefile.in
@@ -193,6 +193,9 @@ SFILES = \
$(srcdir)/linux-x86-low.cc \
diff --git a/gdb-netbsd/patches/patch-gdbserver_configure.srv b/gdb-netbsd/patches/patch-gdbserver_configure.srv
index 966010839e..6c19c392a7 100644
--- a/gdb-netbsd/patches/patch-gdbserver_configure.srv
+++ b/gdb-netbsd/patches/patch-gdbserver_configure.srv
@@ -1,8 +1,8 @@
$NetBSD$
---- gdbserver/configure.srv.orig 2020-08-26 18:57:35.000000000 +0000
+--- gdbserver/configure.srv.orig 2020-09-03 16:35:18.000000000 +0000
+++ gdbserver/configure.srv
-@@ -349,6 +349,13 @@ case "${gdbserver_host}" in
+@@ -349,6 +349,12 @@ case "${gdbserver_host}" in
srv_tgtobj="${srv_tgtobj} nat/windows-nat.o"
srv_tgtobj="${srv_tgtobj} arch/amd64.o arch/i386.o"
;;
@@ -11,7 +11,6 @@ $NetBSD$
+ srv_tgtobj="${srv_tgtobj} nat/fork-inferior.o"
+ srv_tgtobj="${srv_tgtobj} nat/netbsd-nat.o"
+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
-+ srv_netbsd=yes
+ ;;
xtensa*-*-linux*) srv_regobj=reg-xtensa.o
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.cc
index ad7500e88a..7e7c282627 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-02 16:10:13.482445671 +0000
+--- gdbserver/netbsd-low.cc.orig 2020-09-04 21:53:29.059281151 +0000
+++ gdbserver/netbsd-low.cc
-@@ -0,0 +1,1352 @@
+@@ -0,0 +1,1348 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GDB.
@@ -50,17 +50,15 @@ $NetBSD$
+
+const struct target_desc *netbsd_tdesc;
+
-+/* Call add_process with the given parameters, and initializes
++/* Call add_process with the given parameters, and initialize
+ the process' private data. */
+
-+static struct process_info *
++static void
+netbsd_add_process (int pid, int attached)
+{
+ struct process_info *proc = add_process (pid, attached);
+ proc->tdesc = netbsd_tdesc;
+ proc->priv = nullptr;
-+
-+ return proc;
+}
+
+/* Callback used by fork_inferior to start tracing the inferior. */
@@ -90,7 +88,7 @@ $NetBSD$
+ if (write (2, "stdin/stdout redirected\n",
+ sizeof ("stdin/stdout redirected\n") - 1) < 0)
+ {
-+ /* Errors ignored. */;
++ /* Errors ignored. */
+ }
+ }
+}
@@ -106,7 +104,7 @@ $NetBSD$
+ add_thread (ptid, nullptr);
+ };
+
-+ netbsd_nat::list_threads (pid, fn);
++ netbsd_nat::for_each_thread (pid, fn);
+}
+
+/* Implement the create_inferior method of the target_ops vector. */
@@ -171,7 +169,7 @@ $NetBSD$
+ ptid_t resume_ptid = resume_info[0].thread;
+ const int signal = resume_info[0].sig;
+ const bool step = resume_info[0].kind == resume_step;
-+
++
+ if (resume_ptid == minus_one_ptid)
+ resume_ptid = ptid_of (current_thread);
+
@@ -208,7 +206,7 @@ $NetBSD$
+ }
+ };
+
-+ netbsd_nat::list_threads (pid, fn);
++ netbsd_nat::for_each_thread (pid, fn);
+
+ int request = gdb_catching_syscalls_p (pid) ? PT_CONTINUE : PT_SYSCALL;
+
@@ -241,6 +239,7 @@ $NetBSD$
+/* Helper function for child_wait and the derivatives of child_wait.
+ HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
+ translation of that in OURSTATUS. */
++
+static void
+netbsd_store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
+{
@@ -268,7 +267,8 @@ $NetBSD$
+{
+ int status;
+
-+ pid_t pid = gdb::handle_eintr (::waitpid, ptid.pid (), &status, options);
++ pid_t pid
++ = gdb::handle_eintr<int> (-1, ::waitpid, ptid.pid (), &status, options);
+
+ if (pid == -1)
+ perror_with_name (_("Child process unexpectedly missing"));
@@ -287,7 +287,7 @@ $NetBSD$
+static ptid_t
+netbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int target_options)
-+{
++{
+ pid_t pid = netbsd_waitpid (ptid, ourstatus, target_options);
+ ptid_t wptid = ptid_t (pid);
+
@@ -321,7 +321,7 @@ $NetBSD$
+ If a signal was targeted to the whole process, lwp is 0. */
+ wptid = ptid_t (pid, lwp, 0);
+
-+ /* Bail out on non-debugger oriented signals.. */
++ /* Bail out on non-debugger oriented signals. */
+ if (signo != SIGTRAP)
+ return wptid;
+
@@ -329,13 +329,11 @@ $NetBSD$
+ if (code <= SI_USER || code == SI_NOINFO)
+ return wptid;
+
-+ /* Process state for threading events */
++ /* Process state for threading events. */
+ ptrace_state_t pst = {};
+ if (code == TRAP_LWP)
-+ {
-+ if (ptrace (PT_GET_PROCESS_STATE, pid, &pst, sizeof (pst)) == -1)
-+ perror_with_name (("ptrace"));
-+ }
++ if (ptrace (PT_GET_PROCESS_STATE, pid, &pst, sizeof (pst)) == -1)
++ perror_with_name (("ptrace"));
+
+ if (code == TRAP_LWP && pst.pe_report_event == PTRACE_LWP_EXIT)
+ {
@@ -385,9 +383,7 @@ $NetBSD$
+ }
+
+ if (code == TRAP_TRACE)
-+ {
+ return wptid;
-+ }
+
+ if (code == TRAP_SCE || code == TRAP_SCX)
+ {
@@ -400,9 +396,9 @@ $NetBSD$
+ return wptid;
+ }
+
-+ ourstatus->kind =
-+ (code == TRAP_SCE) ? TARGET_WAITKIND_SYSCALL_ENTRY :
-+ TARGET_WAITKIND_SYSCALL_RETURN;
++ ourstatus->kind
++ = ((code == TRAP_SCE) ? TARGET_WAITKIND_SYSCALL_ENTRY :
++ TARGET_WAITKIND_SYSCALL_RETURN);
+ ourstatus->value.syscall_number = sysnum;
+ return wptid;
+ }
@@ -439,7 +435,7 @@ $NetBSD$
+ This is required after ::create_inferior, when the gdbcore does not
+ know about the first internal thread.
+ This may also happen on attach, when an event is registered on a thread
-+ that was not fully initialized during the attach stage. */
++ that was not fully initialized during the attach stage. */
+ if (wptid.lwp () != 0 && !find_thread_ptid (wptid)
+ && ourstatus->kind != TARGET_WAITKIND_THREAD_EXITED)
+ add_thread (wptid, nullptr);
@@ -468,7 +464,7 @@ $NetBSD$
+ perror_with_name (("ptrace"));
+ break;
+ default:
-+ error (("Unknwon stopped status"));
++ error (("Unknown stopped status"));
+ }
+ }
+}
@@ -479,10 +475,12 @@ $NetBSD$
+netbsd_process_target::kill (process_info *process)
+{
+ pid_t pid = process->pid;
-+ ptrace (PT_KILL, pid, nullptr, 0);
++ if (ptrace (PT_KILL, pid, nullptr, 0) == -1)
++ return -1;
+
+ int status;
-+ gdb::handle_eintr (::waitpid, pid, &status, 0);
++ if (gdb::handle_eintr<int> (-1, ::waitpid, pid, &status, 0) == -1)
++ return -1;
+ mourn (process);
+ return 0;
+}
@@ -652,7 +650,7 @@ $NetBSD$
+ return 0;
+}
+
-+/* Implement the kill_request target_ops method. */
++/* Implement the request_interrupt target_ops method. */
+
+void
+netbsd_process_target::request_interrupt ()
@@ -662,6 +660,10 @@ $NetBSD$
+ ::kill (inferior_ptid.pid(), SIGINT);
+}
+
++/* Read the AUX Vector for the specified PID, wrapping the ptrace(2) call
++ with the PIOD_READ_AUXV operation and using the PT_IO standard input
++ and output arguments. */
++
+static size_t
+netbsd_read_auxv(pid_t pid, void *offs, void *addr, size_t len)
+{
@@ -744,8 +746,7 @@ $NetBSD$
+ }
+}
+
-+/* Implement the to_stopped_by_sw_breakpoint target_ops
-+ method. */
++/* Implement the stopped_by_sw_breakpoint target_ops method. */
+
+bool
+netbsd_process_target::stopped_by_sw_breakpoint ()
@@ -760,8 +761,7 @@ $NetBSD$
+ psi.psi_siginfo.si_code == TRAP_BRKPT;
+}
+
-+/* Implement the to_supports_stopped_by_sw_breakpoint target_ops
-+ method. */
++/* Implement the supports_stopped_by_sw_breakpoint target_ops method. */
+
+bool
+netbsd_process_target::supports_stopped_by_sw_breakpoint ()
@@ -881,8 +881,8 @@ $NetBSD$
+ if (*phdr_memaddr == 0 || *num_phdr == 0)
+ {
+ warning ("Unexpected missing AT_PHDR and/or AT_PHNUM: "
-+ "phdr_memaddr = %ld, phdr_num = %d",
-+ (long) *phdr_memaddr, *num_phdr);
++ "phdr_memaddr = %s, phdr_num = %d",
++ core_addr_to_string (*phdr_memaddr), *num_phdr);
+ return 2;
+ }
+
@@ -907,7 +907,7 @@ $NetBSD$
+ std::vector<unsigned char> phdr_buf;
+ phdr_buf.resize (num_phdr * phdr_size);
+
-+ if ((*target).read_memory (phdr_memaddr, phdr_buf.data (), phdr_buf.size ()))
++ if (target->read_memory (phdr_memaddr, phdr_buf.data (), phdr_buf.size ()))
+ return 0;
+
+ /* Compute relocation: it is expected to be 0 for "regular" executables,
@@ -966,7 +966,7 @@ $NetBSD$
+ if (dynamic_memaddr == 0)
+ return map;
+
-+ while ((*target).read_memory (dynamic_memaddr, buf, dyn_size) == 0)
++ while (target->read_memory (dynamic_memaddr, buf, dyn_size) == 0)
+ {
+ dyn_type *const dyn = (dyn_type *) buf;
+#if defined DT_MIPS_RLD_MAP
@@ -1017,7 +1017,7 @@ $NetBSD$
+ unsigned char uc;
+ } addr;
+
-+ int ret = (*target).read_memory (memaddr, &addr.uc, ptr_size);
++ int ret = target->read_memory (memaddr, &addr.uc, ptr_size);
+ if (ret == 0)
+ {
+ if (ptr_size == sizeof (CORE_ADDR))
@@ -1091,8 +1091,8 @@ $NetBSD$
+ int header_done = 0;
+
+ const struct link_map_offsets *lmo
-+ = (sizeof (T) == sizeof (int64_t))
-+ ? &lmo_64bit_offsets : &lmo_32bit_offsets;
++ = ((sizeof (T) == sizeof (int64_t))
++ ? &lmo_64bit_offsets : &lmo_32bit_offsets);
+ int ptr_size = sizeof (T);
+
+ while (annex[0] != '\0')
@@ -1131,12 +1131,10 @@ $NetBSD$
+
+ if (r_debug != 0)
+ {
-+ if (read_one_ptr (target, r_debug + lmo->r_map_offset,
-+ &lm_addr, ptr_size) != 0)
-+ {
-+ warning ("unable to read r_map from 0x%lx",
-+ (long) r_debug + lmo->r_map_offset);
-+ }
++ CORE_ADDR map_offset = r_debug + lmo->r_map_offset;
++ if (read_one_ptr (target, map_offset, &lm_addr, ptr_size) != 0)
++ warning ("unable to read r_map from %s",
++ core_addr_to_string (map_offset));
+ }
+ }
+
@@ -1177,7 +1175,7 @@ $NetBSD$
+ /* Not checking for error because reading may stop before
+ we've got PATH_MAX worth of characters. */
+ libname[0] = '\0';
-+ (*target).read_memory (l_name, libname, sizeof (libname) - 1);
++ target->read_memory (l_name, libname, sizeof (libname) - 1);
+ libname[sizeof (libname) - 1] = '\0';
+ if (libname[0] != '\0')
+ {
@@ -1229,15 +1227,15 @@ $NetBSD$
+static bool
+elf_64_file_p (const char *file)
+{
-+ int fd = gdb::handle_eintr (::open, file, O_RDONLY);
++ int fd = gdb::handle_eintr<int> (-1, ::open, file, O_RDONLY);
+ if (fd < 0)
+ perror_with_name (("open"));
+
+ Elf64_Ehdr header;
-+ ssize_t ret = gdb::handle_eintr (::read, fd, &header, sizeof (header));
++ ssize_t ret = gdb::handle_eintr<ssize_t> (-1, ::read, fd, &header, sizeof (header));
+ if (ret == -1)
+ perror_with_name (("read"));
-+ gdb::handle_eintr (::close, fd);
++ gdb::handle_eintr<int> (-1, ::close, fd);
+ if (ret != sizeof (header))
+ error ("Cannot read ELF file header: %s", file);
+
@@ -1312,12 +1310,10 @@ $NetBSD$
+const gdb_byte *
+netbsd_process_target::sw_breakpoint_from_kind (int kind, int *size)
+{
-+ static gdb_byte brkpt[PTRACE_BREAKPOINT_SIZE];
++ static gdb_byte brkpt[PTRACE_BREAKPOINT_SIZE] = {*PTRACE_BREAKPOINT};
+
+ *size = PTRACE_BREAKPOINT_SIZE;
+
-+ memcpy (brkpt, PTRACE_BREAKPOINT, PTRACE_BREAKPOINT_SIZE);
-+
+ return brkpt;
+}
+
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
index 452ff3478e..3d83e25c23 100644
--- a/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
+++ b/gdb-netbsd/patches/patch-gdbserver_netbsd-low.h
@@ -1,8 +1,8 @@
$NetBSD$
---- gdbserver/netbsd-low.h.orig 2020-09-02 16:10:13.482596165 +0000
+--- gdbserver/netbsd-low.h.orig 2020-09-04 21:53:29.059434433 +0000
+++ gdbserver/netbsd-low.h
-@@ -0,0 +1,157 @@
+@@ -0,0 +1,154 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GDB.
@@ -53,9 +53,6 @@ $NetBSD$
+{
+ /* Architecture-specific setup. */
+ void (*arch_setup) ();
-+
-+ /* Hook to support target specific qSupported. */
-+ void (*process_qsupported) (char **, int count);
+};
+
+/* Target ops definitions for a NetBSD target. */
diff --git a/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc b/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc
index 382922aae7..ca802fcebc 100644
--- a/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc
+++ b/gdb-netbsd/patches/patch-gdbserver_netbsd-x86__64-low.cc
@@ -1,8 +1,8 @@
$NetBSD$
---- gdbserver/netbsd-x86_64-low.cc.orig 2020-09-02 16:10:13.482761789 +0000
+--- gdbserver/netbsd-x86_64-low.cc.orig 2020-09-04 21:53:29.059587469 +0000
+++ gdbserver/netbsd-x86_64-low.cc
-@@ -0,0 +1,250 @@
+@@ -0,0 +1,187 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GDB.
@@ -31,8 +31,6 @@ $NetBSD$
+#include "x86-tdesc.h"
+#include "tdesc.h"
+
-+static int use_xml;
-+
+/* The index of various registers inside the regcache. */
+
+enum netbsd_x86_64_gdb_regnum
@@ -93,7 +91,7 @@ $NetBSD$
+static void
+netbsd_x86_64_fill_gregset (struct regcache *regcache, char *buf)
+{
-+ struct reg *r = (struct reg *)buf;
++ struct reg *r = (struct reg *) buf;
+
+#define netbsd_x86_64_collect_gp(regnum, fld) do { \
+ collect_register (regcache, regnum, &r->regs[_REG_##fld]); \
@@ -130,7 +128,7 @@ $NetBSD$
+static void
+netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf)
+{
-+ struct reg *r = (struct reg *)buf;
++ struct reg *r = (struct reg *) buf;
+
+#define netbsd_x86_64_supply_gp(regnum, fld) do { \
+ supply_register (regcache, regnum, &r->regs[_REG_##fld]); \
@@ -175,66 +173,6 @@ $NetBSD$
+ netbsd_tdesc = tdesc;
+}
+
-+/* Update all the target description of all processes; a new GDB
-+ connected, and it may or not support xml target descriptions. */
-+
-+static void
-+x86_64_netbsd_update_xmltarget (void)
-+{
-+ struct thread_info *saved_thread = current_thread;
-+
-+ /* Before changing the register cache's internal layout, flush the
-+ contents of the current valid caches back to the threads, and
-+ release the current regcache objects. */
-+ regcache_release ();
-+
-+ for_each_process ([] (process_info *proc) {
-+ int pid = proc->pid;
-+
-+ /* Look up any thread of this process. */
-+ current_thread = find_any_thread_of_pid (pid);
-+
-+ the_low_target.arch_setup ();
-+ });
-+
-+ current_thread = saved_thread;
-+}
-+
-+/* Process qSupported query, "xmlRegisters=". */
-+
-+static void
-+netbsd_x86_64_process_qsupported (char **features, int count)
-+{
-+ /* Return if gdb doesn't support XML. If gdb sends "xmlRegisters="
-+ with "i386" in qSupported query, it supports x86 XML target
-+ descriptions. */
-+ use_xml = 0;
-+ for (int i = 0; i < count; i++)
-+ {
-+ const char *feature = features[i];
-+
-+ if (startswith (feature, "xmlRegisters="))
-+ {
-+ char *copy = xstrdup (feature + 13);
-+ char *last;
-+ char *p;
-+
-+ for (p = strtok_r (copy, ",", &last); p != NULL;
-+ p = strtok_r (NULL, ",", &last))
-+ {
-+ if (strcmp (p, "i386") == 0)
-+ {
-+ use_xml = 1;
-+ break;
-+ }
-+ }
-+
-+ free (copy);
-+ }
-+ }
-+ x86_64_netbsd_update_xmltarget ();
-+}
-+
+/* Description of all the x86-netbsd register sets. */
+
+struct netbsd_regset_info netbsd_target_regsets[] =
@@ -251,5 +189,4 @@ $NetBSD$
+struct netbsd_target_ops the_low_target =
+{
+ netbsd_x86_64_arch_setup,
-+ netbsd_x86_64_process_qsupported,
+};
diff --git a/gdb-netbsd/patches/patch-gdbsupport_ChangeLog b/gdb-netbsd/patches/patch-gdbsupport_ChangeLog
new file mode 100644
index 0000000000..1a45e9cb27
--- /dev/null
+++ b/gdb-netbsd/patches/patch-gdbsupport_ChangeLog
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- gdbsupport/ChangeLog.orig 2020-09-03 16:35:18.000000000 +0000
++++ gdbsupport/ChangeLog
+@@ -1,3 +1,7 @@
++2020-09-04 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * eintr.h: New file.
++
+ 2020-08-13 Simon Marchi <simon.marchi%polymtl.ca@localhost>
+
+ * selftest.h (run_tests): Change parameter to array_view.
diff --git a/gdb-netbsd/patches/patch-gdbsupport_eintr.h b/gdb-netbsd/patches/patch-gdbsupport_eintr.h
index 4d154cc695..1c28555680 100644
--- a/gdb-netbsd/patches/patch-gdbsupport_eintr.h
+++ b/gdb-netbsd/patches/patch-gdbsupport_eintr.h
@@ -1,6 +1,6 @@
$NetBSD$
---- gdbsupport/eintr.h.orig 2020-09-02 16:10:13.482874765 +0000
+--- gdbsupport/eintr.h.orig 2020-09-04 21:53:29.059799516 +0000
+++ gdbsupport/eintr.h
@@ -0,0 +1,41 @@
+/* Utility for handling interrupted syscalls by signals.
@@ -29,16 +29,16 @@ $NetBSD$
+
+namespace gdb
+{
-+template <typename Fun, typename... Args>
-+inline decltype (auto) handle_eintr (const Fun &F, const Args &... A)
++template <typename Ret, typename Fun, typename... Args>
++inline Ret handle_eintr (const Ret &R, const Fun &F, const Args &... A)
+{
-+ decltype (F (A...)) ret;
++ Ret ret;
+ do
+ {
+ errno = 0;
+ ret = F (A...);
+ }
-+ while (ret == -1 && errno == EINTR);
++ while (ret == R && errno == EINTR);
+ return ret;
+}
+}
Home |
Main Index |
Thread Index |
Old Index