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.
This commit is contained in:
parent
754487e200
commit
546b77fe78
7 changed files with 243 additions and 28 deletions
|
@ -1308,31 +1308,11 @@ prepare_resume_reply (char *buf, ptid_t ptid,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
decode_m_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
char ch;
|
||||
*mem_addr_ptr = *len_ptr = 0;
|
||||
/* See remote-utils.h. */
|
||||
|
||||
while ((ch = from[i++]) != ',')
|
||||
{
|
||||
*mem_addr_ptr = *mem_addr_ptr << 4;
|
||||
*mem_addr_ptr |= fromhex (ch) & 0x0f;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if ((ch = from[i++]) == 0)
|
||||
break;
|
||||
*len_ptr = *len_ptr << 4;
|
||||
*len_ptr |= fromhex (ch) & 0x0f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
|
||||
unsigned char **to_p)
|
||||
const char *
|
||||
decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr,
|
||||
unsigned int *len_ptr, const char end_marker)
|
||||
{
|
||||
int i = 0;
|
||||
char ch;
|
||||
|
@ -1344,16 +1324,32 @@ decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
|
|||
*mem_addr_ptr |= fromhex (ch) & 0x0f;
|
||||
}
|
||||
|
||||
while ((ch = from[i++]) != ':')
|
||||
while ((ch = from[i++]) != end_marker)
|
||||
{
|
||||
*len_ptr = *len_ptr << 4;
|
||||
*len_ptr |= fromhex (ch) & 0x0f;
|
||||
}
|
||||
|
||||
return from + i;
|
||||
}
|
||||
|
||||
void
|
||||
decode_m_packet (const char *from, CORE_ADDR *mem_addr_ptr,
|
||||
unsigned int *len_ptr)
|
||||
{
|
||||
decode_m_packet_params (from, mem_addr_ptr, len_ptr, '\0');
|
||||
}
|
||||
|
||||
void
|
||||
decode_M_packet (const char *from, CORE_ADDR *mem_addr_ptr,
|
||||
unsigned int *len_ptr, unsigned char **to_p)
|
||||
{
|
||||
from = decode_m_packet_params (from, mem_addr_ptr, len_ptr, ':');
|
||||
|
||||
if (*to_p == NULL)
|
||||
*to_p = (unsigned char *) xmalloc (*len_ptr);
|
||||
|
||||
hex2bin (&from[i++], *to_p, *len_ptr);
|
||||
hex2bin (from, *to_p, *len_ptr);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue