Add new commands under the "mtag" prefix to allow users to inspect, modify and
check memory tags in different ways.
The available subcommands are the following:
- mtag showltag <expression>: Shows the logical tag for a particular address.
- mtag setltag <expression> <tag>: Prints the address tagged with the logical
tag <tag>.
- mtag showatag <expression>: Shows the allocation tag for a particular address.
- mtag setatag <expression> <length> <tags>: Sets one or more allocation tags to
the specified tags.
- mtag check <expression>: Check if the logical tag in <address> matches its
allocation tag.
These commands make use of the memory tagging gdbarch methods, and are still
available, but disabled, when memory tagging is not supported by the
architecture.
I've pondered about a way to make these commands invisible when memory tagging
is not available, but given the check is at runtime (and support may come and go
based on a process' configuration), that is a bit too late in the process to
either not include the commands or get rid of them.
Ideas are welcome.
gdb/ChangeLog:
YYYY-MM-DD Luis Machado <luis.machado@linaro.org>
* printcmd.c: Include gdbsupport/rsp-low.h.
(mtaglist): New static global.
(process_print_command_args): Factored out of
print_command_1.
(print_command_1): Use process_print_command_args.
(show_addr_not_tagged, show_memtag_unsupported, mtag_command)
(mtag_showtag_command, mtag_showltag_command, mtag_showatag_command)
(parse_setltag_input, mtag_setltag_command, parse_setatag_input)
(mtag_setatag_command, mtag_check_command): New functions.
(_initialize_printcmd): Add "mtag" prefix and subcommands.
gdbsupport/ChangeLog:
YYYY-MM-DD Luis Machado <luis.machado@linaro.org>
* rsp-low.cc (fromhex): Change error message text to not be
RSP-specific.