* remote.c (struct remote_state): Add BUF and BUF_SIZE.
(init_remote_state): Initialize the new fields. (get_memory_packet_size): Update BUF and BUF_SIZE if necessary. (set_thread, remote_thread_alive, remote_unpack_thread_info_response) (remote_get_threadinfo, parse_threadlist_response) (remote_get_threadlist, remote_current_thread, remote_threads_info) (remote_threads_extra_info, extended_remote_restart, get_offsets) (remote_check_symbols, remote_open_1, remote_detach) (remove_vcont_probe, remote_vcont_resume, remote_resume) (remote_wait, remote_async_wait, fetch_register_using_p) (remote_fetch_registers, store_register_using_P) (remote_store_registers, check_binary_download, remote_write_bytes) (remote_read_bytes, remote_insert_breakpoint) (remote_remove_breakpoint, remote_insert_watchpoint) (remote_remove_watchpoint, remote_insert_hw_breakpoint) (remote_remove_hw_breakpoint, compare_sections_command) (remote_xfer_partial, remote_rcmd, packet_command) (remote_get_thread_local_address): Use the global incoming buffer instead of alloca or xmalloc. Limit outgoing packets to rs->remote_packet_size and incoming packets to rs->buf_size. Update calls to getpkt and remote_send. (remote_send): Take arguments by reference. (putpkt_binary): Eliminate junkbuf. Use skip_frame. (skip_frame): New function. (read_frame): Take arguments by reference. Expand the packet buffer instead of issuing an error. (getpkt, getpkt_sane): Take arguments by reference. * remote.h (getpkt): Update prototype and doc. * tracepoint.c (remote_get_noisy_reply): Take arguments by reference. (target_buf): Change from array to pointer. (target_buf_size): New variable. (remote_set_transparent_ranges): Update call to getpkt. (trace_start_command, trace_stop_command, trace_status_command): Update calls to remote_get_noisy_reply. (finish_tfind_command): Take arguments by reference. (trace_find_command, trace_find_pc_command) (trace_find_tracepoint_command, trace_find_line_command): (trace_find_range_command, trace_find_outside_command): Update calls to finish_tfind_command. (_initialize_tracepoint): Initialize target_buf_size and target_buf.
This commit is contained in:
parent
bd717df8b1
commit
6d820c5c12
4 changed files with 322 additions and 222 deletions
|
@ -1,3 +1,47 @@
|
|||
2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* remote.c (struct remote_state): Add BUF and BUF_SIZE.
|
||||
(init_remote_state): Initialize the new fields.
|
||||
(get_memory_packet_size): Update BUF and BUF_SIZE if necessary.
|
||||
(set_thread, remote_thread_alive, remote_unpack_thread_info_response)
|
||||
(remote_get_threadinfo, parse_threadlist_response)
|
||||
(remote_get_threadlist, remote_current_thread, remote_threads_info)
|
||||
(remote_threads_extra_info, extended_remote_restart, get_offsets)
|
||||
(remote_check_symbols, remote_open_1, remote_detach)
|
||||
(remove_vcont_probe, remote_vcont_resume, remote_resume)
|
||||
(remote_wait, remote_async_wait, fetch_register_using_p)
|
||||
(remote_fetch_registers, store_register_using_P)
|
||||
(remote_store_registers, check_binary_download, remote_write_bytes)
|
||||
(remote_read_bytes, remote_insert_breakpoint)
|
||||
(remote_remove_breakpoint, remote_insert_watchpoint)
|
||||
(remote_remove_watchpoint, remote_insert_hw_breakpoint)
|
||||
(remote_remove_hw_breakpoint, compare_sections_command)
|
||||
(remote_xfer_partial, remote_rcmd, packet_command)
|
||||
(remote_get_thread_local_address): Use the global incoming buffer
|
||||
instead of alloca or xmalloc. Limit outgoing packets to
|
||||
rs->remote_packet_size and incoming packets to rs->buf_size.
|
||||
Update calls to getpkt and remote_send.
|
||||
(remote_send): Take arguments by reference.
|
||||
(putpkt_binary): Eliminate junkbuf. Use skip_frame.
|
||||
(skip_frame): New function.
|
||||
(read_frame): Take arguments by reference. Expand the packet
|
||||
buffer instead of issuing an error.
|
||||
(getpkt, getpkt_sane): Take arguments by reference.
|
||||
* remote.h (getpkt): Update prototype and doc.
|
||||
* tracepoint.c (remote_get_noisy_reply): Take arguments by
|
||||
reference.
|
||||
(target_buf): Change from array to pointer.
|
||||
(target_buf_size): New variable.
|
||||
(remote_set_transparent_ranges): Update call to getpkt.
|
||||
(trace_start_command, trace_stop_command, trace_status_command):
|
||||
Update calls to remote_get_noisy_reply.
|
||||
(finish_tfind_command): Take arguments by reference.
|
||||
(trace_find_command, trace_find_pc_command)
|
||||
(trace_find_tracepoint_command, trace_find_line_command):
|
||||
(trace_find_range_command, trace_find_outside_command): Update
|
||||
calls to finish_tfind_command.
|
||||
(_initialize_tracepoint): Initialize target_buf_size and target_buf.
|
||||
|
||||
2005-03-30 Randolph Chung <tausq@debian.org>
|
||||
|
||||
* hppa-linux-tdep.c: Include regset.h.
|
||||
|
|
439
gdb/remote.c
439
gdb/remote.c
File diff suppressed because it is too large
Load diff
|
@ -24,11 +24,12 @@
|
|||
/* FIXME?: move this interface down to tgt vector) */
|
||||
|
||||
/* Read a packet from the remote machine, with error checking, and
|
||||
store it in BUF. BUF is expected to be of size PBUFSIZ. If
|
||||
FOREVER, wait forever rather than timing out; this is used while
|
||||
the target is executing user code. */
|
||||
store it in *BUF. Resize *BUF using xrealloc if necessary to hold
|
||||
the result, and update *SIZEOF_BUF. If FOREVER, wait forever
|
||||
rather than timing out; this is used (in synchronous mode) to wait
|
||||
for a target that is is executing user code to stop. */
|
||||
|
||||
extern void getpkt (char *buf, long sizeof_buf, int forever);
|
||||
extern void getpkt (char **buf, long *sizeof_buf, int forever);
|
||||
|
||||
/* Send a packet to the remote machine, with error checking. The data
|
||||
of the packet is in BUF. The string in BUF can be at most PBUFSIZ
|
||||
|
|
|
@ -194,13 +194,15 @@ trace_error (char *buf)
|
|||
|
||||
/* Utility: wait for reply from stub, while accepting "O" packets. */
|
||||
static char *
|
||||
remote_get_noisy_reply (char *buf,
|
||||
long sizeof_buf)
|
||||
remote_get_noisy_reply (char **buf_p,
|
||||
long *sizeof_buf)
|
||||
{
|
||||
do /* Loop on reply from remote stub. */
|
||||
{
|
||||
char *buf;
|
||||
QUIT; /* allow user to bail out with ^C */
|
||||
getpkt (buf, sizeof_buf, 0);
|
||||
getpkt (buf_p, sizeof_buf, 0);
|
||||
buf = *buf_p;
|
||||
if (buf[0] == 0)
|
||||
error (_("Target does not support this command."));
|
||||
else if (buf[0] == 'E')
|
||||
|
@ -1700,7 +1702,8 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
|
|||
collect->next_aexpr_elt++;
|
||||
}
|
||||
|
||||
static char target_buf[2048];
|
||||
static char *target_buf;
|
||||
static long target_buf_size;
|
||||
|
||||
/* Set "transparent" memory ranges
|
||||
|
||||
|
@ -1742,7 +1745,7 @@ remote_set_transparent_ranges (void)
|
|||
if (anysecs)
|
||||
{
|
||||
putpkt (target_buf);
|
||||
getpkt (target_buf, sizeof (target_buf), 0);
|
||||
getpkt (&target_buf, &target_buf_size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1768,7 +1771,7 @@ trace_start_command (char *args, int from_tty)
|
|||
if (target_is_remote ())
|
||||
{
|
||||
putpkt ("QTinit");
|
||||
remote_get_noisy_reply (target_buf, sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Target does not support this command."));
|
||||
|
||||
|
@ -1785,7 +1788,7 @@ trace_start_command (char *args, int from_tty)
|
|||
if (t->actions)
|
||||
strcat (buf, "-");
|
||||
putpkt (buf);
|
||||
remote_get_noisy_reply (target_buf, sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Target does not support tracepoints."));
|
||||
|
||||
|
@ -1809,8 +1812,8 @@ trace_start_command (char *args, int from_tty)
|
|||
((tdp_actions[ndx + 1] || stepping_actions)
|
||||
? '-' : 0));
|
||||
putpkt (buf);
|
||||
remote_get_noisy_reply (target_buf,
|
||||
sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf,
|
||||
&target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
}
|
||||
|
@ -1826,8 +1829,8 @@ trace_start_command (char *args, int from_tty)
|
|||
stepping_actions[ndx],
|
||||
(stepping_actions[ndx + 1] ? "-" : ""));
|
||||
putpkt (buf);
|
||||
remote_get_noisy_reply (target_buf,
|
||||
sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf,
|
||||
&target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
}
|
||||
|
@ -1840,7 +1843,7 @@ trace_start_command (char *args, int from_tty)
|
|||
remote_set_transparent_ranges ();
|
||||
/* Now insert traps and begin collecting data. */
|
||||
putpkt ("QTStart");
|
||||
remote_get_noisy_reply (target_buf, sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Bogus reply from target: %s"), target_buf);
|
||||
set_traceframe_num (-1); /* All old traceframes invalidated. */
|
||||
|
@ -1862,7 +1865,7 @@ trace_stop_command (char *args, int from_tty)
|
|||
if (target_is_remote ())
|
||||
{
|
||||
putpkt ("QTStop");
|
||||
remote_get_noisy_reply (target_buf, sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||
if (strcmp (target_buf, "OK"))
|
||||
error (_("Bogus reply from target: %s"), target_buf);
|
||||
trace_running_p = 0;
|
||||
|
@ -1882,7 +1885,7 @@ trace_status_command (char *args, int from_tty)
|
|||
if (target_is_remote ())
|
||||
{
|
||||
putpkt ("qTStatus");
|
||||
remote_get_noisy_reply (target_buf, sizeof (target_buf));
|
||||
remote_get_noisy_reply (&target_buf, &target_buf_size);
|
||||
|
||||
if (target_buf[0] != 'T' ||
|
||||
(target_buf[1] != '0' && target_buf[1] != '1'))
|
||||
|
@ -1897,8 +1900,8 @@ trace_status_command (char *args, int from_tty)
|
|||
|
||||
/* Worker function for the various flavors of the tfind command. */
|
||||
static void
|
||||
finish_tfind_command (char *msg,
|
||||
long sizeof_msg,
|
||||
finish_tfind_command (char **msg,
|
||||
long *sizeof_msg,
|
||||
int from_tty)
|
||||
{
|
||||
int target_frameno = -1, target_tracept = -1;
|
||||
|
@ -1909,7 +1912,7 @@ finish_tfind_command (char *msg,
|
|||
old_frame_addr = get_frame_base (get_current_frame ());
|
||||
old_func = find_pc_function (read_pc ());
|
||||
|
||||
putpkt (msg);
|
||||
putpkt (*msg);
|
||||
reply = remote_get_noisy_reply (msg, sizeof_msg);
|
||||
|
||||
while (reply && *reply)
|
||||
|
@ -2054,7 +2057,7 @@ trace_find_command (char *args, int from_tty)
|
|||
error (_("invalid input (%d is less than zero)"), frameno);
|
||||
|
||||
sprintf (target_buf, "QTFrame:%x", frameno);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
|
||||
finish_tfind_command (&target_buf, &target_buf_size, from_tty);
|
||||
}
|
||||
else
|
||||
error (_("Trace can only be run on remote targets."));
|
||||
|
@ -2097,7 +2100,7 @@ trace_find_pc_command (char *args, int from_tty)
|
|||
|
||||
sprintf_vma (tmp, pc);
|
||||
sprintf (target_buf, "QTFrame:pc:%s", tmp);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
|
||||
finish_tfind_command (&target_buf, &target_buf_size, from_tty);
|
||||
}
|
||||
else
|
||||
error (_("Trace can only be run on remote targets."));
|
||||
|
@ -2122,7 +2125,7 @@ trace_find_tracepoint_command (char *args, int from_tty)
|
|||
tdp = parse_and_eval_long (args);
|
||||
|
||||
sprintf (target_buf, "QTFrame:tdp:%x", tdp);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
|
||||
finish_tfind_command (&target_buf, &target_buf_size, from_tty);
|
||||
}
|
||||
else
|
||||
error (_("Trace can only be run on remote targets."));
|
||||
|
@ -2220,7 +2223,7 @@ trace_find_line_command (char *args, int from_tty)
|
|||
else
|
||||
sprintf (target_buf, "QTFrame:outside:%s:%s",
|
||||
startpc_str, endpc_str);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf),
|
||||
finish_tfind_command (&target_buf, &target_buf_size,
|
||||
from_tty);
|
||||
do_cleanups (old_chain);
|
||||
}
|
||||
|
@ -2261,7 +2264,7 @@ trace_find_range_command (char *args, int from_tty)
|
|||
sprintf_vma (start_str, start);
|
||||
sprintf_vma (stop_str, stop);
|
||||
sprintf (target_buf, "QTFrame:range:%s:%s", start_str, stop_str);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
|
||||
finish_tfind_command (&target_buf, &target_buf_size, from_tty);
|
||||
}
|
||||
else
|
||||
error (_("Trace can only be run on remote targets."));
|
||||
|
@ -2300,7 +2303,7 @@ trace_find_outside_command (char *args, int from_tty)
|
|||
sprintf_vma (start_str, start);
|
||||
sprintf_vma (stop_str, stop);
|
||||
sprintf (target_buf, "QTFrame:outside:%s:%s", start_str, stop_str);
|
||||
finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
|
||||
finish_tfind_command (&target_buf, &target_buf_size, from_tty);
|
||||
}
|
||||
else
|
||||
error (_("Trace can only be run on remote targets."));
|
||||
|
@ -2867,4 +2870,7 @@ Do \"help tracepoints\" for info on other tracepoint commands."));
|
|||
add_com_alias ("tr", "trace", class_alias, 1);
|
||||
add_com_alias ("tra", "trace", class_alias, 1);
|
||||
add_com_alias ("trac", "trace", class_alias, 1);
|
||||
|
||||
target_buf_size = 2048;
|
||||
target_buf = xmalloc (target_buf_size);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue