Re: [PATCH v2 01/24] New target methods for memory tagging support

Simon Marchi
2020-10-27T13:22:51Z

On 2020-10-22 3:59 p.m., Luis Machado via Gdb-patches wrote:
> diff --git a/gdb/target.h b/gdb/target.h
> index 039194c239..80f9b1ee92 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -1260,6 +1260,22 @@ struct target_ops
> /* Cleanup after generating a core file. */
> virtual void done_generating_core ()
> TARGET_DEFAULT_IGNORE ();
> +
> + /* Returns true if the target supports memory tagging. */
> + virtual bool supports_memory_tagging ()
> + TARGET_DEFAULT_RETURN (false);
> +
> + /* Return the allocated memory tags of type TYPE associated with
> + [ADDRESS, ADDRESS + LEN) in TAGS. */
> + virtual int fetch_memtags (CORE_ADDR address, size_t len,
> + gdb::byte_vector &tags, int type)
> + TARGET_DEFAULT_IGNORE ();
> +
> + /* Write the allocation tags of type TYPE contained in TAGS to the memory
> + range [ADDRESS, ADDRESS + LEN). */
> + virtual int store_memtags (CORE_ADDR address, size_t len,
> + const gdb::byte_vector &tags, int type)
> + TARGET_DEFAULT_IGNORE ();

Could you precise the comment for fetch_memtags and store_memtags? It's
not clear to me what the tags vector contains. Will it be of length
LEN, with each element containing the tag of the matching memory
location in [ADDRESS, ADDRESS + LEN)?

Also, what does the return values mean?

Simon