Remote protocol question: the documentation says '?' is not required, but maybe it is?

Reuben Thomas
2020-07-19T19:08:59Z

In the GDB manual, section E.1 Overview about the Remote Protocol, there is
the following text:

At a minimum, a stub is required to support the ‘g’ and ‘G’ commands for
> register access, and the ‘m’ and ‘M’ commands for memory access. Stubs
> that only control single-threaded targets can implement run control with
> the ‘c’ (continue), and ‘s’ (step) commands. Stubs that support
> multi-threading targets should support the ‘vCont’ command. All other
> commands are optional.
>

In particular, this suggests that it is not necessary to support the '?'
command, which returns the most recent signal.

My simple remote stub indeed implements only 'g', 'G', 'm', 'M', 'c', 'd'
and 'k'. It also implements '?', and, on startup, sends a 'T' packet.

However, if I remove the implementation of '?', the following conversation
ensues with gdb:

putpacket:
> T0500:f4dff800;01:f4dff800;02:00400000;03:f580a200;04:00001000;05:00000000;06:f5805200;07:00001000;08:00000000;09:ffffffff;
> getpacket:
> qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+
> putpacket:
> getpacket: vMustReplyEmpty
> putpacket:
> getpacket: Hg0
> putpacket:
> getpacket: qTStatus
> putpacket:
> getpacket: ?
> putpacket:
> getpacket: qfThreadInfo
> putpacket:
> getpacket: qL1160000000000000000
> putpacket:
> getpacket: Hc-1
> putpacket:
> getpacket: qC
> putpacket:
> getpacket: qAttached
> putpacket:
> warning: Invalid remote reply:
>

and GDB hangs. It seems that it can't cope with my lack of reply to '?'.

Is this a bug in gdb, or should the documentation be updated? I'm using gdb
from recent master, commit 360f1cd72d; I have patched it to support my
architecture, but I've not touched remote.c or anything else to do with the
remote protocol.

On the other hand, as you can see from my list above, I do not implement
the 's' command, but this does not seem to be a problem. Again, is this an
error in the documentation?