binutils-gdb/gdb/testsuite/gdb.server
Tankut Baris Aktemur e139a727be gdb/remote: do not check for null_ptid in stop reply
A gdbserver does not report a ptid in a 'W' or 'X' packet if multi-process
extensions are not supported or turned off.  See

https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#multiprocess-extensions
https://sourceware.org/gdb/current/onlinedocs/gdb/Stop-Reply-Packets.html#Stop-Reply-Packets

GDB's remote packet parser checks for whether a stop-reply packet
contains a ptid if the target is non-stop, and issues an error if no
ptid is included:

  if (target_is_non_stop_p () && event->ptid == null_ptid)
    error (_("No process or thread specified in stop reply: %s"), buf);

This leads to the following error when the non-stop
mode is turned on but multi-process extensions are off:

  $ gdb
  (gdb) set non-stop on
  (gdb) set remote multiprocess-feature-packet off
  (gdb) target remote | gdbserver - ./foo
  Remote debugging using | gdbserver - ./foo
  stdin/stdout redirected
  Process ./foo created; pid = 3712
  ...
  (gdb) continue
  Continuing.
  ...
  No process or thread specified in stop reply: W2a
  (gdb)

Because the check is done for stop reply packets in general, a similar
situation occurs if the 'T' or 'Tthread' packet is disabled in
gdbserver (i.e.  via --disable-packet=T).  E.g:

  $ gdb
  (gdb) set non-stop on
  (gdb) target remote | gdbserver --disable-packet=Tthread - ./foo
  ...
  No process or thread specified in stop reply: T0506:0000000000000000;07:10e2ffffff7f0000;10:9060ddf7ff7f0000;

or

  $ gdb
  (gdb) set non-stop on
  (gdb) target remote | gdbserver --disable-packet=T - ./foo
  ...
  No process or thread specified in stop reply: S05

The commit

  commit cada5fc921
  Date:   Wed Mar 11 12:30:13 2020 +0000

      gdb: Handle W and X remote packets without giving a warning

and its predecessor

  commit 24ed6739b6
  Date:   Thu Jan 30 14:35:40 2020 +0000

      gdb/remote: Restore support for 'S' stop reply packet

added warnings for when GDB has to make a guess for a missing ptid in
case of multiple threads/inferiors.  These warnings should suffice.
So, the simple solution is to remove the check completely.

Regression-tested on X86_64 Linux.

gdb/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* remote.c (remote_target::remote_parse_stop_reply): Remove the
	check for no ptid in the stop reply when the target is non-stop.

gdb/testsuite/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.server/stop-reply-no-thread.exp: Enhance the test
	scenario to cover execution until the end and also the case
	when no packet is disabled when starting gdbserver.
2020-04-01 16:57:39 +02:00
..
abspath.exp
bkpt-other-inferior.exp
connect-stopped-target.c
connect-stopped-target.exp
connect-with-no-symbol-file.c
connect-with-no-symbol-file.exp
connect-without-multi-process.c
connect-without-multi-process.exp
exit-multiple-threads.c gdb: Handle W and X remote packets without giving a warning 2020-03-19 11:16:53 +00:00
exit-multiple-threads.exp gdb: Handle W and X remote packets without giving a warning 2020-03-19 11:16:53 +00:00
ext-attach.c
ext-attach.exp
ext-restart.exp
ext-run.exp
ext-wrapper.exp
extended-remote-restart.c
extended-remote-restart.exp
file-transfer.exp
multi-ui-errors.c
multi-ui-errors.exp
no-thread-db.c
no-thread-db.exp
non-existing-program.exp
normal.c
reconnect-ctrl-c.c
reconnect-ctrl-c.exp
run-without-local-binary.exp
server-connect.exp
server-exec-info.exp
server-kill-python.exp
server-kill.c
server-kill.exp
server-mon.exp
server-run.exp
server.c
solib-list-lib.c
solib-list-main.c
solib-list.exp
stop-reply-no-thread.c
stop-reply-no-thread.exp gdb/remote: do not check for null_ptid in stop reply 2020-04-01 16:57:39 +02:00
sysroot.c
sysroot.exp
transfer.txt
unittest.exp
wrapper.c
wrapper.exp