aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog22
-rw-r--r--gdb/gdbserver/fork-child.c3
-rw-r--r--gdb/gdbserver/inferiors.c2
-rw-r--r--gdb/gdbserver/linux-low.c2
-rw-r--r--gdb/gdbserver/lynx-low.c2
-rw-r--r--gdb/gdbserver/nto-low.c2
-rw-r--r--gdb/gdbserver/remote-utils.c2
-rw-r--r--gdb/gdbserver/target.c8
-rw-r--r--gdb/gdbserver/target.h11
-rw-r--r--gdb/gdbserver/win32-low.c4
10 files changed, 42 insertions, 16 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 63778e2..b62ed4c 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,25 @@
+2020-01-10 Pedro Alves <palves@redhat.com>
+
+ * fork-child.c (post_fork_inferior): Pass target down to
+ startup_inferior.
+ * inferiors.c (switch_to_thread): Add process_stratum_target
+ parameter.
+ * lynx-low.c (lynx_target_ops): Now a process_stratum_target.
+ * nto-low.c (nto_target_ops): Now a process_stratum_target.
+ * linux-low.c (linux_target_ops): Now a process_stratum_target.
+ * remote-utils.c (prepare_resume_reply): Pass the target to
+ switch_to_thread.
+ * target.c (the_target): Now a process_stratum_target.
+ (done_accessing_memory): Pass the target to switch_to_thread.
+ (set_target_ops): Ajust to use process_stratum_target.
+ * target.h (struct target_ops): Rename to ...
+ (struct process_stratum_target): ... this.
+ (the_target, set_target_ops): Adjust.
+ (prepare_to_access_memory): Adjust comment.
+ * win32-low.c (child_xfer_memory): Adjust to use
+ process_stratum_target.
+ (win32_target_ops): Now a process_stratum_target.
+
2020-01-06 Eli Zaretskii <eliz@gnu.org>
Pedro Alves <palves@redhat.com>
diff --git a/gdb/gdbserver/fork-child.c b/gdb/gdbserver/fork-child.c
index 0a53a25..7a71ec0 100644
--- a/gdb/gdbserver/fork-child.c
+++ b/gdb/gdbserver/fork-child.c
@@ -107,7 +107,8 @@ post_fork_inferior (int pid, const char *program)
atexit (restore_old_foreground_pgrp);
#endif
- startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED,
+ startup_inferior (the_target, pid,
+ START_INFERIOR_TRAPS_EXPECTED,
&cs.last_status, &cs.last_ptid);
current_thread->last_resume_kind = resume_stop;
current_thread->last_status = cs.last_status;
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index fe7161c..cf6e914 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -216,7 +216,7 @@ current_process (void)
/* See gdbsupport/common-gdbthread.h. */
void
-switch_to_thread (ptid_t ptid)
+switch_to_thread (process_stratum_target *ops, ptid_t ptid)
{
gdb_assert (ptid != minus_one_ptid);
current_thread = find_thread_ptid (ptid);
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4255795..676dea2 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -7354,7 +7354,7 @@ linux_get_hwcap2 (int wordsize)
return hwcap2;
}
-static struct target_ops linux_target_ops = {
+static process_stratum_target linux_target_ops = {
linux_create_inferior,
linux_post_create_inferior,
linux_attach,
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index decbe49..a5b0193 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -721,7 +721,7 @@ lynx_request_interrupt (void)
/* The LynxOS target_ops vector. */
-static struct target_ops lynx_target_ops = {
+static process_stratum_target lynx_target_ops = {
lynx_create_inferior,
NULL, /* post_create_inferior */
lynx_attach,
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index 8af5cf6..b4dea47 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -931,7 +931,7 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
}
-static struct target_ops nto_target_ops = {
+static process_stratum_target nto_target_ops = {
nto_create_inferior,
NULL, /* post_create_inferior */
nto_attach,
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index b757740..b8a8c65 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1208,7 +1208,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
saved_thread = current_thread;
- switch_to_thread (ptid);
+ switch_to_thread (the_target, ptid);
regp = current_target_desc ()->expedite_regs;
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index f3887b3..a4593cf 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -22,7 +22,7 @@
#include "tracepoint.h"
#include "gdbsupport/byte-vector.h"
-struct target_ops *the_target;
+process_stratum_target *the_target;
int
set_desired_thread ()
@@ -119,7 +119,7 @@ done_accessing_memory (void)
/* Restore the previous selected thread. */
cs.general_thread = prev_general_thread;
- switch_to_thread (cs.general_thread);
+ switch_to_thread (the_target, cs.general_thread);
}
int
@@ -284,9 +284,9 @@ start_non_stop (int nonstop)
}
void
-set_target_ops (struct target_ops *target)
+set_target_ops (process_stratum_target *target)
{
- the_target = XNEW (struct target_ops);
+ the_target = XNEW (process_stratum_target);
memcpy (the_target, target, sizeof (*the_target));
}
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 2681078..1b0810b 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -63,7 +63,10 @@ struct thread_resume
CORE_ADDR step_range_end; /* Exclusive */
};
-struct target_ops
+/* GDBserver doesn't have a concept of strata like GDB, but we call
+ its target vector "process_stratum" anyway for the benefit of
+ shared code. */
+struct process_stratum_target
{
/* Start a new process.
@@ -476,9 +479,9 @@ struct target_ops
bool (*thread_handle) (ptid_t ptid, gdb_byte **handle, int *handle_len);
};
-extern struct target_ops *the_target;
+extern process_stratum_target *the_target;
-void set_target_ops (struct target_ops *);
+void set_target_ops (process_stratum_target *);
#define create_inferior(program, program_args) \
(*the_target->create_inferior) (program, program_args)
@@ -702,7 +705,7 @@ ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
int connected_wait);
/* Prepare to read or write memory from the inferior process. See the
- corresponding target_ops methods for more details. */
+ corresponding process_stratum_target methods for more details. */
int prepare_to_access_memory (void);
void done_accessing_memory (void);
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 340f65b..2c4a9b1 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -307,7 +307,7 @@ win32_stopped_data_address (void)
/* Transfer memory from/to the debugged process. */
static int
child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
- int write, struct target_ops *target)
+ int write, process_stratum_target *target)
{
BOOL success;
SIZE_T done = 0;
@@ -1795,7 +1795,7 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
return the_low_target.breakpoint;
}
-static struct target_ops win32_target_ops = {
+static process_stratum_target win32_target_ops = {
win32_create_inferior,
NULL, /* post_create_inferior */
win32_attach,