Rename REGISTER_NAMES{} -> REGISTER_NAME().
+Thu Dec 10 07:14:56 1998 Andrew Cagney <cagney@chook>
+
+ * config/arm/tm-arm.h, arm-tdep.c: Replace REGISTER_NAMES with
+ REGISTER_NAME.
+ * mn10300-tdep.c, config/mn10300/tm-mn10300.h: Ditto.
+ * sh-tdep.c, config/sh/tm-sh.h: Ditto.
+
+ * defs.h (REGISTER_NAME): Provide default for old targets.
+ * defs.h, infcmd.c: Rename reg_names to gdb_register_names.
+
+ * tracepoint.c, target.c, parse.c, infcmd.c, remote-udi.c,
+ expprint.c, infcmd.c, printcmd.c, eval.c, stack.c, findvar.c,
+ remote-udi.c, config/alpha/tm-alpha.h, remote-sim.c, d30v-tdep.c,
+ config/mips/tm-mips.h, config/mips/tm-txvu.h, txvu-tdep.c,
+ hppa-tdep.c: Use REGISTER_NAME.
+
1998-12-08 James E Wilson <wilson@wilson-pc.cygnus.com>
* config/i960/mon960.mt (SIM_OBJS, SIM): Define.
/* Stack grows downward. */
-#define INNER_THAN <
+#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
{ \
if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \
printf_filtered (" frame pointer is at %s+%d\n", \
- reg_names[fi->proc_desc->pdr.framereg], \
+ REGISTER_NAME (fi->proc_desc->pdr.framereg), \
fi->proc_desc->pdr.frameoffset); \
}
{ \
if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \
printf_filtered (" frame pointer is at %s+%d\n", \
- reg_names[fi->proc_desc->pdr.framereg], \
+ REGISTER_NAME (fi->proc_desc->pdr.framereg), \
fi->proc_desc->pdr.frameoffset); \
}
#define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
-#define REGISTER_NAMES \
-{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", \
- "sp", "pc", "mdr", "psw", "lir", "lar", "", "", \
- "", "", "", "", "", "", "", "", \
- "", "", "", "", "", "", "", "fp" }
+extern char **mn10300_register_names;
+#define REGISTER_NAME(i) mn10300_register_names[i]
#define D2_REGNUM 2
#define D3_REGNUM 3
/* Initializer for an array of names of registers.
Entries beyond the first NUM_REGS are ignored. */
-#define REGISTER_NAMES \
- { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", \
- "fpul", "fpscr", \
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", \
- "ssr", "spc", \
- "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", \
- "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1", \
- }
+extern char **sh_register_names;
+#define REGISTER_NAME(i) sh_register_names[i]
#define NUM_REGS 59
if (regnum != -1)
{
- if (reg_names[0] == NULL || reg_names[0][0] == '\000')
+ if (REGISTER_NAME (0) == NULL || REGISTER_NAME (0)[0] == '\000')
return;
- printf_filtered ("%s ", reg_names[regnum]);
+ printf_filtered ("%s ", REGISTER_NAME (regnum));
d30v_print_register (regnum, 0);
printf_filtered ("\n");
extern int parse_escape PARAMS ((char **));
-extern char *reg_names[];
+/* compat - handle old targets that just define REGISTER_NAMES */
+#ifndef REGISTER_NAME
+extern char *gdb_register_names[];
+#define REGISTER_NAME(i) gdb_register_names[i]
+#endif
/* Message to be printed before the error message, when an error occurs. */
+Wed Dec 9 21:13:57 1998 Andrew Cagney <cagney@chook>
+
+ * gdbint.texinfo (REGISTER_NAME): Replace REGISTER_NAMES.
+
1998-12-03 J.T. Conklin <jtc@redbacknetworks.com>
* remote.texi: Changed wording that implied that the GDB remote
The @file{a.out} format is so simple that it doesn't have any reserved
place for debugging information. (Hey, the original Unix hackers used
@file{adb}, which is a machine-language debugger.) The only debugging
-format for @file{a.out} is stabs, which for this format are encoded as
-symbols with distinctive properties.
+format for @file{a.out} is stabs, which is encoded as a set of normal
+symbols with distinctive attributes.
+
+The basic @file{a.out} reader is in @file{dbxread.c}.
@subsection COFF
instance, it was not possible to represent code that came from an
included file.
+The COFF reader is in @file{coffread.c}.
+
@subsection ECOFF
+ECOFF is an extended COFF originally introduced for Mips and Alpha
+workstations.
+
+The basic ECOFF reader is in @file{mipsread.c}.
+
@subsection XCOFF
The IBM RS/6000 running AIX uses an object file format called XCOFF.
@samp{.debug} section (rather than the string table). For more
information, see @xref{Top,,,stabs,The Stabs Debugging Format}.
-The shared library scheme has a nice clean interface for figuring out
-what shared libraries are in use, but the catch is that everything which
+The shared library scheme has a clean interface for figuring out what
+shared libraries are in use, but the catch is that everything which
refers to addresses (symbol tables and breakpoints at least) needs to be
relocated for both shared libraries and the main executable. At least
using the standard mechanism this can only be done once the program has
@subsection PE
Windows 95 and NT use the PE (Portable Executable) format for their
-executables. PE is basically COFF with an additional header or two.
+executables. PE is basically COFF with additional headers.
+
+While BFD includes special PE support, GDB needs only the basic
+COFF reader.
@subsection ELF
to COFF in being organized into a number of sections, but it removes
many of COFF's limitations.
+The basic ELF reader is in @file{elfread.c}.
+
@subsection SOM
+SOM is HP's object file and debug format (not to be confused with IBM's
+SOM, which is a cross-language ABI).
+
+The SOM reader is in @file{hpread.c}.
+
+@subsection Other File Formats
+
+Other file formats that have been supported by GDB include Netware
+Loadable Modules (@file{nlmread.c}.
+
@section Debugging File Formats
+This section describes characteristics of debugging information that
+are independent of the object file format.
+
@subsection stabs
+@code{stabs} started out as special symbols within the @code{a.out}
+format. Since then, it has been encapsulated into other file
+formats, such as COFF and ELF.
+
+While @file{dbxread.c} does some of the basic stab processing,
+including for encapsulated versions, @file{stabsread.c} does
+the real work.
+
@subsection COFF
+The basic COFF definition includes debugging information. The level
+of support is minimal and non-extensible, and is not often used.
+
+@subsection Mips debug (Third Eye)
+
+ECOFF includes a definition of a special debug format.
+
+The file @file{mdebugread.c} implements reading for this format.
+
@subsection DWARF 1
+DWARF 1 is a debugging format that was originally designed to be
+used with ELF in SVR4 systems.
+
+@c CHILL_PRODUCER
+@c GCC_PRODUCER
+@c GPLUS_PRODUCER
+@c LCC_PRODUCER
+@c If defined, these are the producer strings in a DWARF 1 file. All of
+@c these have reasonable defaults already.
+
+The DWARF 1 reader is in @file{dwarfread.c}.
+
@subsection DWARF 2
+DWARF 2 is an improved but incompatible version of DWARF 1.
+
+The DWARF 2 reader is in @file{dwarf2read.c}.
+
@subsection SOM
+Like COFF, the SOM definition includes debugging information.
+
@section Adding a New Symbol Reader to GDB
If you are using an existing object file format (a.out, COFF, ELF, etc),
which registers are which; however, it is critical that they do match up
accurately. The only way to make this work is to get accurate
information about the order that the compiler uses, and to reflect that
-in the @code{REGISTER_NAMES} and related macros.
+in the @code{REGISTER_NAME} and related macros.
GDB can handle big-endian, little-endian, and bi-endian architectures.
status words, and other special registers. If this is not defined, GDB
will assume that all registers may be written.
-@item CHILL_PRODUCER
-@item GCC_PRODUCER
-@item GPLUS_PRODUCER
-@item LCC_PRODUCER
-If defined, these are the producer strings in a DWARF 1 file. All of
-these have reasonable defaults already.
-
@item DO_DEFERRED_STORES
@item CLEAR_DEFERRED_STORES
Define this to execute any deferred stores of registers into the inferior,
constant, the macro expansion will typically just ignore the supplied
@var{pc}.
-@item IN_SOLIB_TRAMPOLINE pc name
+@item IN_SOLIB_CALL_TRAMPOLINE pc name
Define this to evaluate to nonzero if the program is stopped in the
trampoline that connects to a shared library.
+@item IN_SOLIB_RETURN_TRAMPOLINE pc name
+Define this to evaluate to nonzero if the program is stopped in the
+trampoline that returns from a shared library.
+
@item IS_TRAPPED_INTERNALVAR (name)
This is an ugly hook to allow the specification of special actions that
should occur as a side-effect of setting the value of a variable
internal to GDB. Currently only used by the h8500. Note that this
could be either a host or target conditional.
-@item KERNEL_DEBUGGING
-tm-ultra3.h
-
-@item MIPSEL
-mips-tdep.c
-
@item NEED_TEXT_START_END
Define this if GDB should determine the start and end addresses of the
text section. (Seems dubious.)
The total amount of space needed to store GDB's copy of the machine's
register state.
-@item REGISTER_NAMES
-Define this to expand into an initializer of an array of strings. Each
-string is the name of a register.
+@item REGISTER_NAME(i)
+Return the name of register @var{i} as a string. May return @var{NULL}
+or @var{NUL} to indicate that register @var{i} is not valid.
@item REG_STRUCT_HAS_ADDR (gcc_p, type)
Define this to return 1 if the given type will be passed by pointer
REGISTER_RAW_SIZE (regnum));
else
fatal ("Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
- reg_names [regnum], regnum,
+ REGISTER_NAME (regnum), regnum,
REGISTER_RAW_SIZE (regnum), REGISTER_VIRTUAL_SIZE (regnum));
VALUE_LVAL (reg_val) = lval;
VALUE_ADDRESS (reg_val) = addr;
if (register_valid[regno])
continue;
- if (reg_names[regno] == NULL || *reg_names[regno] == '\0')
+ if (REGISTER_NAME (regno) == NULL || *REGISTER_NAME (regno) == '\0')
continue;
regstart = REGISTER_BYTE (regno);
if (regnum == -1)
pa_print_registers (raw_regs, regnum, fpregs);
else if (regnum < FP0_REGNUM)
- printf_unfiltered ("%s %x\n", reg_names[regnum], *(long *)(raw_regs +
+ printf_unfiltered ("%s %x\n", REGISTER_NAME (regnum), *(long *)(raw_regs +
REGISTER_BYTE (regnum)));
else
pa_print_fp_reg (regnum);
{
val =
extract_signed_integer (raw_regs + REGISTER_BYTE (i+(j*18)), 4);
- printf_unfiltered ("%8.8s: %8x ", reg_names[i+(j*18)], val);
+ printf_unfiltered ("%8.8s: %8x ", REGISTER_NAME (i+(j*18)), val);
}
printf_unfiltered ("\n");
}
/* Put it in the buffer. No conversions are ever necessary. */
memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
- fputs_filtered (reg_names[i], gdb_stdout);
- print_spaces_filtered (8 - strlen (reg_names[i]), gdb_stdout);
+ fputs_filtered (REGISTER_NAME (i), gdb_stdout);
+ print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout);
fputs_filtered ("(single precision) ", gdb_stdout);
val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, gdb_stdout, 0,
REGISTER_RAW_SIZE (i));
/* Dump it as a double. */
- fputs_filtered (reg_names[i], gdb_stdout);
- print_spaces_filtered (8 - strlen (reg_names[i]), gdb_stdout);
+ fputs_filtered (REGISTER_NAME (i), gdb_stdout);
+ print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout);
fputs_filtered ("(double precision) ", gdb_stdout);
val_print (builtin_type_double, virtual_buffer, 0, gdb_stdout, 0,
}
+/* Test whether the PC points to the return instruction at the
+ end of a function. */
+
+static int
+mips_about_to_return (pc)
+ CORE_ADDR pc;
+{
+ if (pc_is_mips16 (pc))
+ /* This mips16 case isn't necessarily reliable. Sometimes the compiler
+ generates a "jr $ra"; other times it generates code to load
+ the return address from the stack to an accessible register (such
+ as $a3), then a "jr" using that register. This second case
+ is almost impossible to distinguish from an indirect jump
+ used for switch statements, so we don't even try. */
+ return mips_fetch_instruction (pc) == 0xe820; /* jr $ra */
+ else
+ return mips_fetch_instruction (pc) == 0x3e00008; /* jr $ra */
+}
+
+
/* This fencepost looks highly suspicious to me. Removing it also
seems suspicious as it could affect remote debugging across serial
lines. */
static CORE_ADDR
-heuristic_proc_start(pc)
+heuristic_proc_start (pc)
CORE_ADDR pc;
{
CORE_ADDR start_pc;
else
seen_adjsp = 0;
}
- else if (ABOUT_TO_RETURN(start_pc))
+ else if (mips_about_to_return (start_pc))
{
start_pc += 2 * MIPS_INSTLEN; /* skip return, and its delay slot */
break;
/* Get the data in raw format. */
if (read_relative_register_raw_bytes (regnum, raw_buffer))
{
- printf_filtered ("%s: [Invalid]", reg_names[regnum]);
+ printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
return;
}
gdb_stdout, 0, 1, 0, Val_pretty_default);
printf_filtered ("); ");
}
- fputs_filtered (reg_names[regnum], gdb_stdout);
+ fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
/* The problem with printing numeric register names (r26, etc.) is that
the user can't use them on input. Probably the best solution is to
/* Get the data in raw format. */
if (read_relative_register_raw_bytes (regnum, raw_buffer[HI]))
- error ("can't read register %d (%s)", regnum, reg_names[regnum]);
+ error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
if (REGISTER_RAW_SIZE(regnum) == 4)
{
/* 4-byte registers: we can fit two registers per row. */
/* Also print every pair of 4-byte regs as an 8-byte double. */
if (read_relative_register_raw_bytes (regnum + 1, raw_buffer[LO]))
error ("can't read register %d (%s)",
- regnum + 1, reg_names[regnum + 1]);
+ regnum + 1, REGISTER_NAME (regnum + 1));
/* copy the two floats into one double, and unpack both */
memcpy (dbl_buffer, raw_buffer, sizeof(dbl_buffer));
doub = unpack_double (builtin_type_double, dbl_buffer, &inv3);
printf_filtered (inv1 ? " %-5s: <invalid float>" :
- " %-5s%-17.9g", reg_names[regnum], flt1);
+ " %-5s%-17.9g", REGISTER_NAME (regnum), flt1);
printf_filtered (inv2 ? " %-5s: <invalid float>" :
- " %-5s%-17.9g", reg_names[regnum + 1], flt2);
+ " %-5s%-17.9g", REGISTER_NAME (regnum + 1), flt2);
printf_filtered (inv3 ? " dbl: <invalid double>\n" :
" dbl: %-24.17g\n", doub);
/* may want to do hex display here (future enhancement) */
doub = unpack_double (builtin_type_double, dbl_buffer, &inv3);
printf_filtered (inv1 ? " %-5s: <invalid float>" :
- " %-5s flt: %-17.9g", reg_names[regnum], flt1);
+ " %-5s flt: %-17.9g", REGISTER_NAME (regnum), flt1);
printf_filtered (inv3 ? " dbl: <invalid double>\n" :
" dbl: %-24.17g\n", doub);
/* may want to do hex display here (future enhancement) */
printf_filtered (" ");
for (col = 0; col < ncols && regnum < numregs; regnum++)
{
- if (*reg_names[regnum] == '\0')
+ if (*REGISTER_NAME (regnum) == '\0')
continue; /* unused register */
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
break; /* end the row: reached FP register */
printf_filtered (MIPS_REGSIZE == 8 ? "%17s" : "%9s",
- reg_names[regnum]);
+ REGISTER_NAME (regnum));
col++;
}
printf_filtered (start_regnum < MIPS_NUMREGS ? "\n R%-4d" : "\n ",
/* now print the values in hex, 4 or 8 to the row */
for (col = 0; col < ncols && regnum < numregs; regnum++)
{
- if (*reg_names[regnum] == '\0')
+ if (*REGISTER_NAME (regnum) == '\0')
continue; /* unused register */
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
break; /* end row: reached FP register */
/* OK: get the data in raw format. */
if (read_relative_register_raw_bytes (regnum, raw_buffer))
- error ("can't read register %d (%s)", regnum, reg_names[regnum]);
+ error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* pad small registers */
for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_RAW_SIZE (regnum)); byte++)
printf_filtered (" ");
{
if (regnum != -1) /* do one specified register */
{
- if (*(reg_names[regnum]) == '\0')
+ if (*(REGISTER_NAME (regnum)) == '\0')
error ("Not a valid register for the current processor type");
mips_print_register (regnum, 0);
mips_processor_type = str;
for (j = 0; j < NUM_REGS; ++j)
- reg_names[j] = mips_processor_type_table[i].regnames[j];
+ /* FIXME - MIPS should be defining REGISTER_NAME() instead */
+ gdb_register_names[j] = mips_processor_type_table[i].regnames[j];
return 1;
return print_insn_little_mips (memaddr, info);
}
+/* Old-style breakpoint macros.
+ The IDT board uses an unusual breakpoint value, and sometimes gets
+ confused when it sees the usual MIPS breakpoint instruction. */
+
+#define BIG_BREAKPOINT {0, 0x5, 0, 0xd}
+#define LITTLE_BREAKPOINT {0xd, 0, 0x5, 0}
+#define PMON_BIG_BREAKPOINT {0, 0, 0, 0xd}
+#define PMON_LITTLE_BREAKPOINT {0xd, 0, 0, 0}
+#define IDT_BIG_BREAKPOINT {0, 0, 0x0a, 0xd}
+#define IDT_LITTLE_BREAKPOINT {0xd, 0x0a, 0, 0}
+#define MIPS16_BIG_BREAKPOINT {0xe8, 0xa5}
+#define MIPS16_LITTLE_BREAKPOINT {0xa5, 0xe8}
+
/* This function implements the BREAKPOINT_FROM_PC macro. It uses the program
counter value to determine whether a 16- or 32-bit breakpoint should be
used. It returns a pointer to a string of bytes that encode a breakpoint
}
}
-/* Test whether the PC points to the return instruction at the
- end of a function. This implements the ABOUT_TO_RETURN macro. */
-
-int
-mips_about_to_return (pc)
- CORE_ADDR pc;
-{
- if (pc_is_mips16 (pc))
- /* This mips16 case isn't necessarily reliable. Sometimes the compiler
- generates a "jr $ra"; other times it generates code to load
- the return address from the stack to an accessible register (such
- as $a3), then a "jr" using that register. This second case
- is almost impossible to distinguish from an indirect jump
- used for switch statements, so we don't even try. */
- return mips_fetch_instruction (pc) == 0xe820; /* jr $ra */
- else
- return mips_fetch_instruction (pc) == 0x3e00008; /* jr $ra */
-}
-
-
/* If PC is in a mips16 call or return stub, return the address of the target
PC, which is either the callee or the caller. There are several
cases which must be handled:
#include "gdbcore.h"
#include "symfile.h"
-char *mn10300_generic_register_names[] = REGISTER_NAMES;
+static char *mn10300_generic_register_names[] =
+{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+ "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "fp" };
+char **mn10300_register_names = mn10300_generic_register_names;
/* start-sanitize-am33 */
-char *am33_register_names [] =
+static char *am33_register_names [] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "",
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""};
-int am33_mode;
+static int am33_mode;
/* end-sanitize-am33 */
static CORE_ADDR mn10300_analyze_prologue PARAMS ((struct frame_info *fi,
mn10300_analyze_prologue (fi, 0);
}
+/* Function: mn10300_virtual_frame_pointer
+ Return the register that the function uses for a frame pointer,
+ plus any necessary offset to be applied to the register before
+ any frame pointer offsets. */
+
+void
+mn10300_virtual_frame_pointer (pc, reg, offset)
+ CORE_ADDR pc;
+ long *reg;
+ long *offset;
+{
+ struct frame_info fi;
+
+ /* Set up a dummy frame_info. */
+ fi.next = NULL;
+ fi.prev = NULL;
+ fi.frame = 0;
+ fi.pc = pc;
+
+ /* Analyze the prolog and fill in the extra info. */
+ mn10300_init_extra_frame_info (&fi);
+
+ /* Results will tell us which type of frame it uses. */
+ if (fi.status & MY_FRAME_IN_SP)
+ {
+ *reg = SP_REGNUM;
+ *offset = -(fi.stack_size);
+ }
+ else
+ {
+ *reg = A3_REGNUM;
+ *offset = 0;
+ }
+}
+
/* This can be made more generic later. */
static void
set_machine_hook (filename)
if (bfd_get_mach (exec_bfd) == bfd_mach_mn10300
|| bfd_get_mach (exec_bfd) == 0)
{
- for (i = 0; i < NUM_REGS; i++)
- reg_names[i] = mn10300_generic_register_names[i];
+ mn10300_register_names = mn10300_generic_register_names;
}
/* start-sanitize-am33 */
am33_mode = 0;
if (bfd_get_mach (exec_bfd) == bfd_mach_am33)
{
- for (i = 0; i < NUM_REGS; i++)
- reg_names[i] = am33_register_names[i];
+
+ mn10300_register_names = am33_register_names;
am33_mode = 1;
}
/* end-sanitize-am33 */
/* Search architectural register name space. */
for (i = 0; i < NUM_REGS; i++)
- if (reg_names[i] && len == strlen (reg_names[i])
- && STREQN (str, reg_names[i], len))
+ if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
+ && STREQN (str, REGISTER_NAME (i), len))
{
return i;
}
int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info *));
disassemble_info tm_print_insn_info;
-/* Functions exported for general use: */
+/* Prototypes for exported functions. */
void output_command PARAMS ((char *, int));
+void _initialize_printcmd PARAMS ((void));
-/* Prototypes for local functions. */
+/* Prototypes for local functions. */
static void delete_display PARAMS ((int));
break;
case LOC_REGISTER:
- printf_filtered ("a variable in register %s", reg_names[val]);
+ printf_filtered ("a variable in register %s", REGISTER_NAME (val));
break;
case LOC_STATIC:
break;
case LOC_REGPARM:
- printf_filtered ("an argument in register %s", reg_names[val]);
+ printf_filtered ("an argument in register %s", REGISTER_NAME (val));
break;
case LOC_REGPARM_ADDR:
- printf_filtered ("address of an argument in register %s", reg_names[val]);
+ printf_filtered ("address of an argument in register %s", REGISTER_NAME (val));
break;
case LOC_ARG:
case LOC_BASEREG:
printf_filtered ("a variable at offset %ld from register %s",
- val, reg_names[basereg]);
+ val, REGISTER_NAME (basereg));
break;
case LOC_BASEREG_ARG:
printf_filtered ("an argument at offset %ld from register %s",
- val, reg_names[basereg]);
+ val, REGISTER_NAME (basereg));
break;
case LOC_TYPEDEF:
char *arg;
int from_tty;
{
- register char *f;
+ register char *f = NULL;
register char *s = arg;
- char *string;
+ char *string = NULL;
value_ptr *val_args;
char *substrings;
char *current_substring;
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_fetch_register (regno);
}
- else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
+ else if (REGISTER_NAME (regno) != NULL && *REGISTER_NAME (regno) != '\0')
{
char buf[MAX_REGISTER_RAW_SIZE];
int nr_bytes = sim_fetch_register (gdbsim_desc, regno, buf, REGISTER_RAW_SIZE (regno));
&& warn_user)
{
printf_unfiltered ("Size of register %s (%d) incorrect (%d instead of %d))",
- reg_names [regno], regno,
+ REGISTER_NAME (regno), regno,
nr_bytes, REGISTER_RAW_SIZE (regno));
warn_user = 0;
}
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_store_register (regno);
}
- else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
+ else if (REGISTER_NAME (regno) != NULL && *REGISTER_NAME (regno) != '\0')
{
char tmp[MAX_REGISTER_RAW_SIZE];
int nr_bytes;
supply_register(regno, (char *) &To);
if (remote_debug)
- printf_unfiltered("Fetching register %s = 0x%x\n", reg_names[regno], To);
+ printf_unfiltered("Fetching register %s = 0x%x\n", REGISTER_NAME (regno), To);
}
/*****************************************************************************/
/* Store a single register indicated by 'regno'.
From = read_register (regno); /* get data value */
if (remote_debug)
- printf_unfiltered("Storing register %s = 0x%x\n", reg_names[regno], From);
+ printf_unfiltered("Storing register %s = 0x%x\n", REGISTER_NAME (regno), From);
if (regno == GR1_REGNUM)
{
/* A set of original names, to be used when restoring back to generic
registers from a specific set. */
-char *sh_generic_reg_names[] = REGISTER_NAMES;
+static char *sh_generic_reg_names[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
+ "fpul", "fpscr",
+ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
+ "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "ssr", "spc",
+ "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
+ "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+};
-char *sh_reg_names[] = {
+static char *sh_reg_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
"", "", "", "", "", "", "", "",
};
-char *sh3_reg_names[] = {
+static char *sh3_reg_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1"
};
-char *sh3e_reg_names[] = {
+static char *sh3e_reg_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
};
+char **sh_register_names = sh_generic_reg_names;
+
+
struct {
char **regnames;
int mach;
{
if (sh_processor_type_table[i].mach == ap->mach)
{
- for (j = 0; j < NUM_REGS; ++j)
- reg_names[j] = sh_processor_type_table[i].regnames[j];
- return 1;
+ sh_register_names = sh_processor_type_table[i].regnames;
}
}
/* Print and select stack frames for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
+ Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 1998
Free Software Foundation, Inc.
This file is part of GDB.
#include "demangle.h"
#include "inferior.h"
#include "annotate.h"
+#include "symfile.h"
+#include "objfiles.h"
+
+/* Prototypes for exported functions. */
+
+void args_info PARAMS ((char *, int));
+
+void locals_info PARAMS ((char *, int));
+
+void (*selected_frame_level_changed_hook) PARAMS ((int));
+
+void _initialize_stack PARAMS ((void));
+
+/* Prototypes for local functions. */
static void return_command PARAMS ((char *, int));
static void select_frame_command PARAMS ((char *, int));
-static void args_info PARAMS ((char *, int));
-
static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *));
static void catch_info PARAMS ((char *, int));
-static void locals_info PARAMS ((char *, int));
-
static void print_frame_label_vars PARAMS ((struct frame_info *, int,
GDB_FILE *));
args.source = source;
args.args = 1;
- catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ERROR);
+ catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL);
}
struct print_args_args {
}
else
{
- register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
+ struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
if (msymbol != NULL)
{
funname = SYMBOL_NAME (msymbol);
struct print_args_args args;
args.fi = fi;
args.func = func;
- catch_errors (print_args_stub, (char *)&args, "", RETURN_MASK_ERROR);
+ catch_errors (print_args_stub, (char *)&args, "", RETURN_MASK_ALL);
+ QUIT;
}
printf_filtered (")");
if (sal.symtab && sal.symtab->filename)
print_address_numeric (fi->frame, 1, gdb_stdout);
printf_filtered (":\n");
}
- printf_filtered (" %s = ", reg_names[PC_REGNUM]);
+ printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM));
print_address_numeric (fi->pc, 1, gdb_stdout);
wrap_here (" ");
printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
puts_filtered ("; ");
wrap_here (" ");
- printf_filtered ("saved %s ", reg_names[PC_REGNUM]);
+ printf_filtered ("saved %s ", REGISTER_NAME (PC_REGNUM));
print_address_numeric (FRAME_SAVED_PC (fi), 1, gdb_stdout);
printf_filtered ("\n");
else
puts_filtered (",");
wrap_here (" ");
- printf_filtered (" %s at ", reg_names[i]);
+ printf_filtered (" %s at ", REGISTER_NAME (i));
print_address_numeric (fsr.regs[i], 1, gdb_stdout);
count++;
}
}
/* ARGSUSED */
-static void
+void
locals_info (args, from_tty)
char *args;
int from_tty;
}
}
-static void
+void
args_info (ignore, from_tty)
char *ignore;
int from_tty;
error ("No frame selected.");
print_frame_arg_vars (selected_frame, gdb_stdout);
}
+
\f
/* Select frame FI, and note that its stack level is LEVEL.
LEVEL may be -1 if an actual level number is not known. */
selected_frame = fi;
selected_frame_level = level;
+ if (selected_frame_level_changed_hook)
+ selected_frame_level_changed_hook (level);
/* Ensure that symbols for this frame are read in. Also, determine the
source language of this frame, and switch to it if desired. */
break;
case LOC_REGISTER:
printf_filtered ("a local variable in register $%s",
- reg_names [SYMBOL_VALUE (sym)]);
+ REGISTER_NAME (SYMBOL_VALUE (sym)));
break;
case LOC_ARG:
case LOC_LOCAL_ARG:
break;
case LOC_REGPARM:
printf_filtered ("an argument in register $%s",
- reg_names[SYMBOL_VALUE (sym)]);
+ REGISTER_NAME (SYMBOL_VALUE (sym)));
break;
case LOC_REGPARM_ADDR:
printf_filtered ("the address of an argument, in register $%s",
- reg_names[SYMBOL_VALUE (sym)]);
+ REGISTER_NAME (SYMBOL_VALUE (sym)));
break;
case LOC_TYPEDEF:
printf_filtered ("a typedef.\n");
case LOC_BASEREG:
printf_filtered ("a variable at offset %d from register $%s",
SYMBOL_VALUE (sym),
- reg_names [SYMBOL_BASEREG (sym)]);
+ REGISTER_NAME (SYMBOL_BASEREG (sym)));
break;
case LOC_BASEREG_ARG:
printf_filtered ("an argument at offset %d from register $%s",
SYMBOL_VALUE (sym),
- reg_names [SYMBOL_BASEREG (sym)]);
+ REGISTER_NAME (SYMBOL_BASEREG (sym)));
break;
case LOC_UNRESOLVED:
msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, NULL);