regcache_collect (r->regnum, regs + r->offset);
regcache_raw_collect (current_regcache, r->regnum, regs + r->offset);
remote_store_registers (int regnum){  struct remote_state *rs = get_remote_state ();  char *buf;  char *regs;  int i;  char *p;  set_thread (PIDGET (inferior_ptid), 1);  if (regnum >= 0)    {      switch (remote_protocol_P.support)	{	case PACKET_DISABLE:	  break;	case PACKET_ENABLE:	  if (store_register_using_P (regnum))	    return;	  else	    error ("Protocol error: P packet not recognized by stub");	case PACKET_SUPPORT_UNKNOWN:	  if (store_register_using_P (regnum))	    {	      /* The stub recognized the 'P' packet.  Remember this.  */	      remote_protocol_P.support = PACKET_ENABLE;	      return;	    }	  else	    {	      /* The stub does not support the 'P' packet.  Use 'G'	         instead, and don't try using 'P' in the future (it	         will just waste our time).  */	      remote_protocol_P.support = PACKET_DISABLE;	      break;	    }	}    }  /* Extract all the registers in the regcache copying them into a     local buffer.  */  {    int i;    regs = alloca (rs->sizeof_g_packet);    memset (regs, rs->sizeof_g_packet, 0);    for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)      {	struct packet_reg *r = &rs->regs[i];	if (r->in_g_packet)	  regcache_collect (r->regnum, regs + r->offset);      }  }  /* Command describes registers byte by byte,     each byte encoded as two hex characters.  */  buf = alloca (rs->remote_packet_size);  p = buf;  *p++ = 'G';  /* remote_prepare_to_store insures that register_bytes_found gets set.  */  bin2hex (regs, p, register_bytes_found);  remote_send (buf, (rs->remote_packet_size));}