pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
gdb-netbsd-wip: Add patches
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Apr 1 22:08:51 2020 +0200
Changeset: 12e066edfa6c9737fa0416cbf0e5d8463262766d
Added Files:
gdb-netbsd-wip/patches/patch-gdb_ChangeLog
gdb-netbsd-wip/patches/patch-gdb_alpha-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_amd64-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_arm-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_hppa-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_i386-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_mips-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.c
gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.h
gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.h
gdb-netbsd-wip/patches/patch-gdb_ppc-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_sh-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_sparc-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_sparc64-nbsd-tdep.c
gdb-netbsd-wip/patches/patch-gdb_thread.c
gdb-netbsd-wip/patches/patch-gdb_vax-nbsd-tdep.c
Log Message:
gdb-netbsd-wip: Add patches
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=12e066edfa6c9737fa0416cbf0e5d8463262766d
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
gdb-netbsd-wip/patches/patch-gdb_ChangeLog | 48 ++
gdb-netbsd-wip/patches/patch-gdb_alpha-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_amd64-nbsd-tdep.c | 12 +
gdb-netbsd-wip/patches/patch-gdb_arm-nbsd-tdep.c | 14 +
gdb-netbsd-wip/patches/patch-gdb_hppa-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_i386-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_mips-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.c | 639 +++++++++++++++++++++
gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.h | 42 ++
gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.c | 330 +++++++++++
gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.h | 13 +
gdb-netbsd-wip/patches/patch-gdb_ppc-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_sh-nbsd-tdep.c | 12 +
gdb-netbsd-wip/patches/patch-gdb_sparc-nbsd-tdep.c | 13 +
.../patches/patch-gdb_sparc64-nbsd-tdep.c | 13 +
gdb-netbsd-wip/patches/patch-gdb_thread.c | 12 +
gdb-netbsd-wip/patches/patch-gdb_vax-nbsd-tdep.c | 13 +
17 files changed, 1226 insertions(+)
diffs:
diff --git a/gdb-netbsd-wip/patches/patch-gdb_ChangeLog b/gdb-netbsd-wip/patches/patch-gdb_ChangeLog
new file mode 100644
index 0000000000..2f1747c6bf
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_ChangeLog
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- gdb/ChangeLog.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/ChangeLog
+@@ -1,3 +1,20 @@
++2020-03-25 Kamil Rytarowski <n54%gmx.com@localhost>
++
++ * nbsd-nat.h (struct thread_info): Add forward declaration.
++ (nbsd_nat_target::thread_alive): Add.
++ (nbsd_nat_target::thread_name): Likewise.
++ (nbsd_nat_target::update_thread_list): Likewise.
++ (update_thread_list::post_attach): Likewise.
++ (post_attach::pid_to_str): Likewise.
++ * nbsd-nat.c: Include "gdbthread.h" and "inferior.h".
++ (nbsd_thread_lister): Add.
++ (nbsd_nat_target::thread_alive): Likewise.
++ (nbsd_nat_target::thread_name): Likewise.
++ (nbsd_add_threads): Likewise.
++ (update_thread_list::post_attach): Likewise.
++ (nbsd_nat_target::update_thread_list): Likewise.
++ (post_attach::pid_to_str): Likewise.
++
+ 2020-03-25 Tom Tromey <tom%tromey.com@localhost>
+
+ * compile/compile-object-load.c (get_out_value_type): Mention
+@@ -60,6 +77,22 @@
+
+ 2020-03-20 Kamil Rytarowski <n54%gmx.com@localhost>
+
++ * nbsd-tdep.c: Include "gdbarch.h".
++ * nbsd-tdep.c (nbsd_auxv_parse, nbsd_init_abi): New.
++ * alpha-nbsd-tdep.c (alphanbsd_init_abi): Call nbsd_init_abi().
++ * amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
++ * arm-nbsd-tdep.c (arm_netbsd_elf_init_abi): Likewise.
++ * hppa-nbsd-tdep.c (hppanbsd_init_abi): Likewise.
++ * i386-nbsd-tdep.c (i386nbsd_init_abi): Likewise.
++ * mips-nbsd-tdep.c (nbsd_init_abi): Likewise.
++ * ppc-nbsd-tdep.c (ppcnbsd_init_abi): Likewise.
++ * sh-nbsd-tdep.c (shnbsd_init_abi): Likewise.
++ * sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Likewise.
++ * sparc64-nbsd-tdep.c (sparc64nbsd_init_abi): Likewise.
++ * vax-nbsd-tdep.c (vaxnbsd_elf_init_abi): Likewise.
++
++2020-03-20 Kamil Rytarowski <n54%gmx.com@localhost>
++
+ * amd64-bsd-nat.c (gdb_ptrace): Change return type from `int' to
+ `PTRACE_TYPE_RET'.
+ * i386-bsd-nat.c (gdb_ptrace): Likewise.
diff --git a/gdb-netbsd-wip/patches/patch-gdb_alpha-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_alpha-nbsd-tdep.c
new file mode 100644
index 0000000000..2d3cc3a4ea
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_alpha-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/alpha-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/alpha-nbsd-tdep.c
+@@ -258,6 +258,8 @@ alphanbsd_init_abi (struct gdbarch_info
+ /* Hook into the MDEBUG frame unwinder. */
+ alpha_mdebug_init_abi (info, gdbarch);
+
++ nbsd_init_abi (info, gdbarch);
++
+ /* NetBSD/alpha does not provide single step support via ptrace(2); we
+ must use software single-stepping. */
+ set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
diff --git a/gdb-netbsd-wip/patches/patch-gdb_amd64-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_amd64-nbsd-tdep.c
new file mode 100644
index 0000000000..2b65ac5841
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_amd64-nbsd-tdep.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- gdb/amd64-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/amd64-nbsd-tdep.c
+@@ -106,6 +106,7 @@ amd64nbsd_init_abi (struct gdbarch_info
+
+ amd64_init_abi (info, gdbarch,
+ amd64_target_description (X86_XSTATE_SSE_MASK, true));
++ nbsd_init_abi (info, gdbarch);
+
+ tdep->jb_pc_offset = 7 * 8;
+
diff --git a/gdb-netbsd-wip/patches/patch-gdb_arm-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_arm-nbsd-tdep.c
new file mode 100644
index 0000000000..b596e267c7
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_arm-nbsd-tdep.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- gdb/arm-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/arm-nbsd-tdep.c
+@@ -150,6 +150,9 @@ arm_netbsd_elf_init_abi (struct gdbarch_
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ arm_netbsd_init_abi_common (info, gdbarch);
++
++ nbsd_init_abi (info, gdbarch);
++
+ if (tdep->fp_model == ARM_FLOAT_AUTO)
+ tdep->fp_model = ARM_FLOAT_SOFT_VFP;
+
diff --git a/gdb-netbsd-wip/patches/patch-gdb_hppa-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_hppa-nbsd-tdep.c
new file mode 100644
index 0000000000..bbe463f51a
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_hppa-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/hppa-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/hppa-nbsd-tdep.c
+@@ -201,6 +201,8 @@ hppanbsd_init_abi (struct gdbarch_info i
+ /* Obviously NetBSD is BSD-based. */
+ hppabsd_init_abi (info, gdbarch);
+
++ nbsd_init_abi (info, gdbarch);
++
+ /* Core file support. */
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, hppanbsd_iterate_over_regset_sections);
diff --git a/gdb-netbsd-wip/patches/patch-gdb_i386-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_i386-nbsd-tdep.c
new file mode 100644
index 0000000000..3686176140
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_i386-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/i386-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/i386-nbsd-tdep.c
+@@ -377,6 +377,8 @@ i386nbsd_init_abi (struct gdbarch_info i
+ /* Obviously NetBSD is BSD-based. */
+ i386bsd_init_abi (info, gdbarch);
+
++ nbsd_init_abi (info, gdbarch);
++
+ /* NetBSD has a different `struct reg'. */
+ tdep->gregset_reg_offset = i386nbsd_r_reg_offset;
+ tdep->gregset_num_regs = ARRAY_SIZE (i386nbsd_r_reg_offset);
diff --git a/gdb-netbsd-wip/patches/patch-gdb_mips-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_mips-nbsd-tdep.c
new file mode 100644
index 0000000000..ecc63cb332
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_mips-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/mips-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/mips-nbsd-tdep.c
+@@ -354,6 +354,8 @@ static void
+ mipsnbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+ {
++ nbsd_init_abi (info, gdbarch)
++
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, mipsnbsd_iterate_over_regset_sections);
+
diff --git a/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.c b/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.c
new file mode 100644
index 0000000000..4ac3c26a11
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.c
@@ -0,0 +1,639 @@
+$NetBSD$
+
+--- gdb/nbsd-nat.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/nbsd-nat.c
+@@ -20,10 +20,17 @@
+ #include "defs.h"
+
+ #include "nbsd-nat.h"
++#include "gdbarch.h"
++#include "gdbthread.h"
++#include "inferior.h"
++#include "regcache.h"
+
+ #include <sys/types.h>
+ #include <sys/ptrace.h>
+ #include <sys/sysctl.h>
++#include <sys/wait.h>
++
++#include <forward_list>
+
+ /* Return the name of a file that can be opened to get the symbols for
+ the child process identified by PID. */
+@@ -39,3 +46,616 @@ nbsd_nat_target::pid_to_exec_file (int p
+ 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 void
++nbsd_thread_lister (const pid_t pid,
++ std::function<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 (kl == NULL)
++ perror_with_name (("calloc"));
++
++ 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.get ()[i];
++
++ /* Return true if the specified thread is alive. */
++ auto lwp_alive =
++ [&l]()
++ {
++ switch (l->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 ())
++ continue;
++
++ if (callback (l))
++ break;
++ }
++}
++
++/* 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 ();
++ bool found = false;
++
++ fprintf_unfiltered (gdb_stderr, "THREAD ALIVE: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
++
++ auto fn =
++ [&lwp, &found] (const struct kinfo_lwp *kl)
++ {
++ if (kl->l_lid == lwp)
++ {
++ found = true;
++ return true;
++ }
++ return false;
++ };
++
++ nbsd_thread_lister (pid, fn);
++
++ return found;
++}
++
++/* Return the name assigned to a thread by an application. Returns
++ the string in a static buffer. */
++
++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 ();
++
++ fprintf_unfiltered (gdb_stderr, "THREAD NAME: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
++
++ 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;
++ };
++
++ nbsd_thread_lister (pid, fn);
++
++ return buf;
++}
++
++/* Implement the "post_attach" target_ops method. */
++
++static void
++nbsd_add_threads (nbsd_nat_target *target, pid_t pid)
++{
++ fprintf_unfiltered (gdb_stderr, "%s() %s:%d NBSD_ADD_THREADS JESTEM TU !!!!!!!!!!!!!\n", __func__, __FILE__, __LINE__);
++
++ auto fn =
++ [&target, &pid] (const struct kinfo_lwp *kl)
++ {
++ ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
++ if (!in_thread_list (target, ptid))
++ {
++ if (inferior_ptid.lwp () == 0)
++ thread_change_ptid (target, inferior_ptid, ptid);
++ else
++ add_thread (target, ptid);
++ }
++ return false;
++ };
++
++
++ nbsd_thread_lister (pid, fn);
++
++ fprintf_unfiltered (gdb_stderr, "%s() %s:%d NBSD_ADD_THREADS JESTEM TU !!!!!!!!!!!!!\n", __func__, __FILE__, __LINE__);
++}
++
++/* Enable additional event reporting on new processes. */
++
++static void
++nbsd_enable_proc_events (pid_t pid)
++{
++ int events;
++
++ fprintf_unfiltered (gdb_stderr, "ENABLE PROC EVENTS: (pid=%d)\n", pid);
++
++ if (ptrace (PT_GET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
++ perror_with_name (("ptrace"));
++
++ events |= PTRACE_FORK;
++ events |= PTRACE_VFORK;
++ events |= PTRACE_VFORK_DONE;
++ events |= PTRACE_LWP_CREATE;
++ events |= PTRACE_LWP_EXIT;
++
++ if (ptrace (PT_SET_EVENT_MASK, pid, &events, sizeof (events)) == -1)
++ perror_with_name (("ptrace"));
++}
++
++/* Implement the "post_attach" target_ops method. */
++
++void
++nbsd_nat_target::post_attach (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "POST ATTACH: (pid=%d)\n", pid);
++
++ nbsd_enable_proc_events (pid);
++ nbsd_add_threads (this, pid);
++}
++
++/* Implement the "update_thread_list" target_ops method. */
++
++void
++nbsd_nat_target::update_thread_list ()
++{
++ fprintf_unfiltered (gdb_stderr, "UPDATE THREAD LIST\n");
++
++ prune_threads ();
++
++ nbsd_add_threads (this, inferior_ptid.pid ());
++}
++
++/* Convert PTID to a string. */
++
++std::string
++nbsd_nat_target::pid_to_str (ptid_t ptid)
++{
++ int lwp = ptid.lwp ();
++
++ fprintf_unfiltered (gdb_stderr, "PID TO STR: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
++
++ if (lwp != 0)
++ {
++ pid_t pid = ptid.pid ();
++
++ return string_printf ("LWP %d of process %d", lwp, pid);
++ }
++
++ return normal_pid_to_str (ptid);
++}
++
++static std::list<ptid_t> nbsd_pending_children;
++
++/* Record a new child process event that is reported before the
++ corresponding fork event in the parent. */
++
++static void
++nbsd_remember_child (ptid_t pid)
++{
++ nbsd_pending_children.push_front (pid);
++}
++
++/* Check for a previously-recorded new child process event for PID.
++ If one is found, remove it from the list and return the PTID. */
++
++static ptid_t
++nbsd_is_child_pending (pid_t pid)
++{
++ for (auto it = nbsd_pending_children.begin ();
++ it != nbsd_pending_children.end (); it++)
++ if (it->pid () == pid)
++ {
++ ptid_t ptid = *it;
++ nbsd_pending_children.erase (it);
++ return ptid;
++ }
++ return null_ptid;
++}
++
++/* Wait for the child specified by PTID to do something. Return the
++ process ID of the child, or MINUS_ONE_PTID in case of error; store
++ the status in *OURSTATUS. */
++
++ptid_t
++nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
++ int target_options)
++{
++ ptid_t wptid;
++
++ while (true)
++ {
++ wptid = inf_ptrace_target::wait (ptid, ourstatus, target_options);
++
++ if (ourstatus->kind != TARGET_WAITKIND_STOPPED)
++ return wptid;
++
++ pid_t pid = wptid. pid();
++
++ /* Extract the event and thread that received a signal. */
++ ptrace_siginfo_t psi;
++ if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
++ perror_with_name (("ptrace"));
++
++ /* Pick child's siginfo_t. */
++ siginfo_t *si = &psi.psi_siginfo;
++
++ int lwp = psi.psi_lwpid;
++
++ /* Construct PTID. */
++ wptid = ptid_t (pid, lwp, 0);
++
++ int signo = si->si_signo;
++ int code = si->si_code;
++
++ /* Stop examining here uninteresting events. */
++ if (signo != SIGTRAP || code <= SI_USER || code == SI_NOINFO)
++ return wptid;
++
++ ptrace_state_t pst;
++ if (ptrace (PT_GET_PROCESS_STATE, pid, &pst, sizeof (pst)) == -1)
++ perror_with_name (("ptrace"));
++
++ int event = pst.pe_report_event;
++
++ if (code == TRAP_LWP && event == PTRACE_LWP_EXIT)
++ {
++ /* If GDB attaches to a multi-threaded process, exiting
++ threads might be skipped during post_attach that
++ have not yet reported their PL_FLAG_EXITED event.
++ Ignore EXITED events for an unknown LWP. */
++ thread_info *thr = find_thread_ptid (this, wptid);
++ if (thr != nullptr)
++ {
++ delete_thread (thr);
++ }
++ if (ptrace (PT_CONTINUE, pid, (void *) 1, 0) == -1)
++ perror_with_name (("ptrace"));
++ continue;
++ }
++
++ /* Switch to an LWP PTID on the first stop in a new process.
++ This is done after handling PL_FLAG_EXITED to avoid
++ switching to an exited LWP. It is done before checking
++ PL_FLAG_BORN in case the first stop reported after
++ attaching to an existing process is a PL_FLAG_BORN
++ event. */
++
++ bool newborn_process = !in_thread_list (this, ptid_t (pid));
++
++ if (!newborn_process)
++ {
++ thread_change_ptid (this, ptid_t (pid), wptid);
++ }
++
++ if (code == TRAP_LWP && event == PTRACE_LWP_CREATE)
++ {
++ /* If GDB attaches to a multi-threaded process, newborn
++ threads might be added by fbsd_add_threads that have
++ not yet reported their PL_FLAG_BORN event. Ignore
++ BORN events for an already-known LWP. */
++ if (!in_thread_list (this, wptid))
++ {
++ add_thread (this, wptid);
++ }
++ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
++ return wptid;
++ }
++
++ if (code == TRAP_CHLD && (event == PTRACE_FORK || event == PTRACE_VFORK))
++ {
++ if (newborn_process)
++ {
++ nbsd_remember_child (wptid);
++ continue;
++ }
++
++ bool forked = event == PTRACE_FORK;
++ ourstatus->kind =
++ forked ? TARGET_WAITKIND_FORKED : TARGET_WAITKIND_VFORKED;
++
++ pid_t child = pst.pe_other_pid;
++ ptid_t child_ptid = nbsd_is_child_pending (child);
++ if (child_ptid == null_ptid)
++ {
++ int status;
++ pid = waitpid (child, &status, 0);
++ if (pid == -1)
++ perror_with_name (("waitpid"));
++
++ gdb_assert (pid == child);
++
++ if (!WIFSTOPPED (status))
++ {
++ /* Abnormal situation (process killed?)... bail out. */
++ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
++ return wptid;
++ }
++
++ if (ptrace (PT_GET_SIGINFO, child, &psi, sizeof psi) == -1)
++ perror_with_name (("ptrace"));
++
++ gdb_assert (psi.psi_siginfo.si_signo == SIGTRAP);
++ gdb_assert (psi.psi_siginfo.si_code == TRAP_CHLD);
++
++ child_ptid = ptid_t (child, psi.psi_lwpid, 0);
++ }
++
++ /* Enable additional events on the child process. */
++ nbsd_enable_proc_events (child);
++
++ ourstatus->value.related_pid = child_ptid;
++
++ return wptid;
++ }
++
++ if (code == TRAP_CHLD && event == PTRACE_VFORK_DONE)
++ {
++ ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
++ return wptid;
++ }
++
++ if (code == TRAP_EXEC)
++ {
++ ourstatus->kind = TARGET_WAITKIND_EXECD;
++ ourstatus->value.execd_pathname = xstrdup (pid_to_exec_file (pid));
++ return wptid;
++ }
++
++ if (code == TRAP_TRACE || code == TRAP_DBREG)
++ {
++ /* Unhandled at this level. */
++ return wptid;
++ }
++
++ if (code == TRAP_SCE || code == TRAP_SCX)
++ {
++ int sysnum = si->si_sysnum;
++
++ if (!catch_syscall_enabled () || !catching_syscall_number (sysnum))
++ {
++ /* If the core isn't interested in this event, just
++ continue the process explicitly and wait for another
++ event. */
++ if (ptrace (PT_CONTINUE, pid, (void *) 1, 0) == -1)
++ perror_with_name (("ptrace"));
++ continue;
++ }
++
++ ourstatus->kind =
++ (code == TRAP_SCE) ? TARGET_WAITKIND_SYSCALL_ENTRY :
++ TARGET_WAITKIND_SYSCALL_RETURN;
++ ourstatus->value.syscall_number = sysnum;
++ return wptid;
++ }
++
++ if (code == TRAP_BRKPT)
++ {
++#if 0
++ struct regcache *regcache = get_thread_regcache (this, ptid);
++ struct gdbarch *gdbarch = regcache->arch ();
++ int decr_pc = gdbarch_decr_pc_after_break (gdbarch);
++
++ if (decr_pc != 0)
++ {
++ CORE_ADDR pc;
++
++ pc = regcache_read_pc (regcache);
++ regcache_write_pc (regcache, pc - decr_pc);
++ }
++#endif
++ return wptid;
++ }
++
++ return wptid;
++ }
++
++ __unreachable();
++}
++
++/* Implement the "post_startup_inferior" target_ops method. */
++
++void
++nbsd_nat_target::post_startup_inferior (ptid_t ptid)
++{
++ fprintf_unfiltered (gdb_stderr, "POST STARTUP INFERIOR: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
++
++ nbsd_enable_proc_events (ptid.pid ());
++}
++
++/* Target hook for follow_fork. On entry and at return inferior_ptid is
++ the ptid of the followed inferior. */
++
++bool
++nbsd_nat_target::follow_fork (bool follow_child, bool detach_fork)
++{
++ fprintf_unfiltered (gdb_stderr, "FOLLOW FORK\n");
++
++ if (!follow_child && detach_fork)
++ {
++ struct thread_info *tp = inferior_thread ();
++ pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
++
++ /* Breakpoints have already been detached from the child by
++ infrun.c. */
++
++ if (ptrace (PT_DETACH, child_pid, (void *)1, 0) == -1)
++ perror_with_name (("ptrace"));
++ }
++
++ return 0;
++}
++
++/* Implement the "insert_fork_catchpoint" target_ops method. */
++
++int
++nbsd_nat_target::insert_fork_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "INSERT FORK CATCHPOINT: (pid=%d)\n", pid);
++
++ return 0;
++}
++
++/* Implement the "remove_fork_catchpoint" target_ops method. */
++
++int
++nbsd_nat_target::remove_fork_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "REMOVE FORK CATCHPOINT: (pid=%d)\n", pid);
++ return 0;
++}
++
++/* Implement the "insert_vfork_catchpoint" target_ops method. */
++
++int
++nbsd_nat_target::insert_vfork_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "INSERT VFORK CATCHPOINT: (pid=%d)\n", pid);
++ return 0;
++}
++
++/* Implement the "remove_vfork_catchpoint" target_ops method. */
++
++int
++nbsd_nat_target::remove_vfork_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "REMOVE VFORK CATCHPOINT: (pid=%d)\n", pid);
++ return 0;
++}
++
++/* Implement the "insert_exec_catchpoint" target_ops method. */
++
++int
++nbsd_nat_target::insert_exec_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "INSERT EXEC CATCHPOINT: (pid=%d)\n", pid);
++ return 0;
++}
++
++/* Implement the "" target_ops method. */
++
++int
++nbsd_nat_target::remove_exec_catchpoint (int pid)
++{
++ fprintf_unfiltered (gdb_stderr, "REMOVE EXEC CATCHPOINT: (pid=%d)\n", pid);
++ return 0;
++}
++
++/* Implement the "" target_ops method. */
++
++int
++nbsd_nat_target::set_syscall_catchpoint (int pid, bool needed,
++ int any_count,
++ gdb::array_view<const int> syscall_counts)
++{
++ fprintf_unfiltered (gdb_stderr, "SET SYSCALL CATCHPOINT: (pid=%d)\n", pid);
++ /* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which
++ will catch all system call entries and exits. The system calls
++ are filtered by GDB rather than the kernel. */
++ return 0;
++}
++
++/* Implement the "stopped_by_sw_breakpoint" target_ops method. */
++#if 0
++bool
++nbsd_nat_target::stopped_by_sw_breakpoint ()
++{
++ pid_t pid = inferior_ptid.pid ();
++ ptrace_siginfo_t psi;
++
++ fprintf_unfiltered (gdb_stderr, "STOPPED BY SW BREAKPOINT\n");
++
++ if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
++ return false;
++
++ siginfo_t *si = &psi.psi_siginfo;
++ return si->si_signo == SIGTRAP && si->si_code == TRAP_BRKPT;
++}
++
++/* Implement the "supports_stopped_by_sw_breakpoint" target_ops method. */
++
++bool
++nbsd_nat_target::supports_stopped_by_sw_breakpoint ()
++{
++ fprintf_unfiltered (gdb_stderr, "SUPPORTS STOPPED BY SW BREAKPOINT\n");
++ return true;
++}
++#endif
++
++/* Implement the "resume" target_ops method. */
++
++void
++nbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
++{
++ fprintf_unfiltered (gdb_stderr, "RESUME: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
++
++ if (ptid.lwp_p ())
++ {
++ /* If ptid is a specific LWP, suspend all other LWPs in the process. */
++ inferior *inf = find_inferior_ptid (this, ptid);
++
++ for (thread_info *tp : inf->non_exited_threads ())
++ {
++ int request;
++
++ if (tp->ptid.lwp () == ptid.lwp ())
++ request = PT_RESUME;
++ else
++ request = PT_SUSPEND;
++
++ if (ptrace (request, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
++ perror_with_name (("ptrace"));
++ }
++ }
++ else
++ {
++ /* If ptid is a wildcard, resume all matching threads (they won't run
++ until the process is continued however). */
++ for (thread_info *tp : all_non_exited_threads (this, ptid))
++ if (ptrace (PT_RESUME, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
++ perror_with_name (("ptrace"));
++ ptid = inferior_ptid;
++ }
++
++ if (step)
++ {
++ for (thread_info *tp : all_non_exited_threads (this, ptid))
++ if (ptrace (PT_SETSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
++ perror_with_name (("ptrace"));
++ step = 0;
++ }
++ else
++ {
++ for (thread_info *tp : all_non_exited_threads (this, ptid))
++ if (ptrace (PT_CLEARSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
++ perror_with_name (("ptrace"));
++ }
++
++ ptid = ptid_t (ptid.pid ());
++
++ inf_ptrace_target::resume (ptid, step, signo);
++}
diff --git a/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.h b/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.h
new file mode 100644
index 0000000000..c2afa3d061
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_nbsd-nat.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+--- gdb/nbsd-nat.h.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/nbsd-nat.h
+@@ -22,11 +22,37 @@
+
+ #include "inf-ptrace.h"
+
++struct thread_info;
++
+ /* A prototype NetBSD target. */
+
+ struct nbsd_nat_target : public inf_ptrace_target
+ {
+ char *pid_to_exec_file (int pid) override;
++
++ bool thread_alive (ptid_t ptid) override;
++ const char *thread_name (struct thread_info *thr) override;
++ void post_attach (int pid) override;
++ void update_thread_list () override;
++ std::string pid_to_str (ptid_t ptid) override;
++ ptid_t wait (ptid_t ptid, struct target_waitstatus *ourstatus,
++ int target_options) override;
++ void post_startup_inferior (ptid_t ptid) override;
++ bool follow_fork (bool follow_child, bool detach_fork) override;
++ int insert_fork_catchpoint (int pid) override;
++ int remove_fork_catchpoint (int pid) override;
++ int insert_vfork_catchpoint (int pid) override;
++ int remove_vfork_catchpoint (int pid) override;
++ int insert_exec_catchpoint (int pid) override;
++ int remove_exec_catchpoint (int pid) override;
++ int set_syscall_catchpoint (int pid, bool needed, int any_count,
++ gdb::array_view<const int> syscall_counts)
++ override;
++#if 0
++ bool stopped_by_sw_breakpoint () override;
++ bool supports_stopped_by_sw_breakpoint () override;
++#endif
++ void resume (ptid_t ptid, int step, enum gdb_signal signo) override;
+ };
+
+ #endif /* nbsd-nat.h */
diff --git a/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.c
new file mode 100644
index 0000000000..6b6b33f445
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.c
@@ -0,0 +1,330 @@
+$NetBSD$
+
+--- gdb/nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/nbsd-tdep.c
+@@ -22,6 +22,282 @@
+ #include "defs.h"
+ #include "solib-svr4.h"
+ #include "nbsd-tdep.h"
++#include "gdbarch.h"
++
++enum
++ {
++ NBSD_SIGHUP = 1,
++ NBSD_SIGINT = 2,
++ NBSD_SIGQUIT = 3,
++ NBSD_SIGILL = 4,
++ NBSD_SIGTRAP = 5,
++ NBSD_SIGABRT = 6,
++ NBSD_SIGEMT = 7,
++ NBSD_SIGFPE = 8,
++ NBSD_SIGKILL = 9,
++ NBSD_SIGBUS = 10,
++ NBSD_SIGSEGV = 11,
++ NBSD_SIGSYS = 12,
++ NBSD_SIGPIPE = 13,
++ NBSD_SIGALRM = 14,
++ NBSD_SIGTERM = 15,
++ NBSD_SIGURG = 16,
++ NBSD_SIGSTOP = 17,
++ NBSD_SIGTSTP = 18,
++ NBSD_SIGCONT = 19,
++ NBSD_SIGCHLD = 20,
++ NBSD_SIGTTIN = 21,
++ NBSD_SIGTTOU = 22,
++ NBSD_SIGIO = 23,
++ NBSD_SIGXCPU = 24,
++ NBSD_SIGXFSZ = 25,
++ NBSD_SIGVTALRM = 26,
++ NBSD_SIGPROF = 27,
++ NBSD_SIGWINCH = 28,
++ NBSD_SIGINFO = 29,
++ NBSD_SIGUSR1 = 30,
++ NBSD_SIGUSR2 = 31,
++ NBSD_SIGPWR = 32,
++ NBSD_SIGRTMIN = 32,
++ NBSD_SIGRTMAX = 63,
++ };
++
++/* Implement the "gdb_signal_from_target" gdbarch method. */
++
++static enum gdb_signal
++nbsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
++{
++ switch (signal)
++ {
++ case 0:
++ return GDB_SIGNAL_0;
++
++ case NBSD_SIGHUP:
++ return GDB_SIGNAL_HUP;
++
++ case NBSD_SIGINT:
++ return GDB_SIGNAL_INT;
++
++ case NBSD_SIGQUIT:
++ return GDB_SIGNAL_QUIT;
++
++ case NBSD_SIGILL:
++ return GDB_SIGNAL_ILL;
++
++ case NBSD_SIGTRAP:
++ return GDB_SIGNAL_TRAP;
++
++ case NBSD_SIGABRT:
++ return GDB_SIGNAL_ABRT;
++
++ case NBSD_SIGEMT:
++ return GDB_SIGNAL_EMT;
++
++ case NBSD_SIGFPE:
++ return GDB_SIGNAL_FPE;
++
++ case NBSD_SIGKILL:
++ return GDB_SIGNAL_KILL;
++
++ case NBSD_SIGBUS:
++ return GDB_SIGNAL_BUS;
++
++ case NBSD_SIGSEGV:
++ return GDB_SIGNAL_SEGV;
++
++ case NBSD_SIGSYS:
++ return GDB_SIGNAL_SYS;
++
++ case NBSD_SIGPIPE:
++ return GDB_SIGNAL_PIPE;
++
++ case NBSD_SIGALRM:
++ return GDB_SIGNAL_ALRM;
++
++ case NBSD_SIGTERM:
++ return GDB_SIGNAL_TERM;
++
++ case NBSD_SIGURG:
++ return GDB_SIGNAL_URG;
++
++ case NBSD_SIGSTOP:
++ return GDB_SIGNAL_STOP;
++
++ case NBSD_SIGTSTP:
++ return GDB_SIGNAL_TSTP;
++
++ case NBSD_SIGCONT:
++ return GDB_SIGNAL_CONT;
++
++ case NBSD_SIGCHLD:
++ return GDB_SIGNAL_CHLD;
++
++ case NBSD_SIGTTIN:
++ return GDB_SIGNAL_TTIN;
++
++ case NBSD_SIGTTOU:
++ return GDB_SIGNAL_TTOU;
++
++ case NBSD_SIGIO:
++ return GDB_SIGNAL_IO;
++
++ case NBSD_SIGXCPU:
++ return GDB_SIGNAL_XCPU;
++
++ case NBSD_SIGXFSZ:
++ return GDB_SIGNAL_XFSZ;
++
++ case NBSD_SIGVTALRM:
++ return GDB_SIGNAL_VTALRM;
++
++ case NBSD_SIGPROF:
++ return GDB_SIGNAL_PROF;
++
++ case NBSD_SIGWINCH:
++ return GDB_SIGNAL_WINCH;
++
++ case NBSD_SIGINFO:
++ return GDB_SIGNAL_INFO;
++
++ case NBSD_SIGUSR1:
++ return GDB_SIGNAL_USR1;
++
++ case NBSD_SIGUSR2:
++ return GDB_SIGNAL_USR2;
++
++ /* SIGTHR is the same as SIGLWP on FreeBSD. */
++ case NBSD_SIGPWR:
++ return GDB_SIGNAL_PWR;
++ }
++
++ if (signal >= NBSD_SIGRTMIN && signal <= NBSD_SIGRTMAX)
++ {
++ int offset = signal - NBSD_SIGRTMIN;
++
++ return (enum gdb_signal) ((int) GDB_SIGNAL_REALTIME_65 + offset);
++ }
++
++ return GDB_SIGNAL_UNKNOWN;
++}
++
++/* Implement the "gdb_signal_to_target" gdbarch method. */
++
++static int
++nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
++ enum gdb_signal signal)
++{
++ switch (signal)
++ {
++ case GDB_SIGNAL_0:
++ return 0;
++
++ case GDB_SIGNAL_HUP:
++ return NBSD_SIGHUP;
++
++ case GDB_SIGNAL_INT:
++ return NBSD_SIGINT;
++
++ case GDB_SIGNAL_QUIT:
++ return NBSD_SIGQUIT;
++
++ case GDB_SIGNAL_ILL:
++ return NBSD_SIGILL;
++
++ case GDB_SIGNAL_TRAP:
++ return NBSD_SIGTRAP;
++
++ case GDB_SIGNAL_ABRT:
++ return NBSD_SIGABRT;
++
++ case GDB_SIGNAL_EMT:
++ return NBSD_SIGEMT;
++
++ case GDB_SIGNAL_FPE:
++ return NBSD_SIGFPE;
++
++ case GDB_SIGNAL_KILL:
++ return NBSD_SIGKILL;
++
++ case GDB_SIGNAL_BUS:
++ return NBSD_SIGBUS;
++
++ case GDB_SIGNAL_SEGV:
++ return NBSD_SIGSEGV;
++
++ case GDB_SIGNAL_SYS:
++ return NBSD_SIGSYS;
++
++ case GDB_SIGNAL_PIPE:
++ return NBSD_SIGPIPE;
++
++ case GDB_SIGNAL_ALRM:
++ return NBSD_SIGALRM;
++
++ case GDB_SIGNAL_TERM:
++ return NBSD_SIGTERM;
++
++ case GDB_SIGNAL_URG:
++ return NBSD_SIGURG;
++
++ case GDB_SIGNAL_STOP:
++ return NBSD_SIGSTOP;
++
++ case GDB_SIGNAL_TSTP:
++ return NBSD_SIGTSTP;
++
++ case GDB_SIGNAL_CONT:
++ return NBSD_SIGCONT;
++
++ case GDB_SIGNAL_CHLD:
++ return NBSD_SIGCHLD;
++
++ case GDB_SIGNAL_TTIN:
++ return NBSD_SIGTTIN;
++
++ case GDB_SIGNAL_TTOU:
++ return NBSD_SIGTTOU;
++
++ case GDB_SIGNAL_IO:
++ return NBSD_SIGIO;
++
++ case GDB_SIGNAL_XCPU:
++ return NBSD_SIGXCPU;
++
++ case GDB_SIGNAL_XFSZ:
++ return NBSD_SIGXFSZ;
++
++ case GDB_SIGNAL_VTALRM:
++ return NBSD_SIGVTALRM;
++
++ case GDB_SIGNAL_PROF:
++ return NBSD_SIGPROF;
++
++ case GDB_SIGNAL_WINCH:
++ return NBSD_SIGWINCH;
++
++ case GDB_SIGNAL_INFO:
++ return NBSD_SIGINFO;
++
++ case GDB_SIGNAL_USR1:
++ return NBSD_SIGUSR1;
++
++ case GDB_SIGNAL_USR2:
++ return NBSD_SIGUSR2;
++
++ case GDB_SIGNAL_PWR:
++ return NBSD_SIGPWR;
++ }
++
++ if (signal >= GDB_SIGNAL_REALTIME_65
++ && signal <= GDB_SIGNAL_REALTIME_126)
++ {
++ int offset = signal - GDB_SIGNAL_REALTIME_65;
++
++ return NBSD_SIGRTMIN + offset;
++ }
++
++ return -1;
++}
+
+ /* FIXME: kettenis/20060115: We should really eliminate the next two
+ functions completely. */
+@@ -47,3 +323,42 @@ nbsd_pc_in_sigtramp (CORE_ADDR pc, const
+ return (func_name != NULL
+ && startswith (func_name, "__sigtramp"));
+ }
++
++/* NetBSD-specific parser for AUXV data with. NetBSD follows the ELF
++ specification, contrary to some other ELF Operating Systems. */
++
++static int
++nbsd_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
++ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
++{
++ struct type *int_type = builtin_type (gdbarch)->builtin_int;
++ struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
++ const int sizeof_auxv_type = TYPE_LENGTH (int_type);
++ const int sizeof_auxv_val = TYPE_LENGTH (ptr_type);
++ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
++ gdb_byte *ptr = *readptr;
++
++ if (endptr == ptr)
++ return 0;
++
++ if (endptr - ptr < 2 * sizeof_auxv_val)
++ return -1;
++
++ *typep = extract_unsigned_integer (ptr, sizeof_auxv_type, byte_order);
++ ptr += sizeof_auxv_val; /* Alignment. */
++ *valp = extract_unsigned_integer (ptr, sizeof_auxv_val, byte_order);
++ ptr += sizeof_auxv_val;
++
++ *readptr = ptr;
++ return 1;
++}
++
++/* See nbsd-tdep.h. */
++
++void
++nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
++{
++ set_gdbarch_auxv_parse (gdbarch, nbsd_auxv_parse);
++ set_gdbarch_gdb_signal_from_target (gdbarch, nbsd_gdb_signal_from_target);
++ set_gdbarch_gdb_signal_to_target (gdbarch, nbsd_gdb_signal_to_target);
++}
diff --git a/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.h b/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.h
new file mode 100644
index 0000000000..4af0bfda76
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_nbsd-tdep.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/nbsd-tdep.h.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/nbsd-tdep.h
+@@ -25,4 +25,8 @@ struct link_map_offsets *nbsd_lp64_solib
+
+ int nbsd_pc_in_sigtramp (CORE_ADDR, const char *);
+
++/* NetBSD specific set of ABI-related routines. */
++
++void nbsd_init_abi (struct gdbarch_info, struct gdbarch *);
++
+ #endif /* NBSD_TDEP_H */
diff --git a/gdb-netbsd-wip/patches/patch-gdb_ppc-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_ppc-nbsd-tdep.c
new file mode 100644
index 0000000000..77d49c92e7
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_ppc-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/ppc-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/ppc-nbsd-tdep.c
+@@ -173,6 +173,8 @@ static void
+ ppcnbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+ {
++ nbsd_init_abi (info, gdbarch);
++
+ /* For NetBSD, this is an on again, off again thing. Some systems
+ do use the broken struct convention, and some don't. */
+ set_gdbarch_return_value (gdbarch, ppcnbsd_return_value);
diff --git a/gdb-netbsd-wip/patches/patch-gdb_sh-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_sh-nbsd-tdep.c
new file mode 100644
index 0000000000..88e0e43457
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_sh-nbsd-tdep.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- gdb/sh-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/sh-nbsd-tdep.c
+@@ -63,6 +63,7 @@ shnbsd_init_abi (struct gdbarch_info inf
+ struct gdbarch *gdbarch)
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ nbsd_init_abi (info, gdbarch);
+
+ tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
+ tdep->sizeof_gregset = 84;
diff --git a/gdb-netbsd-wip/patches/patch-gdb_sparc-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_sparc-nbsd-tdep.c
new file mode 100644
index 0000000000..48d403f0a3
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_sparc-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/sparc-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/sparc-nbsd-tdep.c
+@@ -296,6 +296,8 @@ sparc32nbsd_init_abi (struct gdbarch_inf
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
++ nbsd_init_abi (info, gdbarch);
++
+ /* NetBSD doesn't support the 128-bit `long double' from the psABI. */
+ set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
diff --git a/gdb-netbsd-wip/patches/patch-gdb_sparc64-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_sparc64-nbsd-tdep.c
new file mode 100644
index 0000000000..95f2da2236
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_sparc64-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/sparc64-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/sparc64-nbsd-tdep.c
+@@ -249,6 +249,8 @@ sparc64nbsd_init_abi (struct gdbarch_inf
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
++ nbsd_init_abi (info, gdbarch);
++
+ tdep->gregset = &sparc64nbsd_gregset;
+ tdep->sizeof_gregset = 160;
+
diff --git a/gdb-netbsd-wip/patches/patch-gdb_thread.c b/gdb-netbsd-wip/patches/patch-gdb_thread.c
new file mode 100644
index 0000000000..8f9495e3cf
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_thread.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- gdb/thread.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/thread.c
+@@ -325,6 +325,7 @@ add_thread_with_info (process_stratum_ta
+ struct thread_info *
+ add_thread (process_stratum_target *targ, ptid_t ptid)
+ {
++ fprintf_unfiltered (gdb_stderr, "ADD THREAD: (pid=%d, lwp=%ld, tid=%ld)\n", ptid.pid (), ptid.lwp (), ptid.tid ());
+ return add_thread_with_info (targ, ptid, NULL);
+ }
+
diff --git a/gdb-netbsd-wip/patches/patch-gdb_vax-nbsd-tdep.c b/gdb-netbsd-wip/patches/patch-gdb_vax-nbsd-tdep.c
new file mode 100644
index 0000000000..a8344ef014
--- /dev/null
+++ b/gdb-netbsd-wip/patches/patch-gdb_vax-nbsd-tdep.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gdb/vax-nbsd-tdep.c.orig 2020-03-25 17:24:08.000000000 +0000
++++ gdb/vax-nbsd-tdep.c
+@@ -29,6 +29,8 @@
+ static void
+ vaxnbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
++ nbsd_init_abi (info, gdbarch);
++
+ /* NetBSD ELF uses SVR4-style shared libraries. */
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, svr4_ilp32_fetch_link_map_offsets);
Home |
Main Index |
Thread Index |
Old Index