aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-low.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-26 16:17:25 +0100
committerPedro Alves <palves@redhat.com>2016-10-26 16:22:27 +0100
commit5a04c4cf5df6d13596e79e7b84520cbe245a5a4d (patch)
treeca918346659ecfe5cc666db371950a9b98b15544 /gdb/gdbserver/linux-low.h
parentca6eff59089ff1a1772ac95d4890f94b3eef2796 (diff)
downloadgdb-5a04c4cf5df6d13596e79e7b84520cbe245a5a4d.zip
gdb-5a04c4cf5df6d13596e79e7b84520cbe245a5a4d.tar.gz
gdb-5a04c4cf5df6d13596e79e7b84520cbe245a5a4d.tar.bz2
gdbserver: Leave already-vCont-resumed threads as they were
Currently GDB never sends more than one action per vCont packet, when connected in non-stop mode. A follow up patch will change that, and it exposed a gdbserver problem with the vCont handling. For example, this in non-stop mode: => vCont;s:p1.1;c <= OK Should be equivalent to: => vCont;s:p1.1 <= OK => vCont;c <= OK But gdbserver currently doesn't handle this. In the latter case, "vCont;c" makes gdbserver clobber the previous step request. This patch fixes that. Note the server side must ignore resume actions for the thread that has a pending %Stopped notification (and any other threads with events pending), until GDB acks the notification with vStopped. Otherwise, e.g., the following case is mishandled: #1 => g (or any other packet) #2 <= [registers] #3 <= %Stopped T05 thread:p1.2 #4 => vCont s:p1.1;c #5 <= OK Above, the server must not resume thread p1.2 when it processes the vCont. GDB can't know that p1.2 stopped until it acks the %Stopped notification. (Otherwise it wouldn't send a default "c" action.) (The vCont documentation already specifies this.) Finally, special care must also be given to handling fork/vfork events. A (v)fork event actually tells us that two processes stopped -- the parent and the child. Until we follow the fork, we must not resume the child. Therefore, if we have a pending fork follow, we must not send a global wildcard resume action (vCont;c). We can still send process-wide wildcards though. (The comments above will be added as code comments to gdb in a follow up patch.) gdb/gdbserver/ChangeLog: 2016-10-26 Pedro Alves <palves@redhat.com> * linux-low.c (handle_extended_wait): Link parent/child fork threads. (linux_wait_1): Unlink them. (linux_set_resume_request): Ignore resume requests for already-resumed and unhandled fork child threads. * linux-low.h (struct lwp_info) <fork_relative>: New field. * server.c (in_queued_stop_replies_ptid, in_queued_stop_replies): New functions. (handle_v_requests) <vCont>: Don't call require_running. * server.h (in_queued_stop_replies): New declaration.
Diffstat (limited to 'gdb/gdbserver/linux-low.h')
-rw-r--r--gdb/gdbserver/linux-low.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 5057e66..476816d 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -301,6 +301,12 @@ struct lwp_info
information or exit status until it can be reported to GDB. */
struct target_waitstatus waitstatus;
+ /* A pointer to the fork child/parent relative. Valid only while
+ the parent fork event is not reported to higher layers. Used to
+ avoid wildcard vCont actions resuming a fork child before GDB is
+ notified about the parent's fork event. */
+ struct lwp_info *fork_relative;
+
/* When stopped is set, this is where the lwp last stopped, with
decr_pc_after_break already accounted for. If the LWP is
running, this is the address at which the lwp was resumed. */