static struct inferior *
remote_add_inferior (int pid, int attached)
{
- struct remote_state *rs = get_remote_state ();
struct inferior *inf;
/* Check whether this process we're learning about is to be
static void
remote_notice_new_inferior (ptid_t currthread, int running)
{
- struct remote_state *rs = get_remote_state ();
-
/* If this is a new thread, add it to GDB's thread list.
If we leave it up to WFI to do this, bad things will happen. */
remote_thread_alive (struct target_ops *ops, ptid_t ptid)
{
struct remote_state *rs = get_remote_state ();
- int tid = ptid_get_tid (ptid);
char *p, *endp;
if (ptid_equal (ptid, magic_null_ptid))
char *p = buf;
char *pp;
ULONGEST pid = 0, tid = 0;
- ptid_t ptid;
if (*p == 'p')
{
remote_current_thread (ptid_t oldpid)
{
struct remote_state *rs = get_remote_state ();
- char *p = rs->buf;
- int tid;
- int pid;
putpkt ("qC");
getpkt (&rs->buf, &rs->buf_size, 0);
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
char *endp = rs->buf + get_remote_packet_size ();
- struct stop_reply *reply, *next;
if (remote_protocol_packets[PACKET_vCont].support == PACKET_SUPPORT_UNKNOWN)
remote_vcont_probe (rs);
switch (buf[0])
{
case 'T': /* Status with PC, SP, FP, ... */
- {
- gdb_byte regs[MAX_REGISTER_SIZE];
-
- /* Expedited reply, containing Signal, {regno, reg} repeat. */
- /* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
- ss = signal number
- n... = register number
- r... = register contents
- */
-
- p = &buf[3]; /* after Txx */
- while (*p)
- {
- char *p1;
- char *p_temp;
- int fieldsize;
- LONGEST pnum = 0;
+ /* Expedited reply, containing Signal, {regno, reg} repeat. */
+ /* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
+ ss = signal number
+ n... = register number
+ r... = register contents
+ */
+
+ p = &buf[3]; /* after Txx */
+ while (*p)
+ {
+ char *p1;
+ char *p_temp;
+ int fieldsize;
+ LONGEST pnum = 0;
- /* If the packet contains a register number, save it in
- pnum and set p1 to point to the character following it.
- Otherwise p1 points to p. */
+ /* If the packet contains a register number, save it in
+ pnum and set p1 to point to the character following it.
+ Otherwise p1 points to p. */
- /* If this packet is an awatch packet, don't parse the 'a'
- as a register number. */
+ /* If this packet is an awatch packet, don't parse the 'a'
+ as a register number. */
- if (strncmp (p, "awatch", strlen("awatch")) != 0)
- {
- /* Read the ``P'' register number. */
- pnum = strtol (p, &p_temp, 16);
- p1 = p_temp;
- }
- else
- p1 = p;
+ if (strncmp (p, "awatch", strlen("awatch")) != 0)
+ {
+ /* Read the ``P'' register number. */
+ pnum = strtol (p, &p_temp, 16);
+ p1 = p_temp;
+ }
+ else
+ p1 = p;
- if (p1 == p) /* No register number present here. */
- {
- p1 = strchr (p, ':');
- if (p1 == NULL)
- error (_("Malformed packet(a) (missing colon): %s\n\
+ if (p1 == p) /* No register number present here. */
+ {
+ p1 = strchr (p, ':');
+ if (p1 == NULL)
+ error (_("Malformed packet(a) (missing colon): %s\n\
Packet: '%s'\n"),
- p, buf);
- if (strncmp (p, "thread", p1 - p) == 0)
- event->ptid = read_ptid (++p1, &p);
- else if ((strncmp (p, "watch", p1 - p) == 0)
- || (strncmp (p, "rwatch", p1 - p) == 0)
- || (strncmp (p, "awatch", p1 - p) == 0))
- {
- event->stopped_by_watchpoint_p = 1;
- p = unpack_varlen_hex (++p1, &addr);
- event->watch_data_address = (CORE_ADDR) addr;
- }
- else if (strncmp (p, "library", p1 - p) == 0)
- {
- p1++;
- p_temp = p1;
- while (*p_temp && *p_temp != ';')
- p_temp++;
+ p, buf);
+ if (strncmp (p, "thread", p1 - p) == 0)
+ event->ptid = read_ptid (++p1, &p);
+ else if ((strncmp (p, "watch", p1 - p) == 0)
+ || (strncmp (p, "rwatch", p1 - p) == 0)
+ || (strncmp (p, "awatch", p1 - p) == 0))
+ {
+ event->stopped_by_watchpoint_p = 1;
+ p = unpack_varlen_hex (++p1, &addr);
+ event->watch_data_address = (CORE_ADDR) addr;
+ }
+ else if (strncmp (p, "library", p1 - p) == 0)
+ {
+ p1++;
+ p_temp = p1;
+ while (*p_temp && *p_temp != ';')
+ p_temp++;
- event->solibs_changed = 1;
+ event->solibs_changed = 1;
+ p = p_temp;
+ }
+ else if (strncmp (p, "replaylog", p1 - p) == 0)
+ {
+ /* NO_HISTORY event.
+ p1 will indicate "begin" or "end", but
+ it makes no difference for now, so ignore it. */
+ event->replay_event = 1;
+ p_temp = strchr (p1 + 1, ';');
+ if (p_temp)
p = p_temp;
- }
- else if (strncmp (p, "replaylog", p1 - p) == 0)
- {
- /* NO_HISTORY event.
- p1 will indicate "begin" or "end", but
- it makes no difference for now, so ignore it. */
- event->replay_event = 1;
- p_temp = strchr (p1 + 1, ';');
- if (p_temp)
- p = p_temp;
- }
- else
- {
- /* Silently skip unknown optional info. */
- p_temp = strchr (p1 + 1, ';');
- if (p_temp)
- p = p_temp;
- }
- }
- else
- {
- struct packet_reg *reg = packet_reg_from_pnum (rsa, pnum);
- cached_reg_t cached_reg;
+ }
+ else
+ {
+ /* Silently skip unknown optional info. */
+ p_temp = strchr (p1 + 1, ';');
+ if (p_temp)
+ p = p_temp;
+ }
+ }
+ else
+ {
+ struct packet_reg *reg = packet_reg_from_pnum (rsa, pnum);
+ cached_reg_t cached_reg;
- p = p1;
+ p = p1;
- if (*p != ':')
- error (_("Malformed packet(b) (missing colon): %s\n\
+ if (*p != ':')
+ error (_("Malformed packet(b) (missing colon): %s\n\
Packet: '%s'\n"),
- p, buf);
- ++p;
+ p, buf);
+ ++p;
- if (reg == NULL)
- error (_("Remote sent bad register number %s: %s\n\
+ if (reg == NULL)
+ error (_("Remote sent bad register number %s: %s\n\
Packet: '%s'\n"),
- phex_nz (pnum, 0), p, buf);
+ phex_nz (pnum, 0), p, buf);
- cached_reg.num = reg->regnum;
+ cached_reg.num = reg->regnum;
- fieldsize = hex2bin (p, cached_reg.data,
- register_size (target_gdbarch,
- reg->regnum));
- p += 2 * fieldsize;
- if (fieldsize < register_size (target_gdbarch,
- reg->regnum))
- warning (_("Remote reply is too short: %s"), buf);
+ fieldsize = hex2bin (p, cached_reg.data,
+ register_size (target_gdbarch,
+ reg->regnum));
+ p += 2 * fieldsize;
+ if (fieldsize < register_size (target_gdbarch,
+ reg->regnum))
+ warning (_("Remote reply is too short: %s"), buf);
- VEC_safe_push (cached_reg_t, event->regcache, &cached_reg);
- }
+ VEC_safe_push (cached_reg_t, event->regcache, &cached_reg);
+ }
- if (*p != ';')
- error (_("Remote register badly formatted: %s\nhere: %s"),
- buf, p);
- ++p;
- }
- }
+ if (*p != ';')
+ error (_("Remote register badly formatted: %s\nhere: %s"),
+ buf, p);
+ ++p;
+ }
/* fall through */
case 'S': /* Old style status, just signal only. */
if (event->solibs_changed)
remote_get_pending_stop_replies (void)
{
struct remote_state *rs = get_remote_state ();
- int ret;
if (pending_stop_reply)
{
remote_wait_ns (ptid_t ptid, struct target_waitstatus *status, int options)
{
struct remote_state *rs = get_remote_state ();
- struct remote_arch_state *rsa = get_remote_arch_state ();
- ptid_t event_ptid = null_ptid;
struct stop_reply *stop_reply;
int ret;
remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
{
struct remote_state *rs = get_remote_state ();
- struct remote_arch_state *rsa = get_remote_arch_state ();
ptid_t event_ptid = null_ptid;
- ULONGEST addr;
- int solibs_changed = 0;
- char *buf, *p;
+ char *buf;
struct stop_reply *stop_reply;
again:
send_g_packet (void)
{
struct remote_state *rs = get_remote_state ();
- int i, buf_len;
- char *p;
- char *regs;
+ int buf_len;
sprintf (rs->buf, "g");
remote_send (&rs->buf, &rs->buf_size);
remote_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
- struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct remote_state *rs = get_remote_state ();
- struct remote_arch_state *rsa = get_remote_arch_state ();
/* Try storing a single register. */
char *buf = rs->buf;
gdb_byte regp[MAX_REGISTER_SIZE];
remote_store_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
- struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
extended_remote_run (char *args)
{
struct remote_state *rs = get_remote_state ();
- char *p;
int len;
/* If the user has disabled vRun support, or we have detected that
{
CORE_ADDR addr = bp_tgt->placed_address;
struct remote_state *rs = get_remote_state ();
- int bp_size;
if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE)
{
{
int i, buf_len;
ULONGEST n;
- gdb_byte *wbuf;
struct remote_state *rs = get_remote_state ();
int max_size = get_memory_write_packet_size ();
static ULONGEST finished_offset;
struct remote_state *rs = get_remote_state ();
- unsigned int total = 0;
LONGEST i, n, packet_len;
if (packet->support == PACKET_DISABLE)
remote_file_get (const char *remote_file, const char *local_file, int from_tty)
{
struct cleanup *back_to, *close_cleanup;
- int retcode, fd, remote_errno, bytes, io_size;
+ int fd, remote_errno, bytes, io_size;
FILE *file;
gdb_byte *buffer;
ULONGEST offset;