diff options
author | Luis Machado <luis.machado@linaro.org> | 2020-06-19 17:31:23 -0300 |
---|---|---|
committer | Luis Machado <luis.machado@linaro.org> | 2021-03-24 14:47:05 -0300 |
commit | dbe692af2d1814100748b18a5dd70214e8611107 (patch) | |
tree | c5f5e256ce4084fb482161faede8e647960742ba /gdb/target.h | |
parent | 9a182d0461cc34912da51f445a242b392389edd6 (diff) | |
download | gdb-dbe692af2d1814100748b18a5dd70214e8611107.zip gdb-dbe692af2d1814100748b18a5dd70214e8611107.tar.gz gdb-dbe692af2d1814100748b18a5dd70214e8611107.tar.bz2 |
New target methods for memory tagging support
This patch starts adding some of the generic pieces to accomodate memory
tagging.
We have three new target methods:
- supports_memory_tagging: Checks if the target supports memory tagging. This
defaults to false for targets that don't support memory tagging.
- fetch_memtags: Fetches the allocation tags associated with a particular
memory range [address, address + length).
The default is to return 0 without returning any tags. This should only
be called if memory tagging is supported.
- store_memtags: Stores a set of allocation tags for a particular memory
range [address, address + length).
The default is to return 0. This should only
be called if memory tagging is supported.
gdb/ChangeLog:
2021-03-24 Luis Machado <luis.machado@linaro.org>
* remote.c (remote_target) <supports_memory_tagging>: New method
override.
<fetch_memtags>: New method override.
<store_memtags>: New method override.
(remote_target::supports_memory_tagging): New method.
(remote_target::fetch_memtags): New method.
(remote_target::store_memtags): New method.
* target-delegates.c: Regenerate.
* target.h (struct target_ops) <supports_memory_tagging>: New virtual
method.
<fetch_memtags>: New virtual method.
<store_memtags>: New virtual method.
(target_supports_memory_tagging): Define.
(target_fetch_memtags): Define.
(target_store_memtags): Define.
* target-debug.h (target_debug_print_size_t)
(target_debug_print_const_gdb_byte_vector_r)
(target_debug_print_gdb_byte_vector_r): New functions.
Diffstat (limited to 'gdb/target.h')
-rw-r--r-- | gdb/target.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/target.h b/gdb/target.h index 8c11fb7..dde222b 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1267,6 +1267,38 @@ 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, false otherwise. */ + virtual bool supports_memory_tagging () + TARGET_DEFAULT_RETURN (false); + + /* Return the allocated memory tags of type TYPE associated with + [ADDRESS, ADDRESS + LEN) in TAGS. + + LEN is the number of bytes in the memory range. TAGS is a vector of + bytes containing the tags found in the above memory range. + + It is up to the architecture/target to interpret the bytes in the TAGS + vector and read the tags appropriately. + + Returns true if fetching the tags succeeded and false otherwise. */ + virtual bool fetch_memtags (CORE_ADDR address, size_t len, + gdb::byte_vector &tags, int type) + TARGET_DEFAULT_NORETURN (tcomplain ()); + + /* Write the allocation tags of type TYPE contained in TAGS to the memory + range [ADDRESS, ADDRESS + LEN). + + LEN is the number of bytes in the memory range. TAGS is a vector of + bytes containing the tags to be stored to the memory range. + + It is up to the architecture/target to interpret the bytes in the TAGS + vector and store them appropriately. + + Returns true if storing the tags succeeded and false otherwise. */ + virtual bool store_memtags (CORE_ADDR address, size_t len, + const gdb::byte_vector &tags, int type) + TARGET_DEFAULT_NORETURN (tcomplain ()); }; /* Deleter for std::unique_ptr. See comments in @@ -2318,6 +2350,15 @@ extern gdb::unique_xmalloc_ptr<char> target_fileio_read_stralloc #define target_augmented_libraries_svr4_read() \ (current_top_target ()->augmented_libraries_svr4_read) () +#define target_supports_memory_tagging() \ + ((current_top_target ()->supports_memory_tagging) ()) + +#define target_fetch_memtags(address, len, tags, type) \ + (current_top_target ()->fetch_memtags) ((address), (len), (tags), (type)) + +#define target_store_memtags(address, len, tags, type) \ + (current_top_target ()->store_memtags) ((address), (len), (tags), (type)) + /* Command logging facility. */ #define target_log_command(p) \ |