2004-02-25 Roland McGrath <roland@redhat.com>
* remote.c (remote_protocol_qPart_auxv): New variable. (init_all_packet_configs): Initialize it. (set_remote_protocol_qPart_auxv_packet_cmd): New function. (show_remote_protocol_qPart_auxv_packet_cmd): New function. (show_remote_cmd): Call it. (_initialize_remote): Initialize commands. (remote_xfer_partial): If enabled, use qPart:auxv:read:... query to service TARGET_OBJECT_AUXV requests.
This commit is contained in:
parent
66745969b0
commit
802188a76c
61
gdb/remote.c
61
gdb/remote.c
|
@ -981,6 +981,23 @@ show_remote_protocol_binary_download_cmd (char *args, int from_tty,
|
|||
show_packet_config_cmd (&remote_protocol_binary_download);
|
||||
}
|
||||
|
||||
/* Should we try the 'qPart:auxv' (target auxiliary vector read) request? */
|
||||
static struct packet_config remote_protocol_qPart_auxv;
|
||||
|
||||
static void
|
||||
set_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
|
||||
struct cmd_list_element *c)
|
||||
{
|
||||
update_packet_config (&remote_protocol_qPart_auxv);
|
||||
}
|
||||
|
||||
static void
|
||||
show_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
|
||||
struct cmd_list_element *c)
|
||||
{
|
||||
show_packet_config_cmd (&remote_protocol_qPart_auxv);
|
||||
}
|
||||
|
||||
|
||||
/* Tokens for use by the asynchronous signal handlers for SIGINT */
|
||||
static void *sigint_remote_twice_token;
|
||||
|
@ -2070,6 +2087,7 @@ init_all_packet_configs (void)
|
|||
/* Force remote_write_bytes to check whether target supports binary
|
||||
downloading. */
|
||||
update_packet_config (&remote_protocol_binary_download);
|
||||
update_packet_config (&remote_protocol_qPart_auxv);
|
||||
}
|
||||
|
||||
/* Symbol look-up. */
|
||||
|
@ -4872,6 +4890,41 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
|
|||
case TARGET_OBJECT_AVR:
|
||||
query_type = 'R';
|
||||
break;
|
||||
|
||||
case TARGET_OBJECT_AUXV:
|
||||
if (remote_protocol_qPart_auxv.support != PACKET_DISABLE)
|
||||
{
|
||||
unsigned int total = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
LONGEST n = min ((rs->remote_packet_size - 2) / 2, len);
|
||||
snprintf (buf2, rs->remote_packet_size,
|
||||
"qPart:auxv:read::%s,%s",
|
||||
phex_nz (offset, sizeof offset),
|
||||
phex_nz (n, sizeof n));
|
||||
i = putpkt (buf2);
|
||||
if (i < 0)
|
||||
return total > 0 ? total : i;
|
||||
buf2[0] = '\0';
|
||||
getpkt (buf2, rs->remote_packet_size, 0);
|
||||
if (packet_ok (buf2, &remote_protocol_qPart_auxv) != PACKET_OK)
|
||||
return total > 0 ? total : -1;
|
||||
if (buf2[0] == 'O' && buf2[1] == 'K' && buf2[2] == '\0')
|
||||
break; /* Got EOF indicator. */
|
||||
/* Got some data. */
|
||||
i = hex2bin (buf2, readbuf, len);
|
||||
if (i > 0)
|
||||
{
|
||||
readbuf = (void *) ((char *) readbuf + i);
|
||||
offset += i;
|
||||
len -= i;
|
||||
total += i;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -5369,6 +5422,7 @@ show_remote_cmd (char *args, int from_tty)
|
|||
show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL);
|
||||
show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
|
||||
show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
|
||||
show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -5612,6 +5666,13 @@ in a memory packet.\n",
|
|||
&remote_set_cmdlist, &remote_show_cmdlist,
|
||||
0);
|
||||
|
||||
add_packet_config_cmd (&remote_protocol_qPart_auxv,
|
||||
"qPart_auxv", "read-aux-vector",
|
||||
set_remote_protocol_qPart_auxv_packet_cmd,
|
||||
show_remote_protocol_qPart_auxv_packet_cmd,
|
||||
&remote_set_cmdlist, &remote_show_cmdlist,
|
||||
0);
|
||||
|
||||
/* Keep the old ``set remote Z-packet ...'' working. */
|
||||
add_setshow_auto_boolean_cmd ("Z-packet", class_obscure,
|
||||
&remote_Z_packet_detect, "\
|
||||
|
|
Loading…
Reference in New Issue