aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-12-01 09:40:02 -0500
committerSimon Marchi <simon.marchi@efficios.com>2021-12-08 21:00:39 -0500
commita4543480c5e7879955c57e20ab4e8935961153b5 (patch)
tree26ab9c2187df595d2e8e6a45454ee36960e92c78 /gdb/remote.c
parent4a3ee32a402c865d2abec9bd6b708bc315a0fff8 (diff)
downloadgdb-a4543480c5e7879955c57e20ab4e8935961153b5.zip
gdb-a4543480c5e7879955c57e20ab4e8935961153b5.tar.gz
gdb-a4543480c5e7879955c57e20ab4e8935961153b5.tar.bz2
gdb/remote.c: move some things up
Move the stop_reply and a few functions up. Some code above them in the file will need to use them in a following patch. No behavior changes expected here. Change-Id: I3ca57d0e3ec253f56e1ba401289d9d167de14ad2
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c144
1 files changed, 71 insertions, 73 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 7ed9330..f78417b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -996,6 +996,36 @@ public:
bool supports_disable_randomization () override;
};
+struct stop_reply : public notif_event
+{
+ ~stop_reply ();
+
+ /* The identifier of the thread about this event */
+ ptid_t ptid;
+
+ /* The remote state this event is associated with. When the remote
+ connection, represented by a remote_state object, is closed,
+ all the associated stop_reply events should be released. */
+ struct remote_state *rs;
+
+ struct target_waitstatus ws;
+
+ /* The architecture associated with the expedited registers. */
+ gdbarch *arch;
+
+ /* Expedited registers. This makes remote debugging a bit more
+ efficient for those targets that provide critical registers as
+ part of their normal status mechanism (as another roundtrip to
+ fetch them is avoided). */
+ std::vector<cached_reg_t> regcache;
+
+ enum target_stop_reason stop_reason;
+
+ CORE_ADDR watch_data_address;
+
+ int core;
+};
+
/* See remote.h. */
bool
@@ -5846,6 +5876,47 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
rs->wait_forever_enabled_p = 1;
}
+/* Determine if THREAD_PTID is a pending fork parent thread. ARG contains
+ the pid of the process that owns the threads we want to check, or
+ -1 if we want to check all threads. */
+
+static int
+is_pending_fork_parent (const target_waitstatus &ws, int event_pid,
+ ptid_t thread_ptid)
+{
+ if (ws.kind () == TARGET_WAITKIND_FORKED
+ || ws.kind () == TARGET_WAITKIND_VFORKED)
+ {
+ if (event_pid == -1 || event_pid == thread_ptid.pid ())
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Return the thread's pending status used to determine whether the
+ thread is a fork parent stopped at a fork event. */
+
+static const target_waitstatus &
+thread_pending_fork_status (struct thread_info *thread)
+{
+ if (thread->has_pending_waitstatus ())
+ return thread->pending_waitstatus ();
+ else
+ return thread->pending_follow;
+}
+
+/* Determine if THREAD is a pending fork parent thread. */
+
+static int
+is_pending_fork_parent_thread (struct thread_info *thread)
+{
+ const target_waitstatus &ws = thread_pending_fork_status (thread);
+ int pid = -1;
+
+ return is_pending_fork_parent (ws, pid, thread->ptid);
+}
+
/* Detach the specified process. */
void
@@ -6538,8 +6609,6 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
rs->waiting_for_stop_reply = 1;
}
-static int is_pending_fork_parent_thread (struct thread_info *thread);
-
/* Private per-inferior info for target remote processes. */
struct remote_inferior : public private_inferior
@@ -6559,36 +6628,6 @@ get_remote_inferior (inferior *inf)
return static_cast<remote_inferior *> (inf->priv.get ());
}
-struct stop_reply : public notif_event
-{
- ~stop_reply ();
-
- /* The identifier of the thread about this event */
- ptid_t ptid;
-
- /* The remote state this event is associated with. When the remote
- connection, represented by a remote_state object, is closed,
- all the associated stop_reply events should be released. */
- struct remote_state *rs;
-
- struct target_waitstatus ws;
-
- /* The architecture associated with the expedited registers. */
- gdbarch *arch;
-
- /* Expedited registers. This makes remote debugging a bit more
- efficient for those targets that provide critical registers as
- part of their normal status mechanism (as another roundtrip to
- fetch them is avoided). */
- std::vector<cached_reg_t> regcache;
-
- enum target_stop_reason stop_reason;
-
- CORE_ADDR watch_data_address;
-
- int core;
-};
-
/* Class used to track the construction of a vCont packet in the
outgoing packet buffer. This is used to send multiple vCont
packets if we have more actions than would fit a single packet. */
@@ -7255,47 +7294,6 @@ struct notif_client notif_client_stop =
REMOTE_NOTIF_STOP,
};
-/* Determine if THREAD_PTID is a pending fork parent thread. ARG contains
- the pid of the process that owns the threads we want to check, or
- -1 if we want to check all threads. */
-
-static int
-is_pending_fork_parent (const target_waitstatus &ws, int event_pid,
- ptid_t thread_ptid)
-{
- if (ws.kind () == TARGET_WAITKIND_FORKED
- || ws.kind () == TARGET_WAITKIND_VFORKED)
- {
- if (event_pid == -1 || event_pid == thread_ptid.pid ())
- return 1;
- }
-
- return 0;
-}
-
-/* Return the thread's pending status used to determine whether the
- thread is a fork parent stopped at a fork event. */
-
-static const target_waitstatus &
-thread_pending_fork_status (struct thread_info *thread)
-{
- if (thread->has_pending_waitstatus ())
- return thread->pending_waitstatus ();
- else
- return thread->pending_follow;
-}
-
-/* Determine if THREAD is a pending fork parent thread. */
-
-static int
-is_pending_fork_parent_thread (struct thread_info *thread)
-{
- const target_waitstatus &ws = thread_pending_fork_status (thread);
- int pid = -1;
-
- return is_pending_fork_parent (ws, pid, thread->ptid);
-}
-
/* If CONTEXT contains any fork child threads that have not been
reported yet, remove them from the CONTEXT list. If such a
thread exists it is because we are stopped at a fork catchpoint