gdb-server: Update gdbserver patches
This commit is contained in:
parent
e2d9d11799
commit
92fd532fe2
|
@ -4,8 +4,14 @@ SHA1 (gdb-8.2.1-05fd99cc80b1955e8c846dacfa57fe52816d4869.tar.gz) = 8e5ba0ea9f513
|
|||
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) = 5a70d03065f58a90c7ef12e293e0c65c0a4f869a
|
||||
SHA1 (patch-gdbserver_netbsd-low.cc) = 5afebe61bf8b9c8b3c2bf055e9f59e15bc76bc81
|
||||
SHA1 (patch-gdbserver_netbsd-low.h) = 1a636f92c703f9e3049fa97f177f1d808c62a6ed
|
||||
SHA1 (patch-gdbserver_netbsd-x86__64-low.cc) = 9f9d9da379cb11054068325375b4e6005e622101
|
||||
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
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdb/configure.nat.orig 2020-08-26 18:57:35.000000000 +0000
|
||||
+++ gdb/configure.nat
|
||||
@@ -68,7 +68,7 @@ case ${gdb_host} in
|
||||
LOADLIBES='-lkvm'
|
||||
;;
|
||||
nbsd*)
|
||||
- NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o'
|
||||
+ NATDEPFILES='fork-child.o nat/fork-inferior.o nat/netbsd-nat.o inf-ptrace.o'
|
||||
HAVE_NATIVE_GCORE_HOST=1
|
||||
;;
|
||||
obsd*)
|
|
@ -0,0 +1,16 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdb/nat/fork-inferior.c.orig 2020-08-26 18:57:35.000000000 +0000
|
||||
+++ gdb/nat/fork-inferior.c
|
||||
@@ -526,7 +526,10 @@ startup_inferior (process_stratum_target
|
||||
|
||||
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. */
|
||||
+ if (pending_execs != 1)
|
||||
+ xfree (ws.value.execd_pathname);
|
||||
resume_signal = GDB_SIGNAL_TRAP;
|
||||
switch_to_thread (proc_target, event_ptid);
|
||||
break;
|
|
@ -0,0 +1,216 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdb/nat/netbsd-nat.c.orig 2020-09-02 16:10:13.481373355 +0000
|
||||
+++ gdb/nat/netbsd-nat.c
|
||||
@@ -0,0 +1,211 @@
|
||||
+/* Internal interfaces for the NetBSD code.
|
||||
+
|
||||
+ Copyright (C) 2006-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 "gdbsupport/common-defs.h"
|
||||
+#include "nat/netbsd-nat.h"
|
||||
+#include "gdbsupport/common-debug.h"
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/ptrace.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+
|
||||
+#include "gdbsupport/function-view.h"
|
||||
+
|
||||
+namespace netbsd_nat
|
||||
+{
|
||||
+
|
||||
+/* Return the executable file name of a process specified by PID. Returns the
|
||||
+ string in a static buffer. */
|
||||
+
|
||||
+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))
|
||||
+ 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. */
|
||||
+
|
||||
+static bool
|
||||
+netbsd_thread_lister (const pid_t pid,
|
||||
+ gdb::function_view<bool (const struct kinfo_lwp *)>
|
||||
+ callback)
|
||||
+{
|
||||
+ int mib[5] = {CTL_KERN, KERN_LWP, pid, sizeof (struct kinfo_lwp), 0};
|
||||
+ size_t size;
|
||||
+
|
||||
+ if (sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
|
||||
+ perror_with_name (("sysctl"));
|
||||
+
|
||||
+ mib[4] = size / sizeof (size_t);
|
||||
+
|
||||
+ gdb::unique_xmalloc_ptr<struct kinfo_lwp[]> kl
|
||||
+ ((struct kinfo_lwp *) xcalloc (size, 1));
|
||||
+
|
||||
+ if (sysctl (mib, ARRAY_SIZE (mib), kl.get (), &size, NULL, 0) == -1
|
||||
+ || size == 0)
|
||||
+ perror_with_name (("sysctl"));
|
||||
+
|
||||
+ for (size_t i = 0; i < size / sizeof (struct kinfo_lwp); i++)
|
||||
+ {
|
||||
+ struct kinfo_lwp *l = &kl[i];
|
||||
+
|
||||
+ /* Return true if the specified thread is alive. */
|
||||
+ auto lwp_alive
|
||||
+ = [] (struct kinfo_lwp *lwp)
|
||||
+ {
|
||||
+ switch (lwp->l_stat)
|
||||
+ {
|
||||
+ case LSSLEEP:
|
||||
+ case LSRUN:
|
||||
+ case LSONPROC:
|
||||
+ case LSSTOP:
|
||||
+ case LSSUSPENDED:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ /* Ignore embryonic or demised threads. */
|
||||
+ if (!lwp_alive (l))
|
||||
+ continue;
|
||||
+
|
||||
+ if (callback (l))
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+/* Return true if PTID is still active in the inferior. */
|
||||
+
|
||||
+bool
|
||||
+thread_alive (ptid_t ptid)
|
||||
+{
|
||||
+ pid_t pid = ptid.pid ();
|
||||
+ lwpid_t lwp = ptid.lwp ();
|
||||
+
|
||||
+ auto fn
|
||||
+ = [&lwp] (const struct kinfo_lwp *kl)
|
||||
+ {
|
||||
+ return kl->l_lid == lwp;
|
||||
+ };
|
||||
+
|
||||
+ return netbsd_thread_lister (pid, fn);
|
||||
+}
|
||||
+
|
||||
+/* Return the name assigned to a thread by an application. Returns
|
||||
+ the string in a static buffer. */
|
||||
+
|
||||
+const char *
|
||||
+thread_name (ptid_t ptid)
|
||||
+{
|
||||
+ pid_t pid = ptid.pid ();
|
||||
+ lwpid_t lwp = ptid.lwp ();
|
||||
+
|
||||
+ static char buf[KI_LNAMELEN] = {};
|
||||
+
|
||||
+ auto fn
|
||||
+ = [&lwp] (const struct kinfo_lwp *kl)
|
||||
+ {
|
||||
+ if (kl->l_lid == lwp)
|
||||
+ {
|
||||
+ xsnprintf (buf, sizeof buf, "%s", kl->l_name);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ };
|
||||
+
|
||||
+ if (netbsd_thread_lister (pid, fn))
|
||||
+ return buf;
|
||||
+ else
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* A generic thread lister within a specific PID. The CALLBACK parameter
|
||||
+ is a C++ function that is called for each detected thread. */
|
||||
+
|
||||
+void
|
||||
+list_threads (pid_t pid, gdb::function_view<void (ptid_t)> callback)
|
||||
+{
|
||||
+ auto fn
|
||||
+ = [&callback, &pid] (const struct kinfo_lwp *kl)
|
||||
+ {
|
||||
+ ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
|
||||
+ callback (ptid);
|
||||
+ return false;
|
||||
+ };
|
||||
+
|
||||
+ netbsd_thread_lister (pid, fn);
|
||||
+}
|
||||
+
|
||||
+/* Enable additional event reporting in a new process specified by PID. */
|
||||
+
|
||||
+void
|
||||
+enable_proc_events (pid_t pid)
|
||||
+{
|
||||
+ int events;
|
||||
+
|
||||
+ if (ptrace (PT_GET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
+ perror_with_name (("ptrace"));
|
||||
+
|
||||
+ events |= PTRACE_LWP_CREATE;
|
||||
+ events |= PTRACE_LWP_EXIT;
|
||||
+
|
||||
+ if (ptrace (PT_SET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
+ 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. */
|
||||
+
|
||||
+int
|
||||
+qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf,
|
||||
+ unsigned const char *writebuf, CORE_ADDR offset, int len)
|
||||
+{
|
||||
+ ptrace_siginfo_t psi;
|
||||
+
|
||||
+ if (offset > sizeof (siginfo_t))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (offset + len > sizeof (siginfo_t))
|
||||
+ len = sizeof (siginfo_t) - offset;
|
||||
+
|
||||
+ if (readbuf != NULL)
|
||||
+ memcpy (readbuf, ((gdb_byte *) &psi.psi_siginfo) + offset, len);
|
||||
+ else
|
||||
+ {
|
||||
+ memcpy (((gdb_byte *) &psi.psi_siginfo) + offset, writebuf, len);
|
||||
+
|
||||
+ if (ptrace (PT_SET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+}
|
|
@ -0,0 +1,52 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdb/nat/netbsd-nat.h.orig 2020-09-02 16:10:13.481487586 +0000
|
||||
+++ gdb/nat/netbsd-nat.h
|
||||
@@ -0,0 +1,47 @@
|
||||
+/* Internal interfaces for the NetBSD code.
|
||||
+
|
||||
+ Copyright (C) 2006-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/>. */
|
||||
+
|
||||
+#ifndef NAT_NETBSD_NAT_H
|
||||
+#define NAT_NETBSD_NAT_H
|
||||
+
|
||||
+#include "gdbsupport/function-view.h"
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+namespace netbsd_nat
|
||||
+{
|
||||
+
|
||||
+extern char *pid_to_exec_file (pid_t pid);
|
||||
+
|
||||
+extern bool thread_alive (ptid_t ptid);
|
||||
+
|
||||
+extern const char *thread_name (ptid_t ptid);
|
||||
+
|
||||
+extern void list_threads (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
|
|
@ -0,0 +1,236 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdb/nbsd-nat.c.orig 2020-08-26 18:57:35.000000000 +0000
|
||||
+++ gdb/nbsd-nat.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
#include "nbsd-nat.h"
|
||||
+#include "nat/netbsd-nat.h"
|
||||
#include "gdbthread.h"
|
||||
#include "nbsd-tdep.h"
|
||||
#include "inferior.h"
|
||||
@@ -36,13 +37,7 @@
|
||||
char *
|
||||
nbsd_nat_target::pid_to_exec_file (int pid)
|
||||
{
|
||||
- static char buf[PATH_MAX];
|
||||
- size_t buflen;
|
||||
- int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_PATHNAME};
|
||||
- buflen = sizeof (buf);
|
||||
- if (sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0))
|
||||
- return NULL;
|
||||
- return buf;
|
||||
+ return netbsd_nat::pid_to_exec_file (pid);
|
||||
}
|
||||
|
||||
/* Return the current directory for the process identified by PID. */
|
||||
@@ -80,12 +75,12 @@ nbsd_pid_to_cmdline (int pid)
|
||||
int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_ARGV};
|
||||
|
||||
size_t size = 0;
|
||||
- if (sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
|
||||
+ if (::sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
|
||||
return nullptr;
|
||||
|
||||
gdb::unique_xmalloc_ptr<char[]> args (XNEWVAR (char, size));
|
||||
|
||||
- if (sysctl (mib, ARRAY_SIZE (mib), args.get (), &size, NULL, 0) == -1
|
||||
+ if (::sysctl (mib, ARRAY_SIZE (mib), args.get (), &size, NULL, 0) == -1
|
||||
|| size == 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -99,76 +94,12 @@ nbsd_pid_to_cmdline (int pid)
|
||||
return args;
|
||||
}
|
||||
|
||||
-/* Generic thread (LWP) lister within a specified process. The callback
|
||||
- parameters is a C++ function that is called for each detected thread. */
|
||||
-
|
||||
-static bool
|
||||
-nbsd_thread_lister (const pid_t pid,
|
||||
- gdb::function_view<bool (const struct kinfo_lwp *)>
|
||||
- callback)
|
||||
-{
|
||||
- int mib[5] = {CTL_KERN, KERN_LWP, pid, sizeof (struct kinfo_lwp), 0};
|
||||
- size_t size;
|
||||
-
|
||||
- if (sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
|
||||
- perror_with_name (("sysctl"));
|
||||
-
|
||||
- mib[4] = size / sizeof (size_t);
|
||||
-
|
||||
- gdb::unique_xmalloc_ptr<struct kinfo_lwp[]> kl
|
||||
- ((struct kinfo_lwp *) xcalloc (size, 1));
|
||||
-
|
||||
- if (sysctl (mib, ARRAY_SIZE (mib), kl.get (), &size, NULL, 0) == -1
|
||||
- || size == 0)
|
||||
- perror_with_name (("sysctl"));
|
||||
-
|
||||
- for (size_t i = 0; i < size / sizeof (struct kinfo_lwp); i++)
|
||||
- {
|
||||
- struct kinfo_lwp *l = &kl[i];
|
||||
-
|
||||
- /* Return true if the specified thread is alive. */
|
||||
- auto lwp_alive
|
||||
- = [] (struct kinfo_lwp *lwp)
|
||||
- {
|
||||
- switch (lwp->l_stat)
|
||||
- {
|
||||
- case LSSLEEP:
|
||||
- case LSRUN:
|
||||
- case LSONPROC:
|
||||
- case LSSTOP:
|
||||
- case LSSUSPENDED:
|
||||
- return true;
|
||||
- default:
|
||||
- return false;
|
||||
- }
|
||||
- };
|
||||
-
|
||||
- /* Ignore embryonic or demised threads. */
|
||||
- if (!lwp_alive (l))
|
||||
- continue;
|
||||
-
|
||||
- if (callback (l))
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
/* Return true if PTID is still active in the inferior. */
|
||||
|
||||
bool
|
||||
nbsd_nat_target::thread_alive (ptid_t ptid)
|
||||
{
|
||||
- pid_t pid = ptid.pid ();
|
||||
- int lwp = ptid.lwp ();
|
||||
-
|
||||
- auto fn
|
||||
- = [&lwp] (const struct kinfo_lwp *kl)
|
||||
- {
|
||||
- return kl->l_lid == lwp;
|
||||
- };
|
||||
-
|
||||
- return nbsd_thread_lister (pid, fn);
|
||||
+ return netbsd_nat::thread_alive (ptid);
|
||||
}
|
||||
|
||||
/* Return the name assigned to a thread by an application. Returns
|
||||
@@ -178,26 +109,7 @@ const char *
|
||||
nbsd_nat_target::thread_name (struct thread_info *thr)
|
||||
{
|
||||
ptid_t ptid = thr->ptid;
|
||||
- pid_t pid = ptid.pid ();
|
||||
- int lwp = ptid.lwp ();
|
||||
-
|
||||
- static char buf[KI_LNAMELEN] = {};
|
||||
-
|
||||
- auto fn
|
||||
- = [&lwp] (const struct kinfo_lwp *kl)
|
||||
- {
|
||||
- if (kl->l_lid == lwp)
|
||||
- {
|
||||
- xsnprintf (buf, sizeof buf, "%s", kl->l_name);
|
||||
- return true;
|
||||
- }
|
||||
- return false;
|
||||
- };
|
||||
-
|
||||
- if (nbsd_thread_lister (pid, fn))
|
||||
- return buf;
|
||||
- else
|
||||
- return NULL;
|
||||
+ return netbsd_nat::thread_name (ptid);
|
||||
}
|
||||
|
||||
/* Implement the "post_attach" target_ops method. */
|
||||
@@ -206,9 +118,8 @@ static void
|
||||
nbsd_add_threads (nbsd_nat_target *target, pid_t pid)
|
||||
{
|
||||
auto fn
|
||||
- = [&target, &pid] (const struct kinfo_lwp *kl)
|
||||
+ = [&target] (ptid_t ptid)
|
||||
{
|
||||
- ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
|
||||
if (!in_thread_list (target, ptid))
|
||||
{
|
||||
if (inferior_ptid.lwp () == 0)
|
||||
@@ -216,27 +127,9 @@ nbsd_add_threads (nbsd_nat_target *targe
|
||||
else
|
||||
add_thread (target, ptid);
|
||||
}
|
||||
- return false;
|
||||
};
|
||||
|
||||
- nbsd_thread_lister (pid, fn);
|
||||
-}
|
||||
-
|
||||
-/* Enable additional event reporting on new processes. */
|
||||
-
|
||||
-static void
|
||||
-nbsd_enable_proc_events (pid_t pid)
|
||||
-{
|
||||
- int events;
|
||||
-
|
||||
- if (ptrace (PT_GET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
- perror_with_name (("ptrace"));
|
||||
-
|
||||
- events |= PTRACE_LWP_CREATE;
|
||||
- events |= PTRACE_LWP_EXIT;
|
||||
-
|
||||
- if (ptrace (PT_SET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
|
||||
- perror_with_name (("ptrace"));
|
||||
+ netbsd_nat::list_threads (pid, fn);
|
||||
}
|
||||
|
||||
/* Implement the "post_startup_inferior" target_ops method. */
|
||||
@@ -244,7 +137,7 @@ nbsd_enable_proc_events (pid_t pid)
|
||||
void
|
||||
nbsd_nat_target::post_startup_inferior (ptid_t ptid)
|
||||
{
|
||||
- nbsd_enable_proc_events (ptid.pid ());
|
||||
+ netbsd_nat::enable_proc_events (ptid.pid ());
|
||||
}
|
||||
|
||||
/* Implement the "post_attach" target_ops method. */
|
||||
@@ -252,7 +145,7 @@ nbsd_nat_target::post_startup_inferior (
|
||||
void
|
||||
nbsd_nat_target::post_attach (int pid)
|
||||
{
|
||||
- nbsd_enable_proc_events (pid);
|
||||
+ netbsd_nat::enable_proc_events (pid);
|
||||
nbsd_add_threads (this, pid);
|
||||
}
|
||||
|
||||
@@ -861,26 +754,12 @@ nbsd_nat_target::xfer_partial (enum targ
|
||||
{
|
||||
case TARGET_OBJECT_SIGNAL_INFO:
|
||||
{
|
||||
- ptrace_siginfo_t psi;
|
||||
-
|
||||
- if (offset > sizeof (siginfo_t))
|
||||
- return TARGET_XFER_E_IO;
|
||||
+ len = netbsd_nat::qxfer_siginfo(pid, annex, readbuf, writebuf, offset,
|
||||
+ len);
|
||||
|
||||
- if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
|
||||
+ if (len == -1)
|
||||
return TARGET_XFER_E_IO;
|
||||
|
||||
- if (offset + len > sizeof (siginfo_t))
|
||||
- len = sizeof (siginfo_t) - offset;
|
||||
-
|
||||
- if (readbuf != NULL)
|
||||
- memcpy (readbuf, ((gdb_byte *) &psi.psi_siginfo) + offset, len);
|
||||
- else
|
||||
- {
|
||||
- memcpy (((gdb_byte *) &psi.psi_siginfo) + offset, writebuf, len);
|
||||
-
|
||||
- if (ptrace (PT_SET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
|
||||
- return TARGET_XFER_E_IO;
|
||||
- }
|
||||
*xfered_len = len;
|
||||
return TARGET_XFER_OK;
|
||||
}
|
|
@ -2,13 +2,14 @@ $NetBSD$
|
|||
|
||||
--- gdbserver/configure.srv.orig 2020-08-26 18:57:35.000000000 +0000
|
||||
+++ gdbserver/configure.srv
|
||||
@@ -349,6 +349,12 @@ case "${gdbserver_host}" in
|
||||
@@ -349,6 +349,13 @@ case "${gdbserver_host}" in
|
||||
srv_tgtobj="${srv_tgtobj} nat/windows-nat.o"
|
||||
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="${srv_tgtobj} nat/fork-inferior.o"
|
||||
+ srv_tgtobj="${srv_tgtobj} nat/netbsd-nat.o"
|
||||
+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
|
||||
+ srv_netbsd=yes
|
||||
+ ;;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdbserver/netbsd-low.h.orig 2020-08-27 02:43:00.927090317 +0000
|
||||
--- gdbserver/netbsd-low.h.orig 2020-09-02 16:10:13.482596165 +0000
|
||||
+++ gdbserver/netbsd-low.h
|
||||
@@ -0,0 +1,153 @@
|
||||
@@ -0,0 +1,157 @@
|
||||
+/* Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
|
@ -67,6 +67,8 @@ $NetBSD$
|
|||
+ int create_inferior (const char *program,
|
||||
+ const std::vector<char *> &program_args) override;
|
||||
+
|
||||
+ void post_create_inferior () override;
|
||||
+
|
||||
+ int attach (unsigned long pid) override;
|
||||
+
|
||||
+ int kill (process_info *proc) override;
|
||||
|
@ -97,7 +99,7 @@ $NetBSD$
|
|||
+ void request_interrupt () override;
|
||||
+
|
||||
+ bool supports_read_auxv () override;
|
||||
+
|
||||
+
|
||||
+ int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
|
||||
+ unsigned int len) override;
|
||||
+
|
||||
|
@ -115,6 +117,8 @@ $NetBSD$
|
|||
+
|
||||
+ bool stopped_by_sw_breakpoint () override;
|
||||
+
|
||||
+ bool supports_qxfer_siginfo () override;
|
||||
+
|
||||
+ int qxfer_siginfo (const char *annex, unsigned char *readbuf,
|
||||
+ unsigned const char *writebuf, CORE_ADDR offset,
|
||||
+ int len) override;
|
||||
|
@ -134,12 +138,12 @@ $NetBSD$
|
|||
+ bool supports_disable_randomization () override;
|
||||
+
|
||||
+ bool supports_qxfer_libraries_svr4 () override;
|
||||
+
|
||||
+
|
||||
+ int qxfer_libraries_svr4 (const char*, unsigned char*, const unsigned char*,
|
||||
+ CORE_ADDR, int) override;
|
||||
+
|
||||
+ bool supports_pid_to_exec_file () override;
|
||||
+
|
||||
+
|
||||
+ char *pid_to_exec_file (int pid) override;
|
||||
+
|
||||
+ const char *thread_name (ptid_t thread) override;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdbserver/netbsd-x86_64-low.cc.orig 2020-08-27 02:43:00.927238751 +0000
|
||||
--- gdbserver/netbsd-x86_64-low.cc.orig 2020-09-02 16:10:13.482761789 +0000
|
||||
+++ gdbserver/netbsd-x86_64-low.cc
|
||||
@@ -0,0 +1,250 @@
|
||||
+/* Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gdbsupport/eintr.h.orig 2020-09-02 16:10:13.482874765 +0000
|
||||
+++ gdbsupport/eintr.h
|
||||
@@ -0,0 +1,41 @@
|
||||
+/* Utility for handling interrupted syscalls by signals.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+#ifndef GDBSUPPORT_EINTR_H
|
||||
+#define GDBSUPPORT_EINTR_H
|
||||
+
|
||||
+#include <cerrno>
|
||||
+
|
||||
+namespace gdb
|
||||
+{
|
||||
+template <typename Fun, typename... Args>
|
||||
+inline decltype (auto) handle_eintr (const Fun &F, const Args &... A)
|
||||
+{
|
||||
+ decltype (F (A...)) ret;
|
||||
+ do
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ ret = F (A...);
|
||||
+ }
|
||||
+ while (ret == -1 && errno == EINTR);
|
||||
+ return ret;
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif /* GDBSUPPORT_EINTR_H */
|
Loading…
Reference in New Issue