mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
gdb/
* remote.c (remote_get_noisy_reply): Replace `sprintf' with `xsnprintf'. (remote_query_attached): Likewise. (remote_static_tracepoint_marker_at): Likewise. (remote_set_permissions): Likewise. (remote_detach_1, extended_remote_attach_1): Likewise. (send_g_packet, remote_vkill): Likewise. (extended_remote_disable_randomization): Likewise. (remote_add_target_side_condition): Likewise. (remote_insert_breakpoint): Likewise. (remote_remove_breakpoint): Likewise. (remote_insert_watchpoint): Likewise. (remote_remove_watchpoint): Likewise. (remote_insert_hw_breakpoint): Likewise. (remote_insert_hw_breakpoint): Likewise. (remote_remove_hw_breakpoint): Likewise. (remote_download_command_source): Likewise. (remote_download_tracepoint): Likewise. (remote_download_trace_state_variable): Likewise. (remote_disable_tracepoint): Likewise. (remote_trace_set_readonly_regions): Likewise. (remote_get_tracepoint_status): Likewise. (remote_trace_find): Likewise. (remote_get_trace_state_variable_value): Likewise. (remote_set_disconnected_tracing): Likewise. (remote_set_circular_trace_buffer): Likewise. (remote_get_min_fast_tracepoint_insn_len): Likewise. (remote_use_agent): Likewise. (remote_add_target_side_condition): Add one parameter BUF_SIZE. Update callers.
This commit is contained in:
parent
51898c1516
commit
bba74b36f0
@ -1,3 +1,36 @@
|
|||||||
|
2012-03-08 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* remote.c (remote_get_noisy_reply): Replace `sprintf' with
|
||||||
|
`xsnprintf'.
|
||||||
|
(remote_query_attached): Likewise.
|
||||||
|
(remote_static_tracepoint_marker_at): Likewise.
|
||||||
|
(remote_set_permissions): Likewise.
|
||||||
|
(remote_detach_1, extended_remote_attach_1): Likewise.
|
||||||
|
(send_g_packet, remote_vkill): Likewise.
|
||||||
|
(extended_remote_disable_randomization): Likewise.
|
||||||
|
(remote_add_target_side_condition): Likewise.
|
||||||
|
(remote_insert_breakpoint): Likewise.
|
||||||
|
(remote_remove_breakpoint): Likewise.
|
||||||
|
(remote_insert_watchpoint): Likewise.
|
||||||
|
(remote_remove_watchpoint): Likewise.
|
||||||
|
(remote_insert_hw_breakpoint): Likewise.
|
||||||
|
(remote_insert_hw_breakpoint): Likewise.
|
||||||
|
(remote_remove_hw_breakpoint): Likewise.
|
||||||
|
(remote_download_command_source): Likewise.
|
||||||
|
(remote_download_tracepoint): Likewise.
|
||||||
|
(remote_download_trace_state_variable): Likewise.
|
||||||
|
(remote_disable_tracepoint): Likewise.
|
||||||
|
(remote_trace_set_readonly_regions): Likewise.
|
||||||
|
(remote_get_tracepoint_status): Likewise.
|
||||||
|
(remote_trace_find): Likewise.
|
||||||
|
(remote_get_trace_state_variable_value): Likewise.
|
||||||
|
(remote_set_disconnected_tracing): Likewise.
|
||||||
|
(remote_set_circular_trace_buffer): Likewise.
|
||||||
|
(remote_get_min_fast_tracepoint_insn_len): Likewise.
|
||||||
|
(remote_use_agent): Likewise.
|
||||||
|
(remote_add_target_side_condition): Add one parameter BUF_SIZE.
|
||||||
|
Update callers.
|
||||||
|
|
||||||
2012-03-07 Pedro Alves <palves@redhat.com>
|
2012-03-07 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* NEWS: Mention QProgramSignals.
|
* NEWS: Mention QProgramSignals.
|
||||||
|
119
gdb/remote.c
119
gdb/remote.c
@ -479,7 +479,7 @@ remote_get_noisy_reply (char **buf_p,
|
|||||||
{
|
{
|
||||||
adjusted_size = to - org_to;
|
adjusted_size = to - org_to;
|
||||||
|
|
||||||
sprintf (buf, "qRelocInsn:%x", adjusted_size);
|
xsnprintf (buf, *sizeof_buf, "qRelocInsn:%x", adjusted_size);
|
||||||
putpkt (buf);
|
putpkt (buf);
|
||||||
}
|
}
|
||||||
else if (ex.reason < 0 && ex.error == MEMORY_ERROR)
|
else if (ex.reason < 0 && ex.error == MEMORY_ERROR)
|
||||||
@ -1419,14 +1419,15 @@ static int
|
|||||||
remote_query_attached (int pid)
|
remote_query_attached (int pid)
|
||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
size_t size = get_remote_packet_size ();
|
||||||
|
|
||||||
if (remote_protocol_packets[PACKET_qAttached].support == PACKET_DISABLE)
|
if (remote_protocol_packets[PACKET_qAttached].support == PACKET_DISABLE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (remote_multi_process_p (rs))
|
if (remote_multi_process_p (rs))
|
||||||
sprintf (rs->buf, "qAttached:%x", pid);
|
xsnprintf (rs->buf, size, "qAttached:%x", pid);
|
||||||
else
|
else
|
||||||
sprintf (rs->buf, "qAttached");
|
xsnprintf (rs->buf, size, "qAttached");
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -2892,7 +2893,7 @@ remote_static_tracepoint_marker_at (CORE_ADDR addr,
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *p = rs->buf;
|
char *p = rs->buf;
|
||||||
|
|
||||||
sprintf (p, "qTSTMat:");
|
xsnprintf (p, get_remote_packet_size (), "qTSTMat:");
|
||||||
p += strlen (p);
|
p += strlen (p);
|
||||||
p += hexnumstr (p, addr);
|
p += hexnumstr (p, addr);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
@ -3646,7 +3647,7 @@ remote_set_permissions (void)
|
|||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
|
||||||
sprintf (rs->buf, "QAllow:"
|
xsnprintf (rs->buf, get_remote_packet_size (), "QAllow:"
|
||||||
"WriteReg:%x;WriteMem:%x;"
|
"WriteReg:%x;WriteMem:%x;"
|
||||||
"InsertBreak:%x;InsertTrace:%x;"
|
"InsertBreak:%x;InsertTrace:%x;"
|
||||||
"InsertFastTrace:%x;Stop:%x",
|
"InsertFastTrace:%x;Stop:%x",
|
||||||
@ -4296,7 +4297,7 @@ remote_detach_1 (char *args, int from_tty, int extended)
|
|||||||
|
|
||||||
/* Tell the remote target to detach. */
|
/* Tell the remote target to detach. */
|
||||||
if (remote_multi_process_p (rs))
|
if (remote_multi_process_p (rs))
|
||||||
sprintf (rs->buf, "D;%x", pid);
|
xsnprintf (rs->buf, get_remote_packet_size (), "D;%x", pid);
|
||||||
else
|
else
|
||||||
strcpy (rs->buf, "D");
|
strcpy (rs->buf, "D");
|
||||||
|
|
||||||
@ -4378,7 +4379,7 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
|
|||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf (rs->buf, "vAttach;%x", pid);
|
xsnprintf (rs->buf, get_remote_packet_size (), "vAttach;%x", pid);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
|
|
||||||
@ -5856,7 +5857,7 @@ send_g_packet (void)
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
int buf_len;
|
int buf_len;
|
||||||
|
|
||||||
sprintf (rs->buf, "g");
|
xsnprintf (rs->buf, get_remote_packet_size (), "g");
|
||||||
remote_send (&rs->buf, &rs->buf_size);
|
remote_send (&rs->buf, &rs->buf_size);
|
||||||
|
|
||||||
/* We can get out of synch in various cases. If the first character
|
/* We can get out of synch in various cases. If the first character
|
||||||
@ -7521,7 +7522,7 @@ remote_vkill (int pid, struct remote_state *rs)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Tell the remote target to detach. */
|
/* Tell the remote target to detach. */
|
||||||
sprintf (rs->buf, "vKill;%x", pid);
|
xsnprintf (rs->buf, get_remote_packet_size (), "vKill;%x", pid);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
|
|
||||||
@ -7664,7 +7665,8 @@ extended_remote_disable_randomization (int val)
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *reply;
|
char *reply;
|
||||||
|
|
||||||
sprintf (rs->buf, "QDisableRandomization:%x", val);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QDisableRandomization:%x",
|
||||||
|
val);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (*reply == '\0')
|
if (*reply == '\0')
|
||||||
@ -7794,11 +7796,12 @@ extended_remote_create_inferior (struct target_ops *ops,
|
|||||||
/* Given a location's target info BP_TGT and the packet buffer BUF, output
|
/* Given a location's target info BP_TGT and the packet buffer BUF, output
|
||||||
the list of conditions (in agent expression bytecode format), if any, the
|
the list of conditions (in agent expression bytecode format), if any, the
|
||||||
target needs to evaluate. The output is placed into the packet buffer
|
target needs to evaluate. The output is placed into the packet buffer
|
||||||
BUF. */
|
started from BUF and ended at BUF_END. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remote_add_target_side_condition (struct gdbarch *gdbarch,
|
remote_add_target_side_condition (struct gdbarch *gdbarch,
|
||||||
struct bp_target_info *bp_tgt, char *buf)
|
struct bp_target_info *bp_tgt, char *buf,
|
||||||
|
char *buf_end)
|
||||||
{
|
{
|
||||||
struct agent_expr *aexpr = NULL;
|
struct agent_expr *aexpr = NULL;
|
||||||
int i, ix;
|
int i, ix;
|
||||||
@ -7809,7 +7812,7 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
buf += strlen (buf);
|
buf += strlen (buf);
|
||||||
sprintf (buf, "%s", ";");
|
xsnprintf (buf, buf_end - buf, "%s", ";");
|
||||||
buf++;
|
buf++;
|
||||||
|
|
||||||
/* Send conditions to the target and free the vector. */
|
/* Send conditions to the target and free the vector. */
|
||||||
@ -7817,7 +7820,7 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
|
|||||||
VEC_iterate (agent_expr_p, bp_tgt->conditions, ix, aexpr);
|
VEC_iterate (agent_expr_p, bp_tgt->conditions, ix, aexpr);
|
||||||
ix++)
|
ix++)
|
||||||
{
|
{
|
||||||
sprintf (buf, "X%x,", aexpr->len);
|
xsnprintf (buf, buf_end - buf, "X%x,", aexpr->len);
|
||||||
buf += strlen (buf);
|
buf += strlen (buf);
|
||||||
for (i = 0; i < aexpr->len; ++i)
|
for (i = 0; i < aexpr->len; ++i)
|
||||||
buf = pack_hex_byte (buf, aexpr->buf[i]);
|
buf = pack_hex_byte (buf, aexpr->buf[i]);
|
||||||
@ -7845,7 +7848,7 @@ remote_insert_breakpoint (struct gdbarch *gdbarch,
|
|||||||
{
|
{
|
||||||
CORE_ADDR addr = bp_tgt->placed_address;
|
CORE_ADDR addr = bp_tgt->placed_address;
|
||||||
struct remote_state *rs;
|
struct remote_state *rs;
|
||||||
char *p;
|
char *p, *endbuf;
|
||||||
int bpsize;
|
int bpsize;
|
||||||
struct condition_list *cond = NULL;
|
struct condition_list *cond = NULL;
|
||||||
|
|
||||||
@ -7853,16 +7856,17 @@ remote_insert_breakpoint (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
rs = get_remote_state ();
|
rs = get_remote_state ();
|
||||||
p = rs->buf;
|
p = rs->buf;
|
||||||
|
endbuf = rs->buf + get_remote_packet_size ();
|
||||||
|
|
||||||
*(p++) = 'Z';
|
*(p++) = 'Z';
|
||||||
*(p++) = '0';
|
*(p++) = '0';
|
||||||
*(p++) = ',';
|
*(p++) = ',';
|
||||||
addr = (ULONGEST) remote_address_masked (addr);
|
addr = (ULONGEST) remote_address_masked (addr);
|
||||||
p += hexnumstr (p, addr);
|
p += hexnumstr (p, addr);
|
||||||
sprintf (p, ",%d", bpsize);
|
xsnprintf (p, endbuf - p, ",%d", bpsize);
|
||||||
|
|
||||||
if (remote_supports_cond_breakpoints ())
|
if (remote_supports_cond_breakpoints ())
|
||||||
remote_add_target_side_condition (gdbarch, bp_tgt, p);
|
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -7893,6 +7897,7 @@ remote_remove_breakpoint (struct gdbarch *gdbarch,
|
|||||||
if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE)
|
if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE)
|
||||||
{
|
{
|
||||||
char *p = rs->buf;
|
char *p = rs->buf;
|
||||||
|
char *endbuf = rs->buf + get_remote_packet_size ();
|
||||||
|
|
||||||
*(p++) = 'z';
|
*(p++) = 'z';
|
||||||
*(p++) = '0';
|
*(p++) = '0';
|
||||||
@ -7900,7 +7905,7 @@ remote_remove_breakpoint (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address);
|
addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address);
|
||||||
p += hexnumstr (p, addr);
|
p += hexnumstr (p, addr);
|
||||||
sprintf (p, ",%d", bp_tgt->placed_size);
|
xsnprintf (p, endbuf - p, ",%d", bp_tgt->placed_size);
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -7936,17 +7941,18 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
|
|||||||
struct expression *cond)
|
struct expression *cond)
|
||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
char *endbuf = rs->buf + get_remote_packet_size ();
|
||||||
char *p;
|
char *p;
|
||||||
enum Z_packet_type packet = watchpoint_to_Z_packet (type);
|
enum Z_packet_type packet = watchpoint_to_Z_packet (type);
|
||||||
|
|
||||||
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
|
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
sprintf (rs->buf, "Z%x,", packet);
|
xsnprintf (rs->buf, endbuf - rs->buf, "Z%x,", packet);
|
||||||
p = strchr (rs->buf, '\0');
|
p = strchr (rs->buf, '\0');
|
||||||
addr = remote_address_masked (addr);
|
addr = remote_address_masked (addr);
|
||||||
p += hexnumstr (p, (ULONGEST) addr);
|
p += hexnumstr (p, (ULONGEST) addr);
|
||||||
sprintf (p, ",%x", len);
|
xsnprintf (p, endbuf - p, ",%x", len);
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -7979,17 +7985,18 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
|
|||||||
struct expression *cond)
|
struct expression *cond)
|
||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
char *endbuf = rs->buf + get_remote_packet_size ();
|
||||||
char *p;
|
char *p;
|
||||||
enum Z_packet_type packet = watchpoint_to_Z_packet (type);
|
enum Z_packet_type packet = watchpoint_to_Z_packet (type);
|
||||||
|
|
||||||
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
|
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sprintf (rs->buf, "z%x,", packet);
|
xsnprintf (rs->buf, endbuf - rs->buf, "z%x,", packet);
|
||||||
p = strchr (rs->buf, '\0');
|
p = strchr (rs->buf, '\0');
|
||||||
addr = remote_address_masked (addr);
|
addr = remote_address_masked (addr);
|
||||||
p += hexnumstr (p, (ULONGEST) addr);
|
p += hexnumstr (p, (ULONGEST) addr);
|
||||||
sprintf (p, ",%x", len);
|
xsnprintf (p, endbuf - p, ",%x", len);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
|
|
||||||
@ -8076,7 +8083,7 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
|
|||||||
{
|
{
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
struct remote_state *rs;
|
struct remote_state *rs;
|
||||||
char *p;
|
char *p, *endbuf;
|
||||||
|
|
||||||
/* The length field should be set to the size of a breakpoint
|
/* The length field should be set to the size of a breakpoint
|
||||||
instruction, even though we aren't inserting one ourselves. */
|
instruction, even though we aren't inserting one ourselves. */
|
||||||
@ -8089,6 +8096,7 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
rs = get_remote_state ();
|
rs = get_remote_state ();
|
||||||
p = rs->buf;
|
p = rs->buf;
|
||||||
|
endbuf = rs->buf + get_remote_packet_size ();
|
||||||
|
|
||||||
*(p++) = 'Z';
|
*(p++) = 'Z';
|
||||||
*(p++) = '1';
|
*(p++) = '1';
|
||||||
@ -8096,10 +8104,10 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
addr = remote_address_masked (bp_tgt->placed_address);
|
addr = remote_address_masked (bp_tgt->placed_address);
|
||||||
p += hexnumstr (p, (ULONGEST) addr);
|
p += hexnumstr (p, (ULONGEST) addr);
|
||||||
sprintf (p, ",%x", bp_tgt->placed_size);
|
xsnprintf (p, endbuf - p, ",%x", bp_tgt->placed_size);
|
||||||
|
|
||||||
if (remote_supports_cond_breakpoints ())
|
if (remote_supports_cond_breakpoints ())
|
||||||
remote_add_target_side_condition (gdbarch, bp_tgt, p);
|
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -8124,6 +8132,7 @@ remote_remove_hw_breakpoint (struct gdbarch *gdbarch,
|
|||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *p = rs->buf;
|
char *p = rs->buf;
|
||||||
|
char *endbuf = rs->buf + get_remote_packet_size ();
|
||||||
|
|
||||||
if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
|
if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
|
||||||
return -1;
|
return -1;
|
||||||
@ -8134,7 +8143,7 @@ remote_remove_hw_breakpoint (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
addr = remote_address_masked (bp_tgt->placed_address);
|
addr = remote_address_masked (bp_tgt->placed_address);
|
||||||
p += hexnumstr (p, (ULONGEST) addr);
|
p += hexnumstr (p, (ULONGEST) addr);
|
||||||
sprintf (p, ",%x", bp_tgt->placed_size);
|
xsnprintf (p, endbuf - p, ",%x", bp_tgt->placed_size);
|
||||||
|
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
@ -10112,10 +10121,11 @@ remote_download_command_source (int num, ULONGEST addr,
|
|||||||
static void
|
static void
|
||||||
remote_download_tracepoint (struct bp_location *loc)
|
remote_download_tracepoint (struct bp_location *loc)
|
||||||
{
|
{
|
||||||
|
#define BUF_SIZE 2048
|
||||||
|
|
||||||
CORE_ADDR tpaddr;
|
CORE_ADDR tpaddr;
|
||||||
char addrbuf[40];
|
char addrbuf[40];
|
||||||
char buf[2048];
|
char buf[BUF_SIZE];
|
||||||
char **tdp_actions;
|
char **tdp_actions;
|
||||||
char **stepping_actions;
|
char **stepping_actions;
|
||||||
int ndx;
|
int ndx;
|
||||||
@ -10134,7 +10144,7 @@ remote_download_tracepoint (struct bp_location *loc)
|
|||||||
|
|
||||||
tpaddr = loc->address;
|
tpaddr = loc->address;
|
||||||
sprintf_vma (addrbuf, tpaddr);
|
sprintf_vma (addrbuf, tpaddr);
|
||||||
sprintf (buf, "QTDP:%x:%s:%c:%lx:%x", b->number,
|
xsnprintf (buf, BUF_SIZE, "QTDP:%x:%s:%c:%lx:%x", b->number,
|
||||||
addrbuf, /* address */
|
addrbuf, /* address */
|
||||||
(b->enable_state == bp_enabled ? 'E' : 'D'),
|
(b->enable_state == bp_enabled ? 'E' : 'D'),
|
||||||
t->step_count, t->pass_count);
|
t->step_count, t->pass_count);
|
||||||
@ -10151,7 +10161,8 @@ remote_download_tracepoint (struct bp_location *loc)
|
|||||||
|
|
||||||
if (gdbarch_fast_tracepoint_valid_at (target_gdbarch,
|
if (gdbarch_fast_tracepoint_valid_at (target_gdbarch,
|
||||||
tpaddr, &isize, NULL))
|
tpaddr, &isize, NULL))
|
||||||
sprintf (buf + strlen (buf), ":F%x", isize);
|
xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
|
||||||
|
isize);
|
||||||
else
|
else
|
||||||
/* If it passed validation at definition but fails now,
|
/* If it passed validation at definition but fails now,
|
||||||
something is very wrong. */
|
something is very wrong. */
|
||||||
@ -10195,7 +10206,8 @@ remote_download_tracepoint (struct bp_location *loc)
|
|||||||
{
|
{
|
||||||
aexpr = gen_eval_for_expr (tpaddr, loc->cond);
|
aexpr = gen_eval_for_expr (tpaddr, loc->cond);
|
||||||
aexpr_chain = make_cleanup_free_agent_expr (aexpr);
|
aexpr_chain = make_cleanup_free_agent_expr (aexpr);
|
||||||
sprintf (buf + strlen (buf), ":X%x,", aexpr->len);
|
xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":X%x,",
|
||||||
|
aexpr->len);
|
||||||
pkt = buf + strlen (buf);
|
pkt = buf + strlen (buf);
|
||||||
for (ndx = 0; ndx < aexpr->len; ++ndx)
|
for (ndx = 0; ndx < aexpr->len; ++ndx)
|
||||||
pkt = pack_hex_byte (pkt, aexpr->buf[ndx]);
|
pkt = pack_hex_byte (pkt, aexpr->buf[ndx]);
|
||||||
@ -10220,7 +10232,7 @@ remote_download_tracepoint (struct bp_location *loc)
|
|||||||
for (ndx = 0; tdp_actions[ndx]; ndx++)
|
for (ndx = 0; tdp_actions[ndx]; ndx++)
|
||||||
{
|
{
|
||||||
QUIT; /* Allow user to bail out with ^C. */
|
QUIT; /* Allow user to bail out with ^C. */
|
||||||
sprintf (buf, "QTDP:-%x:%s:%s%c",
|
xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c",
|
||||||
b->number, addrbuf, /* address */
|
b->number, addrbuf, /* address */
|
||||||
tdp_actions[ndx],
|
tdp_actions[ndx],
|
||||||
((tdp_actions[ndx + 1] || stepping_actions)
|
((tdp_actions[ndx + 1] || stepping_actions)
|
||||||
@ -10237,7 +10249,7 @@ remote_download_tracepoint (struct bp_location *loc)
|
|||||||
for (ndx = 0; stepping_actions[ndx]; ndx++)
|
for (ndx = 0; stepping_actions[ndx]; ndx++)
|
||||||
{
|
{
|
||||||
QUIT; /* Allow user to bail out with ^C. */
|
QUIT; /* Allow user to bail out with ^C. */
|
||||||
sprintf (buf, "QTDP:-%x:%s:%s%s%s",
|
xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||||
b->number, addrbuf, /* address */
|
b->number, addrbuf, /* address */
|
||||||
((ndx == 0) ? "S" : ""),
|
((ndx == 0) ? "S" : ""),
|
||||||
stepping_actions[ndx],
|
stepping_actions[ndx],
|
||||||
@ -10307,8 +10319,9 @@ remote_download_trace_state_variable (struct trace_state_variable *tsv)
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
sprintf (rs->buf, "QTDV:%x:%s:%x:",
|
xsnprintf (rs->buf, get_remote_packet_size (), "QTDV:%x:%s:%x:",
|
||||||
tsv->number, phex ((ULONGEST) tsv->initial_value, 8), tsv->builtin);
|
tsv->number, phex ((ULONGEST) tsv->initial_value, 8),
|
||||||
|
tsv->builtin);
|
||||||
p = rs->buf + strlen (rs->buf);
|
p = rs->buf + strlen (rs->buf);
|
||||||
if ((p - rs->buf) + strlen (tsv->name) * 2 >= get_remote_packet_size ())
|
if ((p - rs->buf) + strlen (tsv->name) * 2 >= get_remote_packet_size ())
|
||||||
error (_("Trace state variable name too long for tsv definition packet"));
|
error (_("Trace state variable name too long for tsv definition packet"));
|
||||||
@ -10329,7 +10342,8 @@ remote_enable_tracepoint (struct bp_location *location)
|
|||||||
char addr_buf[40];
|
char addr_buf[40];
|
||||||
|
|
||||||
sprintf_vma (addr_buf, location->address);
|
sprintf_vma (addr_buf, location->address);
|
||||||
sprintf (rs->buf, "QTEnable:%x:%s", location->owner->number, addr_buf);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QTEnable:%x:%s",
|
||||||
|
location->owner->number, addr_buf);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
remote_get_noisy_reply (&rs->buf, &rs->buf_size);
|
remote_get_noisy_reply (&rs->buf, &rs->buf_size);
|
||||||
if (*rs->buf == '\0')
|
if (*rs->buf == '\0')
|
||||||
@ -10345,7 +10359,8 @@ remote_disable_tracepoint (struct bp_location *location)
|
|||||||
char addr_buf[40];
|
char addr_buf[40];
|
||||||
|
|
||||||
sprintf_vma (addr_buf, location->address);
|
sprintf_vma (addr_buf, location->address);
|
||||||
sprintf (rs->buf, "QTDisable:%x:%s", location->owner->number, addr_buf);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QTDisable:%x:%s",
|
||||||
|
location->owner->number, addr_buf);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
remote_get_noisy_reply (&rs->buf, &rs->buf_size);
|
remote_get_noisy_reply (&rs->buf, &rs->buf_size);
|
||||||
if (*rs->buf == '\0')
|
if (*rs->buf == '\0')
|
||||||
@ -10391,7 +10406,8 @@ remote_trace_set_readonly_regions (void)
|
|||||||
Too many sections for read-only sections definition packet."));
|
Too many sections for read-only sections definition packet."));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sprintf (target_buf + offset, ":%s,%s", tmp1, tmp2);
|
xsnprintf (target_buf + offset, target_buf_size - offset, ":%s,%s",
|
||||||
|
tmp1, tmp2);
|
||||||
offset += sec_length;
|
offset += sec_length;
|
||||||
}
|
}
|
||||||
if (anysecs)
|
if (anysecs)
|
||||||
@ -10464,6 +10480,7 @@ remote_get_tracepoint_status (struct breakpoint *bp,
|
|||||||
char *reply;
|
char *reply;
|
||||||
struct bp_location *loc;
|
struct bp_location *loc;
|
||||||
struct tracepoint *tp = (struct tracepoint *) bp;
|
struct tracepoint *tp = (struct tracepoint *) bp;
|
||||||
|
size_t size = get_remote_packet_size ();
|
||||||
|
|
||||||
if (tp)
|
if (tp)
|
||||||
{
|
{
|
||||||
@ -10475,7 +10492,7 @@ remote_get_tracepoint_status (struct breakpoint *bp,
|
|||||||
any status. */
|
any status. */
|
||||||
if (tp->number_on_target == 0)
|
if (tp->number_on_target == 0)
|
||||||
continue;
|
continue;
|
||||||
sprintf (rs->buf, "qTP:%x:%s", tp->number_on_target,
|
xsnprintf (rs->buf, size, "qTP:%x:%s", tp->number_on_target,
|
||||||
phex_nz (loc->address, 0));
|
phex_nz (loc->address, 0));
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
@ -10490,7 +10507,8 @@ remote_get_tracepoint_status (struct breakpoint *bp,
|
|||||||
{
|
{
|
||||||
utp->hit_count = 0;
|
utp->hit_count = 0;
|
||||||
utp->traceframe_usage = 0;
|
utp->traceframe_usage = 0;
|
||||||
sprintf (rs->buf, "qTP:%x:%s", utp->number, phex_nz (utp->addr, 0));
|
xsnprintf (rs->buf, size, "qTP:%x:%s", utp->number,
|
||||||
|
phex_nz (utp->addr, 0));
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (reply && *reply)
|
if (reply && *reply)
|
||||||
@ -10518,6 +10536,7 @@ remote_trace_find (enum trace_find_type type, int num,
|
|||||||
int *tpp)
|
int *tpp)
|
||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
char *endbuf = rs->buf + get_remote_packet_size ();
|
||||||
char *p, *reply;
|
char *p, *reply;
|
||||||
int target_frameno = -1, target_tracept = -1;
|
int target_frameno = -1, target_tracept = -1;
|
||||||
|
|
||||||
@ -10533,19 +10552,21 @@ remote_trace_find (enum trace_find_type type, int num,
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case tfind_number:
|
case tfind_number:
|
||||||
sprintf (p, "%x", num);
|
xsnprintf (p, endbuf - p, "%x", num);
|
||||||
break;
|
break;
|
||||||
case tfind_pc:
|
case tfind_pc:
|
||||||
sprintf (p, "pc:%s", phex_nz (addr1, 0));
|
xsnprintf (p, endbuf - p, "pc:%s", phex_nz (addr1, 0));
|
||||||
break;
|
break;
|
||||||
case tfind_tp:
|
case tfind_tp:
|
||||||
sprintf (p, "tdp:%x", num);
|
xsnprintf (p, endbuf - p, "tdp:%x", num);
|
||||||
break;
|
break;
|
||||||
case tfind_range:
|
case tfind_range:
|
||||||
sprintf (p, "range:%s:%s", phex_nz (addr1, 0), phex_nz (addr2, 0));
|
xsnprintf (p, endbuf - p, "range:%s:%s", phex_nz (addr1, 0),
|
||||||
|
phex_nz (addr2, 0));
|
||||||
break;
|
break;
|
||||||
case tfind_outside:
|
case tfind_outside:
|
||||||
sprintf (p, "outside:%s:%s", phex_nz (addr1, 0), phex_nz (addr2, 0));
|
xsnprintf (p, endbuf - p, "outside:%s:%s", phex_nz (addr1, 0),
|
||||||
|
phex_nz (addr2, 0));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error (_("Unknown trace find type %d"), type);
|
error (_("Unknown trace find type %d"), type);
|
||||||
@ -10600,7 +10621,7 @@ remote_get_trace_state_variable_value (int tsvnum, LONGEST *val)
|
|||||||
|
|
||||||
set_remote_traceframe ();
|
set_remote_traceframe ();
|
||||||
|
|
||||||
sprintf (rs->buf, "qTV:%x", tsvnum);
|
xsnprintf (rs->buf, get_remote_packet_size (), "qTV:%x", tsvnum);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (reply && *reply)
|
if (reply && *reply)
|
||||||
@ -10689,7 +10710,7 @@ remote_set_disconnected_tracing (int val)
|
|||||||
{
|
{
|
||||||
char *reply;
|
char *reply;
|
||||||
|
|
||||||
sprintf (rs->buf, "QTDisconnected:%x", val);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QTDisconnected:%x", val);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (*reply == '\0')
|
if (*reply == '\0')
|
||||||
@ -10717,7 +10738,7 @@ remote_set_circular_trace_buffer (int val)
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *reply;
|
char *reply;
|
||||||
|
|
||||||
sprintf (rs->buf, "QTBuffer:circular:%x", val);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QTBuffer:circular:%x", val);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (*reply == '\0')
|
if (*reply == '\0')
|
||||||
@ -10765,7 +10786,7 @@ remote_get_min_fast_tracepoint_insn_len (void)
|
|||||||
/* Make sure the remote is pointing at the right process. */
|
/* Make sure the remote is pointing at the right process. */
|
||||||
set_general_process ();
|
set_general_process ();
|
||||||
|
|
||||||
sprintf (rs->buf, "qTMinFTPILen");
|
xsnprintf (rs->buf, get_remote_packet_size (), "qTMinFTPILen");
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||||
if (*reply == '\0')
|
if (*reply == '\0')
|
||||||
@ -10833,7 +10854,7 @@ remote_use_agent (int use)
|
|||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
|
|
||||||
/* If the stub supports QAgent. */
|
/* If the stub supports QAgent. */
|
||||||
sprintf (rs->buf, "QAgent:%d", use);
|
xsnprintf (rs->buf, get_remote_packet_size (), "QAgent:%d", use);
|
||||||
putpkt (rs->buf);
|
putpkt (rs->buf);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user