remote_register_number_and_offset (struct gdbarch *gdbarch, int regnum,
int *pnum, int *poffset)
{
- int sizeof_g_packet;
struct packet_reg *regs;
struct cleanup *old_chain;
regs = XCNEWVEC (struct packet_reg, gdbarch_num_regs (gdbarch));
old_chain = make_cleanup (xfree, regs);
- sizeof_g_packet = map_regcache_remote_table (gdbarch, regs);
+ map_regcache_remote_table (gdbarch, regs);
*pnum = regs[regnum].pnum;
*poffset = regs[regnum].offset;
static int
remote_thread_always_alive (struct target_ops *ops, ptid_t ptid)
{
- struct remote_state *rs = get_remote_state ();
- char *p, *endp;
-
if (ptid_equal (ptid, magic_null_ptid))
/* The main thread is always alive. */
return 1;
static void
remote_update_thread_list (struct target_ops *ops)
{
- struct remote_state *rs = get_remote_state ();
struct threads_listing_context context;
struct cleanup *old_chain;
int got_list = 0;
that as current. */
ALL_NON_EXITED_THREADS (thread)
{
- struct target_waitstatus *ws;
-
if (first == NULL)
first = thread;
else if (thread->state != THREAD_STOPPED)
continue;
- ws = &thread->suspend.waitstatus;
-
if (selected == NULL
&& thread->suspend.waitstatus_pending_p)
selected = thread;
if (!target_is_non_stop_p ())
{
- ptid_t ptid;
- int fake_pid_p = 0;
- struct inferior *inf;
-
if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
{
if (!extended_p)
{
struct remote_state *rs = get_remote_state ();
char *msg, *reply, *tmp;
- struct bound_minimal_symbol sym;
int end;
struct cleanup *old_chain;
static void
discard_pending_stop_replies (struct inferior *inf)
{
- int i;
struct queue_iter_param param;
struct stop_reply *reply;
struct remote_state *rs = get_remote_state ();
stop_reply_match_ptid_and_ws, &ptid);
}
-/* Skip PACKET until the next semi-colon (or end of string). */
-
-static char *
-skip_to_semicolon (char *p)
-{
- while (*p != '\0' && *p != ';')
- p++;
- return p;
-}
-
/* Helper for remote_parse_stop_reply. Return nonzero if the substring
starting with P and ending with PEND matches PREFIX. */
/* The value part is documented as "must be empty",
though we ignore it, in case we ever decide to make
use of it in a backward compatible way. */
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else if (strprefix (p, p1, "hwbreak"))
{
error (_("Unexpected hwbreak stop reason"));
/* See above. */
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else if (strprefix (p, p1, "library"))
{
event->ws.kind = TARGET_WAITKIND_LOADED;
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else if (strprefix (p, p1, "replaylog"))
{
event->ws.kind = TARGET_WAITKIND_NO_HISTORY;
/* p1 will indicate "begin" or "end", but it makes
no difference for now, so ignore it. */
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else if (strprefix (p, p1, "core"))
{
else if (strprefix (p, p1, "vforkdone"))
{
event->ws.kind = TARGET_WAITKIND_VFORK_DONE;
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else if (strprefix (p, p1, "exec"))
{
else if (strprefix (p, p1, "create"))
{
event->ws.kind = TARGET_WAITKIND_THREAD_CREATED;
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
else
{
if (skipregs)
{
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
p++;
continue;
}
{
/* Not a number. Silently skip unknown optional
info. */
- p = skip_to_semicolon (p1 + 1);
+ p = strchrnul (p1 + 1, ';');
}
}
&& status->kind != TARGET_WAITKIND_SIGNALLED
&& status->kind != TARGET_WAITKIND_NO_RESUMED)
{
- struct remote_state *rs = get_remote_state ();
struct private_thread_info *remote_thr;
/* Expedited registers. */
status->value.sig = GDB_SIGNAL_0;
break;
case 'F': /* File-I/O request. */
+ /* GDB may access the inferior memory while handling the File-I/O
+ request, but we don't want GDB accessing memory while waiting
+ for a stop reply. See the comments in putpkt_binary. Set
+ waiting_for_stop_reply to 0 temporarily. */
+ rs->waiting_for_stop_reply = 0;
remote_fileio_request (buf, rs->ctrlc_pending_p);
rs->ctrlc_pending_p = 0;
+ /* GDB handled the File-I/O request, and the target is running
+ again. Keep waiting for events. */
+ rs->waiting_for_stop_reply = 1;
break;
case 'N': case 'T': case 'S': case 'X': case 'W':
{
int ch;
int tcount = 0;
char *p;
- char *message;
/* Catch cases like trying to read memory or listing threads while
we're waiting for a stop reply. The remote server wouldn't be
long *sizeof_buf,
int forever)
{
- int timed_out;
-
- timed_out = getpkt_sane (buf, sizeof_buf, forever);
+ getpkt_sane (buf, sizeof_buf, forever);
}
{
struct agent_expr *aexpr = NULL;
int i, ix;
- char *pkt;
- char *buf_start = buf;
if (VEC_empty (agent_expr_p, bp_tgt->conditions))
return 0;
struct remote_state *rs;
char *p, *endbuf;
int bpsize;
- struct condition_list *cond = NULL;
/* Make sure the remote is pointing at the right process, if
necessary. */
static int
remote_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
{
- struct remote_state *rs = get_remote_state ();
-
return (packet_support (PACKET_swbreak_feature) == PACKET_ENABLE);
}
static int
remote_supports_stopped_by_hw_breakpoint (struct target_ops *ops)
{
- struct remote_state *rs = get_remote_state ();
-
return (packet_support (PACKET_hwbreak_feature) == PACKET_ENABLE);
}
/* Only handle flash writes. */
if (writebuf != NULL)
{
- LONGEST xfered;
-
switch (object)
{
case TARGET_OBJECT_FLASH:
enum btrace_read_type type)
{
struct packet_config *packet = &remote_protocol_packets[PACKET_qXfer_btrace];
- struct remote_state *rs = get_remote_state ();
struct cleanup *cleanup;
const char *annex;
char *xml;
static void
remote_async_serial_handler (struct serial *scb, void *context)
{
- struct remote_state *rs = (struct remote_state *) context;
-
/* Don't propogate error information up to the client. Instead let
the client find out about the error by querying the target. */
inferior_event_handler (INF_REG_EVENT, NULL);
{
struct remote_state *rs = get_remote_state ();
size_t size = get_remote_packet_size ();
- char *p = rs->buf;
if (packet_support (PACKET_QThreadEvents) == PACKET_DISABLE)
return;
void
_initialize_remote (void)
{
- struct remote_state *rs;
struct cmd_list_element *cmd;
const char *cmd_name;