diff options
author | Pedro Alves <palves@redhat.com> | 2012-03-19 14:33:35 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-03-19 14:33:35 +0000 |
commit | 122f36efc10da1ff5133220193fdbb83062db614 (patch) | |
tree | 5b79622ff661b4a268762d0995867403be0cfb1a | |
parent | 3a69ffb28004861ab8dec52db2a1d14d5f479df4 (diff) | |
download | gdb-122f36efc10da1ff5133220193fdbb83062db614.zip gdb-122f36efc10da1ff5133220193fdbb83062db614.tar.gz gdb-122f36efc10da1ff5133220193fdbb83062db614.tar.bz2 |
2012-03-19 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* server.c (cont_thread, general_thread): Add describing comments.
(start_inferior): Clear `cont_thread'.
(handle_v_cont): Don't set `cont_thread' if resuming all threads
of a process.
-rw-r--r-- | gdb/gdbserver/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 24 |
2 files changed, 30 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 61607a6..91b12e0 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2012-03-19 Pedro Alves <palves@redhat.com> + Jan Kratochvil <jan.kratochvil@redhat.com> + + * server.c (cont_thread, general_thread): Add describing comments. + (start_inferior): Clear `cont_thread'. + (handle_v_cont): Don't set `cont_thread' if resuming all threads + of a process. + 2012-03-15 Yao Qi <yao@codesourcery.com> * tracepoint.c (install_tracepoint): Move duplicated tracepoint diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3c97dbd..a4e9e57 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -30,7 +30,19 @@ #include <sys/wait.h> #endif +/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of + `vCont'. Note the multi-process extensions made `vCont' a + requirement, so `Hc pPID.TID' is pretty much undefined. So + CONT_THREAD can be null_ptid for no `Hc' thread, minus_one_ptid for + resuming all threads of the process (again, `Hc' isn't used for + multi-process), or a specific thread ptid_t. + + We also set this when handling a single-thread `vCont' resume, as + some places in the backends check it to know when (and for which + thread) single-thread scheduler-locking is in effect. */ ptid_t cont_thread; + +/* The thread set with an `Hg' packet. */ ptid_t general_thread; int server_waiting; @@ -262,6 +274,10 @@ start_inferior (char **argv) signal (SIGTTIN, SIG_DFL); #endif + /* Clear this so the backend doesn't get confused, thinking + CONT_THREAD died, and it needs to resume all threads. */ + cont_thread = null_ptid; + signal_pid = create_inferior (new_argv[0], new_argv); /* FIXME: we don't actually know at this point that the create @@ -1962,9 +1978,13 @@ handle_v_cont (char *own_buf) if (i < n) resume_info[i] = default_action; - /* Still used in occasional places in the backend. */ + /* `cont_thread' is still used in occasional places in the backend, + to implement single-thread scheduler-locking. Doesn't make sense + to set it if we see a stop request, or any form of wildcard + vCont. */ if (n == 1 - && !ptid_equal (resume_info[0].thread, minus_one_ptid) + && !(ptid_equal (resume_info[0].thread, minus_one_ptid) + || ptid_get_lwp (resume_info[0].thread) == -1) && resume_info[0].kind != resume_stop) cont_thread = resume_info[0].thread; else |