Esempio n. 1
0
static void
hms_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
  int regno;

  if (regnamelen != 2)
    return;
  if (regname[0] != 'P')
    return;
  /* We scan off all the registers in one go */

  val = monitor_supply_register (PC_REGNUM, val);
  /* Skip the ccr string */
  while (*val != '=' && *val)
    val++;

  val = monitor_supply_register (CCR_REGNUM, val + 1);

  /* Skip up to rest of regs */
  while (*val != '=' && *val)
    val++;

  for (regno = 0; regno < 7; regno++)
    {
      val = monitor_supply_register (regno, val + 1);
    }
}
Esempio n. 2
0
static void
dbug_supply_register (struct regcache *regcache, char *regname,
		      int regnamelen, char *val, int vallen)
{
  int regno;
  struct gdbarch *gdbarch = get_regcache_arch (regcache);

  if (regnamelen != 2)
    return;

  switch (regname[0])
    {
    case 'S':
      if (regname[1] != 'R')
	return;
      regno = gdbarch_ps_regnum (gdbarch);
      break;
    case 'P':
      if (regname[1] != 'C')
	return;
      regno = gdbarch_pc_regnum (gdbarch);
      break;
    case 'D':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + M68K_D0_REGNUM;
      break;
    case 'A':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + M68K_A0_REGNUM;
      break;
    default:
      return;
    }

  monitor_supply_register (regcache, regno, val);
}
Esempio n. 3
0
static void
dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
  int regno;

  if (regnamelen != 2)
    return;

  switch (regname[0])
    {
    case 'S':
      if (regname[1] != 'R')
	return;
      regno = PS_REGNUM;
      break;
    case 'P':
      if (regname[1] != 'C')
	return;
      regno = PC_REGNUM;
      break;
    case 'D':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + D0_REGNUM;
      break;
    case 'A':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + A0_REGNUM;
      break;
    default:
      return;
    }

  monitor_supply_register (regno, val);
}
Esempio n. 4
0
static void
ppcbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
  int regno = 0;

  if (regnamelen < 2 || regnamelen > 4)
    return;

  switch (regname[0])
    {
    case 'R':
      if (regname[1] < '0' || regname[1] > '9')
	return;
      if (regnamelen == 2)
	regno = regname[1] - '0';
      else if (regnamelen == 3 && regname[2] >= '0' && regname[2] <= '9')
	regno = (regname[1] - '0') * 10 + (regname[2] - '0');
      else
	return;
      break;
    case 'F':
      if (regname[1] != 'R' || regname[2] < '0' || regname[2] > '9')
	return;
      if (regnamelen == 3)
	regno = 32 + regname[2] - '0';
      else if (regnamelen == 4 && regname[3] >= '0' && regname[3] <= '9')
	regno = 32 + (regname[2] - '0') * 10 + (regname[3] - '0');
      else
	return;
      break;
    case 'I':
      if (regnamelen != 2 || regname[1] != 'P')
	return;
      regno = 64;
      break;
    case 'M':
      if (regnamelen != 3 || regname[1] != 'S' || regname[2] != 'R')
	return;
      regno = 65;
      break;
    case 'C':
      if (regnamelen != 2 || regname[1] != 'R')
	return;
      regno = 66;
      break;
    case 'S':
      if (regnamelen != 4 || regname[1] != 'P' || regname[2] != 'R')
	return;
      else if (regname[3] == '8')
	regno = 67;
      else if (regname[3] == '9')
	regno = 68;
      else if (regname[3] == '1')
	regno = 69;
      else if (regname[3] == '0')
	regno = 70;
      else
	return;
      break;
    default:
      return;
    }

  monitor_supply_register (regno, val);
}
static int
picobug_dumpregs (struct regcache *regcache)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  char buf[1024];
  int resp_len;
  char *p;

  /* Send the dump register command to the monitor and
     get the reply.  */
  monitor_printf (picobug_cmds.dump_registers);
  resp_len = monitor_expect_prompt (buf, sizeof (buf));

  p = strtok (buf, " \t\r\n");
  while (p)
    {
      if (strchr (p, '-'))
	{
	  /* Got a range.  Either r0-r7, r8-r15 or ss0-ss4.  */
	  if (strncmp (p, "r0", 2) == 0 || strncmp (p, "r8", 2) == 0)
	    {
	      int rn = (p[1] == '0' ? 0 : 8);
	      int i = 0;

	      /* Get the next 8 values and record them.  */
	      while (i < 8)
		{
		  p = strtok (NULL, " \t\r\n");
		  if (p)
		    monitor_supply_register (regcache, rn + i, p);
		  i++;
		}
	    }
	  else if (strncmp (p, "ss", 2) == 0)
	    {
	      /* Get the next five values, ignoring the first.  */
	      int rn;
	      p = strtok (NULL, " \t\r\n");
	      for (rn = 39; rn < 43; rn++)
		{
		  p = strtok (NULL, " \t\r\n");
		  if (p)
		    monitor_supply_register (regcache, rn, p);
		}
	    }
	  else
	    {
	      break;
	    }
	}
      else
	{
	  /* Simple register type, paired.  */
	  char *name = p;
	  int i;

	  /* Get and record value.  */
	  p = strtok (NULL, " \t\r\n");
	  if (p)
	    {
	      for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
		{
		  if (picobug_regnames[i]
		      && strcmp (picobug_regnames[i], name) == 0)
		    break;
		}

	      if (i <= gdbarch_num_regs (gdbarch))
		monitor_supply_register (regcache, i, p);
	    }
	}
      p = strtok (NULL, " \t\r\n");
    }

  return 0;
}
Esempio n. 6
0
static void
w89k_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
  int numregs;
  int regno;

  numregs = 1;
  regno = -1;

  if (regnamelen == 2)
    switch (regname[0])
      {
      case 'r':
	numregs = 4;
	switch (regname[1])
	  {
	  case '0':
	    regno = R0_REGNUM;
	    break;
	  case '4':
	    regno = R0_REGNUM + 4;
	    break;
	  case '8':
	    regno = R0_REGNUM + 8;
	    break;
	  }
	break;
      case 'P':
	if (regname[1] == 'C')
	  regno = PC_REGNUM;
	break;
      }
  else if (regnamelen == 3)
    switch (regname[0])
      {
      case 'r':
	numregs = 4;
	if (regname[1] == '1' && regname[2] == '2')
	  regno = R0_REGNUM + 12;
	else if (regname[1] == '1' && regname[2] == '6')
	  regno = R0_REGNUM + 16;
	else if (regname[1] == '2' && regname[2] == '0')
	  regno = R0_REGNUM + 20;
	else if (regname[1] == '2' && regname[2] == '4')
	  regno = R0_REGNUM + 24;
	else if (regname[1] == '2' && regname[2] == '8')
	  regno = R0_REGNUM + 28;
	break;
      case 'R':
	if (regname[1] == 'C' && regname[2] == 'R')
	  regno = RCR_REGNUM;
	break;
      case 'C':
	if (regname[1] == 'C' && regname[2] == 'R')
	  regno = CCR_REGNUM;
	break;
      case 'S':
	if (regname[1] == 'A' && regname[2] == 'R')
	  regno = SAR_REGNUM;
	break;
      case 'I':
	if (regname[1] == 'I' && regname[2] == 'R')
	  regno = IIR_REGNUM;
	else if (regname[1] == 'O' && regname[2] == 'R')
	  regno = IOR_REGNUM;
	break;
      case 'T':
	numregs = 4;
	if (regname[1] == 'R')
	  if (regname[2] == '0')
	    regno = TR0_REGNUM;
	  else if (regname[2] == '4')
	    regno = TR0_REGNUM + 4;
	break;
      }
  else if (regnamelen == 4)
    switch (regname[0])
      {
      case 'E':
	if (regname[1] == 'I')
	  if (regname[2] == 'E' && regname[3] == 'M')
	    regno = EIEM_REGNUM;
	break;
      case 'I':
	if (regname[1] == 'P' && regname[2] == 'S' && regname[3] == 'W')
	  regno = IPSW_REGNUM;
	break;
      }
  else if (regnamelen == 5)
    switch (regname[0])
      {
      case 'I':
	if (regname[1] == 'A'
	    && regname[2] == 'O'
	    && regname[3] == 'Q'
	    && regname[4] == 'B')
	  regno = PCOQ_TAIL_REGNUM;
	break;
      }

  if (regno >= 0)
    while (numregs-- > 0)
      val = monitor_supply_register (regno++, val);
}
Esempio n. 7
0
static void
sh3_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
  int numregs;
  int regno;

  numregs = 1;
  regno = -1;

  if (regnamelen == 2)
    {
      switch (regname[0])
	{
	case 'S':
	  if (regname[1] == 'R')
	    regno = SR_REGNUM;
	  break;
	case 'P':
	  if (regname[1] == 'C')
	    regno = PC_REGNUM;
	  else if (regname[1] == 'R')
	    regno = PR_REGNUM;
	  break;
	}
    }
  else if (regnamelen == 3)
    {
      switch (regname[0])
	{
	case 'G':
	case 'V':
	  if (regname[1] == 'B' && regname[2] == 'R')
	    {
	      if (regname[0] == 'G')
		regno = VBR_REGNUM;
	      else
		regno = GBR_REGNUM;
	    }
	  break;
	case 'S':
	  if (regname[1] == 'S' && regname[2] == 'R')
	    regno = SSR_REGNUM;
	  else if (regname[1] == 'P' && regname[2] == 'C')
	    regno = SPC_REGNUM;
	  break;
	}
    }
  else if (regnamelen == 4)
    {
      switch (regname[0])
	{
	case 'M':
	  if (regname[1] == 'A' && regname[2] == 'C')
	    {
	      if (regname[3] == 'H')
		regno = MACH_REGNUM;
	      else if (regname[3] == 'L')
		regno = MACL_REGNUM;
	    }
	  break;
	case 'R':
	  if (regname[1] == '0' && regname[2] == '-' && regname[3] == '7')
	    {
	      regno = R0_REGNUM;
	      numregs = 8;
	    }
	}
    }
  else if (regnamelen == 5)
    {
      if (regname[1] == '8' && regname[2] == '-' && regname[3] == '1'
	  && regname[4] == '5')
	{
	  regno = R0_REGNUM + 8;
	  numregs = 8;
	}
    }
  else if (regnamelen == 17)
    {
    }

  if (regno >= 0)
    while (numregs-- > 0)
      val = monitor_supply_register (regno++, val);
}