Add GDB-side remote target support for memory tagging
This patch adds memory tagging support to GDB's remote side, with
packet string checks, new packet support and an implementation of
the two new tags methods fetch_memtags and store_memtags.
GDBserver needs to know how to read/write allocation tags, since that is
done via ptrace. It doesn't need to know about logical tags.
The new packets are:
qMemTags:<address>,<length>:<type>
--
Reads tags of the specified type from the address range
[<address>, <address + length>)
QMemTags:<address>,<length>:<type>:<uninterpreted tag bytes>
--
Writes the tags of specified type represented by the uninterpreted bytes to
the address range [<address>, <address + length>).
The interpretation of what to do with the tag bytes is up to the arch-specific
code.
Note that these new packets consider the case of packet size overflow as an
error, given the common use case is to read/write only a few memory tags at
a time. Having to use a couple new packets for multi-part transfers wouldn't
make sense for the little use it would have.
gdb/ChangeLog:
2021-03-24 Luis Machado <luis.machado@linaro.org>
* remote.c (PACKET_memory_tagging_feature): New enum.
(remote_memory_tagging_p): New function.
(remote_protocol_features): New "memory-tagging" entry.
(remote_target::remote_query_supported): Handle memory tagging
support.
(remote_target::supports_memory_tagging): Implement.
(create_fetch_memtags_request, parse_fetch_memtags_reply)
(create_store_memtags_request): New functions.
(remote_target::fetch_memtags): Implement.
(remote_target::store_memtags): Implement.
(_initialize_remote): Add new "memory-tagging-feature"
config command.