summaryrefslogtreecommitdiff
path: root/gdbserver/target.h
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2020-06-15 15:34:06 -0300
committerLuis Machado <luis.machado@linaro.org>2021-03-24 14:49:21 -0300
commit546b77fe78bb366bbec3c708ac371e2f553bbdae (patch)
tree83e9a4964c5abe2fce9a3f17de88e257b1533886 /gdbserver/target.h
parent754487e200deb9fad3399556e838bb68eedbab18 (diff)
downloadbinutils-gdb-546b77fe78bb366bbec3c708ac371e2f553bbdae.tar.gz
GDBserver remote packet support for memory tagging
This patch adds the generic remote bits to gdbserver so it can check for memory tagging support and handle fetch tags and store tags requests. gdbserver/ChangeLog: 2021-03-24 Luis Machado <luis.machado@linaro.org> * remote-utils.cc (decode_m_packet_params): Renamed from ... (decode_m_packet): ... this, which now calls decode_m_packet_params. Make char * param/return const char *. (decode_M_packet): Use decode_m_packet_params and make char * param const char *. * remote-utils.h (decode_m_packet_params): New prototype. (decode_m_packet): Constify char pointers. (decode_M_packet): Likewise. * server.cc (create_fetch_memtags_reply) (parse_store_memtags_request): New functions. (handle_general_set): Handle the QMemTags packet. (parse_fetch_memtags_request): New function. (handle_query): Handle the qMemTags packet and advertise memory tagging support. (captured_main): Initialize memory tagging flag. * server.h (struct client_state): Initialize memory tagging flag. * target.cc (process_stratum_target::supports_memory_tagging) (process_stratum_target::fetch_memtags) (process_stratum_target::store_memtags): New methods. * target.h: Include gdbsupport/byte-vector.h. (class process_stratum_target) <supports_memory_tagging> <fetch_memtags, store_memtags>: New class virtual methods. (target_supports_memory_tagging): Define.
Diffstat (limited to 'gdbserver/target.h')
-rw-r--r--gdbserver/target.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 336ee5ad9db..2831a6ce7c0 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -30,6 +30,7 @@
#include "gdbsupport/array-view.h"
#include "gdbsupport/btrace-common.h"
#include <vector>
+#include "gdbsupport/byte-vector.h"
struct emit_ops;
struct buffer;
@@ -499,6 +500,23 @@ public:
/* Return tdesc index for IPA. */
virtual int get_ipa_tdesc_idx ();
+
+ /* Returns true if the target supports memory tagging facilities. */
+ virtual bool supports_memory_tagging ();
+
+ /* Return the allocated memory tags of type TYPE associated with
+ [ADDRESS, ADDRESS + LEN) in TAGS.
+
+ Returns true if successful and false otherwise. */
+ virtual bool fetch_memtags (CORE_ADDR address, size_t len,
+ gdb::byte_vector &tags, int type);
+
+ /* Write the allocation tags of type TYPE contained in TAGS to the
+ memory range [ADDRESS, ADDRESS + LEN).
+
+ Returns true if successful and false otherwise. */
+ virtual bool store_memtags (CORE_ADDR address, size_t len,
+ const gdb::byte_vector &tags, int type);
};
extern process_stratum_target *the_target;
@@ -525,6 +543,9 @@ int kill_inferior (process_info *proc);
#define target_supports_exec_events() \
the_target->supports_exec_events ()
+#define target_supports_memory_tagging() \
+ the_target->supports_memory_tagging ()
+
#define target_handle_new_gdb_connection() \
the_target->handle_new_gdb_connection ()