More replace reg_name[] with REGISTER_NAME().
+Fri Dec 11 09:52:04 1998 Andrew Cagney <cagney@chook>
+
+ * gdbtk-cmds.c, mipsm3-nat.c, hppah-nat.c, infptrace.c,
+ i386gnu-nat.c, hppab-nat.c, core-aout.c, arm-xdep.c, alpha-nat.c,
+ altos-xdep.c, pyr-xdep.c, remote-st.c, remote-os9k.c,
+ tahoe-tdep.c, pyr-tdep.c, v850ice.c, vax-tdep.c: Replace reg_name
+ with REGISTER_NAME.
+
Thu Dec 10 15:19:40 1998 David Taylor <taylor@texas.cygnus.com>
The following changes were made by Jim Blandy <jimb@cygnus.com>,
}
if (bad_reg >= 0)
{
- error ("Register %s not found in core file.", reg_names[bad_reg]);
+ error ("Register %s not found in core file.", REGISTER_NAME (bad_reg));
}
}
if (val < 0
|| (val = myread (corechan, buf, sizeof buf)) < 0)
{
- char * buffer = (char *) alloca (strlen (reg_names[regno])
+ char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno))
+ 30);
strcpy (buffer, "Reading register ");
- strcat (buffer, reg_names[regno]);
+ strcat (buffer, REGISTER_NAME (regno));
perror_with_name (buffer);
}
if (val < 0
|| (val = myread (corechan, buf, sizeof buf)) < 0)
{
- char * buffer = (char *) alloca (strlen (reg_names[regno])
+ char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno))
+ 30);
strcpy (buffer, "Reading register ");
- strcat (buffer, reg_names[regno]);
+ strcat (buffer, REGISTER_NAME (regno));
perror_with_name (buffer);
}
}
if (bad_reg >= 0)
- error ("Register %s not found in core file.", reg_names[bad_reg]);
+ error ("Register %s not found in core file.", REGISTER_NAME (bad_reg));
}
int regnum;
/* Note that the test for a valid register must include checking the
- reg_names array because NUM_REGS may be allocated for the union of the
- register sets within a family of related processors. In this case, the
- trailing entries of reg_names will change depending upon the particular
- processor being debugged. */
+ REGISTER_NAME because NUM_REGS may be allocated for the union of
+ the register sets within a family of related processors. In this
+ case, some entries of REGISTER_NAME will change depending upon
+ the particular processor being debugged. */
if (objc == 0) /* No args, just do all the regs */
{
for (regnum = 0;
regnum < NUM_REGS
- && reg_names[regnum] != NULL
- && *reg_names[regnum] != '\000';
+ && REGISTER_NAME (regnum) != NULL
+ && *REGISTER_NAME (regnum) != '\000';
regnum++)
func (regnum, argp);
if (regnum >= 0
&& regnum < NUM_REGS
- && reg_names[regnum] != NULL
- && *reg_names[regnum] != '\000')
+ && REGISTER_NAME (regnum) != NULL
+ && *REGISTER_NAME (regnum) != '\000')
func (regnum, argp);
else
{
void *argp; /* Ignored */
{
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
- Tcl_NewStringObj (reg_names[regnum], -1));
+ Tcl_NewStringObj (REGISTER_NAME (regnum), -1));
}
/* This implements the tcl command gdb_fetch_registers
kernel doesn't let us at the registers. */
char *err = safe_strerror (errno);
char *msg = alloca (strlen (err) + 128);
- sprintf (msg, "reading register %s: %s", reg_names[regno], err);
+ sprintf (msg, "reading register %s: %s", REGISTER_NAME (regno), err);
warning (msg);
goto error_exit;
}
char *err = safe_strerror (errno);
char *msg = alloca (strlen (err) + 128);
sprintf (msg, "writing register %s: %s",
- reg_names[regno], err);
+ REGISTER_NAME (regno), err);
warning (msg);
return;
}
char *err = safe_strerror (errno);
char *msg = alloca (strlen (err) + 128);
sprintf (msg, "writing register %s: %s",
- reg_names[regno], err);
+ REGISTER_NAME (regno), err);
warning (msg);
return;
}
kernel doesn't let us at the registers. */
char *err = safe_strerror (errno);
char *msg = alloca (strlen (err) + 128);
- sprintf (msg, "reading register %s: %s", reg_names[regno], err);
+ sprintf (msg, "reading register %s: %s", REGISTER_NAME (regno), err);
warning (msg);
goto error_exit;
}
if (! state)
warning ("Couldn't fetch register %s from %s (invalid thread).",
- reg_names[reg], proc_string (thread));
+ REGISTER_NAME (reg), proc_string (thread));
else if (reg >= 0)
{
- proc_debug (thread, "fetching register: %s", reg_names[reg]);
+ proc_debug (thread, "fetching register: %s", REGISTER_NAME (reg));
supply_register (reg, REG_ADDR(state, reg));
thread->fetched_regs |= (1 << reg);
}
if (! thread)
error ("store inferior registers: %d: Invalid thread", inferior_pid);
- proc_debug (thread, "storing register %s.", reg_names[reg]);
+ proc_debug (thread, "storing register %s.", REGISTER_NAME (reg));
was_aborted = thread->aborted;
was_valid = thread->state_valid;
if (! state)
warning ("Couldn't store register %s from %s (invalid thread).",
- reg_names[reg], proc_string (thread));
+ REGISTER_NAME (reg), proc_string (thread));
else
{
if (! was_aborted && was_valid)
/* Register CHECK_REG has changed! Ack! */
{
warning ("Register %s changed after thread was aborted.",
- reg_names [check_reg]);
+ REGISTER_NAME (check_reg));
if (reg >= 0 && reg != check_reg)
/* Update gdb's copy of the register. */
supply_register (check_reg, REG_ADDR (state, check_reg));
if (reg >= 0)
{
- proc_debug (thread, "storing register: %s", reg_names[reg]);
+ proc_debug (thread, "storing register: %s", REGISTER_NAME (reg));
STORE_REGS (state, reg, 1);
}
else
}
if (bad_reg >= 0)
{
- error ("Register %s not found in core file.", reg_names[bad_reg]);
+ error ("Register %s not found in core file.", REGISTER_NAME (bad_reg));
}
supply_register (ZERO_REGNUM, zerobuf);
/* Frame ptr reg must appear to be 0; it is faked by stack handling code. */
regno == FCRIR_REGNUM)
{
message ("You can not alter read-only register `%s'",
- reg_names[ regno ]);
+ REGISTER_NAME ( regno ));
fetch_inferior_registers (regno);
return;
}
#endif
-/* The generic method for targets to specify how their registers are named.
- The mapping can be derived from three sources: reg_names; std_regs; or
- a target specific alias hook. */
+/* The generic method for targets to specify how their registers are
+ named. The mapping can be derived from three sources:
+ REGISTER_NAME; std_regs; or a target specific alias hook. */
int
target_map_name_to_register (str, len)
for (regno = 0; regno < 16; regno++) {
printf_unfiltered/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n",
- reg_names[regno], reg_buf[regno],
- reg_names[regno+16], reg_buf[regno+16],
- reg_names[regno+32], reg_buf[regno+32],
- reg_names[regno+48], reg_buf[regno+48]);
+ REGISTER_NAME (regno), reg_buf[regno],
+ REGISTER_NAME (regno+16), reg_buf[regno+16],
+ REGISTER_NAME (regno+32), reg_buf[regno+32],
+ REGISTER_NAME (regno+48), reg_buf[regno+48]);
}
usp = ptrace (3, inferior_pid,
(PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_usp) -
(PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) -
((char *)&u), 0);
printf_unfiltered/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
- reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM],
- reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp,
+ REGISTER_NAME (CSP_REGNUM),reg_buf[CSP_REGNUM],
+ REGISTER_NAME (KSP_REGNUM), reg_buf[KSP_REGNUM], ksp,
"usp", usp);
}
if (i == regnum) {
long val = raw_regs[i];
- fputs_filtered (reg_names[i], stdout);
+ fputs_filtered (REGISTER_NAME (i), stdout);
printf_filtered(":");
- print_spaces_filtered (6 - strlen (reg_names[i]), stdout);
+ print_spaces_filtered (6 - strlen (REGISTER_NAME (i)), stdout);
if (val == 0)
printf_filtered ("0");
else
fprintf_unfiltered (stderr,
"\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
frame->frame,
- reg_names[CFP_REGNUM],
+ REGISTER_NAME (CFP_REGNUM),
result, addr,
frame->frame_cfp, (CFP_REGNUM),
fprintf_unfiltered (stderr,
"\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
frame->frame,
- reg_names[CFP_REGNUM],
+ REGISTER_NAME (CFP_REGNUM),
result, addr,
frame->frame_cfp, read_register(CFP_REGNUM),
switch (operand_mode) {
case 0:
fprintf_unfiltered (stream, "%s,%s",
- reg_names [op_1_regno],
- reg_names [op_2_regno]);
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno));
break;
case 1:
fprintf_unfiltered (stream, " 0x%0x,%s",
op_1_regno,
- reg_names [op_2_regno]);
+ REGISTER_NAME (op_2_regno));
break;
case 2:
extra_1 = * ((int *) buffer);
fprintf_unfiltered (stream, " $0x%0x,%s",
extra_1,
- reg_names [op_2_regno]);
+ REGISTER_NAME (op_2_regno));
break;
case 3:
fprintf_unfiltered (stream, " (%s),%s",
- reg_names [op_1_regno],
- reg_names [op_2_regno]);
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno));
break;
case 4:
extra_1 = * ((int *) buffer);
fprintf_unfiltered (stream, " 0x%0x(%s),%s",
extra_1,
- reg_names [op_1_regno],
- reg_names [op_2_regno]);
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno));
break;
/* S1 destination mode */
case 5:
fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,(%s)[%s*%1d]" : "%s,(%s)"),
- reg_names [op_1_regno],
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
op_1_regno,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
extra_1,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
case 8:
fprintf_unfiltered (stream,
((index_reg_regno) ? " (%s),(%s)[%s*%1d]" : " (%s),(%s)"),
- reg_names [op_1_regno],
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
? "%#0x(%s),(%s)[%s*%1d]"
: "%#0x(%s),(%s)"),
extra_1,
- reg_names [op_1_regno],
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
extra_1 = * ((int *) buffer);
fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%#0x(%s)[%s*%1d]" : "%s,%#0x(%s)"),
- reg_names [op_1_regno],
+ REGISTER_NAME (op_1_regno),
extra_1,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
case 11:
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
op_1_regno,
extra_1,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
case 12:
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
extra_1,
extra_2,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
((index_reg_regno)
? " (%s),%#0x(%s)[%s*%1d]"
: " (%s),%#0x(%s)"),
- reg_names [op_1_regno],
+ REGISTER_NAME (op_1_regno),
extra_1,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
case 14:
((index_reg_regno) ? "%#0x(%s),%#0x(%s)[%s*%1d]"
: "%#0x(%s),%#0x(%s) "),
extra_1,
- reg_names [op_1_regno],
+ REGISTER_NAME (op_1_regno),
extra_2,
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
break;
default:
fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%s [%s*%1d]" : "%s,%s"),
- reg_names [op_1_regno],
- reg_names [op_2_regno],
- reg_names [index_reg_regno],
+ REGISTER_NAME (op_1_regno),
+ REGISTER_NAME (op_2_regno),
+ REGISTER_NAME (index_reg_regno),
index_multiplier);
fprintf_unfiltered (stream,
"\t\t# unknown mode in %08x",
#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
printf_unfiltered ("Fetching register %s, got %0x\n",
- reg_names[regno],
+ REGISTER_NAME (regno),
reg_buf[regno]);
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
if (reg_buf[regno] == -1 && errno == EIO) {
printf_unfiltered("fetch_interior_registers: fetching register %s\n",
- reg_names[regno]);
+ REGISTER_NAME (regno));
errno = 0;
}
supply_register (regno, reg_buf+regno);
if (val < 0
|| (val = myread (corechan, buf, sizeof buf)) < 0)
{
- char * buffer = (char *) alloca (strlen (reg_names[regno])
+ char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno))
+ 30);
strcpy (buffer, "Reading register ");
- strcat (buffer, reg_names[regno]);
+ strcat (buffer, REGISTER_NAME (regno));
perror_with_name (buffer);
}
perror_with_name (filename);
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
printf_unfiltered ("[reg %s(%d), offset in file %s=0x%0x, addr =0x%0x, =%0x]\n",
- reg_names[regno], regno, filename,
+ REGISTER_NAME (regno), regno, filename,
register_addr(regno, reg_offset),
regno * 4 + last_frame_address,
*((int *)buf));
if (regno < 0)
return ("");
/*
- for (p = reg_names[regno]; *p; p++)
+ for (p = REGISTER_NAME (regno); *p; p++)
*b++ = toupper(*p);
*b = '\000';
*/
- p = (char *)reg_names[regno];
+ p = (char *)REGISTER_NAME (regno);
return p;
/*
return buf;
b = buf;
- for (p = reg_names[regno]; *p; p++)
+ for (p = REGISTER_NAME (regno); *p; p++)
*b++ = toupper(*p);
*b = '\000';
case 4: /* Indexed */
p = (char *) print_insn_arg (d, p, addr + 1, stream);
- fprintf_unfiltered (stream, "[%s]", reg_names[regnum]);
+ fprintf_unfiltered (stream, "[%s]", REGISTER_NAME (regnum));
break;
case 5: /* Register */
- fprintf_unfiltered (stream, reg_names[regnum]);
+ fprintf_unfiltered (stream, REGISTER_NAME (regnum));
break;
case 7: /* Autodecrement */
fputc_unfiltered ('-', stream);
case 6: /* Register deferred */
- fprintf_unfiltered (stream, "(%s)", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)", REGISTER_NAME (regnum));
break;
case 9: /* Absolute Address & Autoincrement deferred */
}
else /*8E is Autoincrement SP Mode*/
- fprintf_unfiltered (stream, "(%s)+", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)+", REGISTER_NAME (regnum));
break;
case 11: /* Register + Byte Displacement Deferred Mode*/
if (regnum == PC_REGNUM)
print_address (addr + *p + 2, stream);
else
- fprintf_unfiltered (stream, "%d(%s)", *p, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", *p, REGISTER_NAME (regnum));
p += 1;
break;
if (regnum == PC_REGNUM)
print_address (addr + temp1 + 3, stream);
else
- fprintf_unfiltered (stream, "%d(%s)", temp1, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum));
p += 2;
break;
if (regnum == PC_REGNUM)
print_address (addr + temp1 + 5, stream);
else
- fprintf_unfiltered (stream, "%d(%s)", temp1, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum));
p += 4;
}
(PTRACE_ARG3_TYPE) regaddr, read_register(regno));
if (errno != 0)
{
- sprintf (buf, "writing register %s (#%d)", reg_names[regno],regno);
+ sprintf (buf, "writing register %s (#%d)", REGISTER_NAME (regno), regno);
perror_with_name (buf);
}
}
val = ptrace (PT_READ_U, inferior_pid,
(PTRACE_ARG3_TYPE) register_addr(regno,0), 0);
if (errno != 0) {
- sprintf(buf,"reading register %s (#%d)",reg_names[regno],regno);
+ sprintf(buf,"reading register %s (#%d)",REGISTER_NAME (regno), regno);
perror_with_name (buf);
} else {
supply_register (regno, &val);
if (!CANNOT_FETCH_REGISTER(regno)) {
val = bfd_seek (core_bfd, (file_ptr) register_addr (regno, 0), SEEK_SET);
if (val < 0 || (val = bfd_read (buf, sizeof buf, 1, core_bfd)) < 0) {
- char * buffer = (char *) alloca (strlen (reg_names[regno]) + 35);
+ char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) + 35);
strcpy (buffer, "Reading core register ");
- strcat (buffer, reg_names[regno]);
+ strcat (buffer, REGISTER_NAME (regno));
perror_with_name (buffer);
}
supply_register (regno, buf);
case FC_REGNUM: return(offsetof(struct ptrace_user,pt_fc));
default:
fprintf_filtered(gdb_stderr,"register_addr():Bad register %s (%d)\n",
- reg_names[regno],regno);
+ REGISTER_NAME (regno), regno);
return(0xffffffff); /* Should make ptrace() fail */
}
}
{
if (regno <= 31)
sprintf (buf, "r%d", regno);
- else if (reg_names[regno][0] == 's'
- && reg_names[regno][1] == 'r')
+ else if (REGISTER_NAME (regno)[0] == 's'
+ && REGISTER_NAME (regno)[1] == 'r')
return 0;
else
- sprintf (buf, "%s", reg_names[regno]);
+ sprintf (buf, "%s", REGISTER_NAME (regno));
return 1;
}
case 4: /* Indexed */
p = (char *) print_insn_arg (d, p, addr + 1, info);
- (*info->fprintf_func) (info->stream, "[%s]", reg_names[regnum]);
+ (*info->fprintf_func) (info->stream, "[%s]", REGISTER_NAME (regnum));
break;
case 5: /* Register */
- (*info->fprintf_func) (info->stream, reg_names[regnum]);
+ (*info->fprintf_func) (info->stream, REGISTER_NAME (regnum));
break;
case 7: /* Autodecrement */
(*info->fprintf_func) (info->stream, "-");
case 6: /* Register deferred */
- (*info->fprintf_func) (info->stream, "(%s)", reg_names[regnum]);
+ (*info->fprintf_func) (info->stream, "(%s)", REGISTER_NAME (regnum));
break;
case 9: /* Autoincrement deferred */
}
}
else
- (*info->fprintf_func) (info->stream, "(%s)+", reg_names[regnum]);
+ (*info->fprintf_func) (info->stream, "(%s)+", REGISTER_NAME (regnum));
break;
case 11: /* Byte displacement deferred */
(*info->print_address_func) (info->target, info);
}
else
- (*info->fprintf_func) (info->stream, "%d(%s)", *p, reg_names[regnum]);
+ (*info->fprintf_func) (info->stream, "%d(%s)", *p, REGISTER_NAME (regnum));
p += 1;
break;
}
else
(*info->fprintf_func) (info->stream, "%d(%s)",
- *(short *)p, reg_names[regnum]);
+ *(short *)p, REGISTER_NAME (regnum));
p += 2;
break;
}
else
(*info->fprintf_func) (info->stream, "%d(%s)",
- *(long *)p, reg_names[regnum]);
+ *(long *)p, REGISTER_NAME (regnum));
p += 4;
}