From dbe692af2d1814100748b18a5dd70214e8611107 Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Fri, 19 Jun 2020 17:31:23 -0300 Subject: 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 * remote.c (remote_target) : New method override. : New method override. : 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) : New virtual method. : New virtual method. : 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. --- gdb/target-debug.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gdb/target-debug.h') diff --git a/gdb/target-debug.h b/gdb/target-debug.h index 1cc8256..c3004c2 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -212,4 +212,28 @@ target_debug_print_signals (gdb::array_view sigs) fputs_unfiltered (" }", gdb_stdlog); } +static void +target_debug_print_size_t (size_t size) +{ + fprintf_unfiltered (gdb_stdlog, "%s", pulongest (size)); +} + +static void +target_debug_print_const_gdb_byte_vector_r (const gdb::byte_vector &vector) +{ + fputs_unfiltered ("{", gdb_stdlog); + + for (size_t i = 0; i < vector.size (); i++) + { + fprintf_unfiltered (gdb_stdlog, " %s", + phex_nz (vector[i], 1)); + } + fputs_unfiltered (" }", gdb_stdlog); +} + +static void +target_debug_print_gdb_byte_vector_r (gdb::byte_vector &vector) +{ + target_debug_print_const_gdb_byte_vector_r (vector); +} #endif /* TARGET_DEBUG_H */ -- cgit v1.1