This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] protocol doc vs. gdbserver on H and pPID.-1 etc. [Re: [patch 2/2] Fix watchpoints for multi-inferior #2]
On Wed, 25 Jan 2012 20:59:56 +0100, Pedro Alves wrote:
> Makes no sense setting the cont_thread to a process wildcard, there's no
> such thing in the protocol. So this brings in a variant of your patch,
> that fixes it early on, instead of late in the target, along with clearing
> cont_thread on vRun.
This behavior matches what what does gdbserver for the `H' packet - it also
does not recognize pPID.-1.
But gdb.texinfo implicitly says pPID.-1 should be recognized as pPID but that
does not correspond to what gdbserver does.
So I made somehow doc <-> gdbserver in sync and made it all more clear.
Do you agree with it this way?
(I do not think that patch of yours / idea of it comes from me, feel free to
even remove my credit but I am also fine with the credit kept there.)
No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu in
gdbserver mode.
Thanks,
Jan
gdb/doc/
2012-01-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Packets): Document values for the `H' packet.
Deprecate `Hc'.
gdb/gdbserver/
2012-01-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* server.c (cont_thread): New comment for it.
(process_serial_event): Handle pPID.-1 values for 'H'.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -33798,7 +33798,13 @@ it should be @samp{c} for step and continue operations (note that this
is deprecated, supporting the @samp{vCont} command is a better
option), @samp{g} for other operations. The thread designator
@var{thread-id} has the format and interpretation described in
-@ref{thread-id syntax}.
+@ref{thread-id syntax} - value @samp{0} will act like @samp{-1} - to
+choose all threads of all inferiors. @samp{pPID} (or equivalent
+@samp{pPID.-1}) means to choose any single thread of that @samp{PID}.
+It does not mean all threads of that @samp{PID} process - use
+@samp{vCont} packet instead in such case.
+
+Use of @samp{Hc} is deprecated in favor of @xref{vCont packet}.
Reply:
@table @samp
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -29,7 +29,15 @@
#include <sys/wait.h>
#endif
+/* Deprecated. See gdb.texinfo description of the `Hc' packet - use
+ 'vCont' packet instead. It can be null_ptid for no inferior,
+ minus_one_ptid for resuming all inferior or a specific thread ptid_t.
+ Particularly process wildcard (pid > 0 && lwp == -1) for resuming
+ whole one inferior is not supported. This variable is provided only
+ for backward compatibility with both clients and backend, backend
+ 'resume' method supports process wildcards instead. */
ptid_t cont_thread;
+
ptid_t general_thread;
int server_waiting;
@@ -2980,8 +2988,8 @@ process_serial_event (void)
|| ptid_equal (gdb_id, minus_one_ptid))
thread_id = null_ptid;
else if (pid != 0
- && ptid_equal (pid_to_ptid (pid),
- gdb_id))
+ && (ptid_equal (pid_to_ptid (pid), gdb_id)
+ || ptid_equal (ptid_build (pid, -1, 0), gdb_id)))
{
struct thread_info *thread =
(struct thread_info *) find_inferior (&all_threads,