+2002-04-12 Andrew Cagney <cagney@redhat.com>
+
+ * defs.h (read_relative_register_raw_bytes): Delete declaration.
+ * frame.c (frame_register_read): New function. Return non-zero on
+ success.
+ (read_relative_register_raw_bytes_for_frame): Delete.
+ (read_relative_register_raw_bytes): Delete.
+ * frame.h (frame_register_read): Declare.
+ * d30v-tdep.c: Update Copyright. Use frame_register_read.
+ * sh-tdep.c: Ditto.
+ * infcmd.c (do_registers_info): Ditto.
+ * hppa-tdep.c: Ditto.
+ * rs6000-tdep.c: Ditto.
+ * h8500-tdep.c: Ditto.
+ * mips-tdep.c: Ditto.
+ * h8300-tdep.c: Ditto.
+ * z8k-tdep.c: Ditto.
+
2002-04-12 Kevin Buettner <kevinb@redhat.com>
From Jimi X <jimix@watson.ibm.com>:
/* Target-dependent code for Mitsubishi D30V, for GDB.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This file is part of GDB.
{
char regbuf[MAX_REGISTER_RAW_SIZE];
- read_relative_register_raw_bytes (regnum, regbuf);
+ frame_register_read (selected_frame, regnum, regbuf);
val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0,
gdb_stdout, 'x', 1, 0, Val_pretty_default);
void *),
void *));
-/* From findvar.c */
-
-extern int read_relative_register_raw_bytes (int, char *);
-
/* Possible lvalue types. Like enum language, this should be in
value.h, but needs to be here for the same reason. */
GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
}
-/* READ_RELATIVE_REGISTER_RAW_BYTES_FOR_FRAME
+/* frame_register_read ()
- Copy the bytes of register REGNUM, relative to the input stack frame,
- into our memory at MYADDR, in target byte order.
+ Find and return the value of REGNUM for the specified stack frame.
The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
- Returns 1 if could not be read, 0 if could. */
+ Returns 0 if the register value could not be found. */
-static int
-read_relative_register_raw_bytes_for_frame (int regnum,
- char *myaddr,
- struct frame_info *frame)
+int
+frame_register_read (struct frame_info *frame, int regnum, void *myaddr)
{
int optim;
get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
regnum, (enum lval_type *) NULL);
+ /* FIXME: cagney/2002-04-10: This test is just bogus. It is no
+ indication of the validity of the register. The value could
+ easily be found (on the stack) even though the corresponding
+ register isn't available. */
if (register_cached (regnum) < 0)
- return 1; /* register value not available */
-
- return optim;
-}
+ return 0; /* register value not available */
-/* READ_RELATIVE_REGISTER_RAW_BYTES
-
- Copy the bytes of register REGNUM, relative to the current stack
- frame, into our memory at MYADDR, in target byte order.
- The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
-
- Returns 1 if could not be read, 0 if could. */
-
-int
-read_relative_register_raw_bytes (int regnum, char *myaddr)
-{
- return read_relative_register_raw_bytes_for_frame (regnum, myaddr,
- selected_frame);
+ return !optim;
}
struct frame_info *frame,
int regnum, enum lval_type *lval);
+/* Return the register as found on the FRAME. Return zero if the
+ register could not be found. */
+extern int frame_register_read (struct frame_info *frame, int regnum,
+ void *buf);
+
#endif /* !defined (FRAME_H) */
+2002-04-12 Andrew Cagney <cagney@redhat.com>
+
+ * generic/gdbtk-register.c (register_changed_p): Use
+ frame_register_read instead of read_relative_register_raw_bytes.
+ (get_register): Delete out-of-date comment.
+
2002-04-08 Andrew Cagney <ac131313@redhat.com>
* generic/gdbtk-wrapper.c (wrap_get_frame_block): Add missing NULL
if (format == 'N')
format = 0;
- /* read_relative_register_raw_bytes returns a virtual frame pointer
- (FRAME_FP (selected_frame)) if regnum == FP_REGNUM instead
- of the real contents of the register. To get around this,
- use get_saved_register instead. */
get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, selected_frame,
regnum, (enum lval_type *) NULL);
if (optim)
{
char raw_buffer[MAX_REGISTER_RAW_SIZE];
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
return;
if (memcmp (&old_regs[regnum * MAX_REGISTER_RAW_SIZE], raw_buffer,
/* Target-machine dependent code for Hitachi H8/300, for GDB.
- Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
int C, Z, N, V;
unsigned char b[4];
unsigned char l;
- read_relative_register_raw_bytes (regno, b);
+ frame_register_read (selected_frame, regno, b);
l = b[REGISTER_VIRTUAL_SIZE (8) - 1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
/* Target-dependent code for Hitachi H8/500, for GDB.
- Copyright 1993, 1994, 1995, 1998, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This file is part of GDB.
unsigned char b[2];
unsigned char l;
- read_relative_register_raw_bytes (regno, b);
+ frame_register_read (selected_frame, regno, b);
l = b[1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
/* Target-dependent code for the HP PA architecture, for GDB.
- Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
University of Utah (pa-gdb-bugs@cs.utah.edu).
/* Make a copy of gdb's save area (may cause actual
reads from the target). */
for (i = 0; i < NUM_REGS; i++)
- read_relative_register_raw_bytes (i, raw_regs + REGISTER_BYTE (i));
+ frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i));
if (regnum == -1)
pa_print_registers (raw_regs, regnum, fpregs);
/* Make a copy of gdb's save area (may cause actual
reads from the target). */
for (i = 0; i < NUM_REGS; i++)
- read_relative_register_raw_bytes (i, raw_regs + REGISTER_BYTE (i));
+ frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i));
if (regnum == -1)
pa_strcat_registers (raw_regs, regnum, fpregs, stream);
char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
/* Get 32bits of data. */
- read_relative_register_raw_bytes (i, raw_buffer);
+ frame_register_read (selected_frame, i, raw_buffer);
/* Put it in the buffer. No conversions are ever necessary. */
memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
if ((i % 2) == 0)
{
/* Get the data in raw format for the 2nd half. */
- read_relative_register_raw_bytes (i + 1, raw_buffer);
+ frame_register_read (selected_frame, i + 1, raw_buffer);
/* Copy it into the appropriate part of the virtual buffer. */
memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buffer,
print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), stream);
/* Get 32bits of data. */
- read_relative_register_raw_bytes (i, raw_buffer);
+ frame_register_read (selected_frame, i, raw_buffer);
/* Put it in the buffer. No conversions are ever necessary. */
memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
char raw_buf[MAX_REGISTER_RAW_SIZE];
/* Get the data in raw format for the 2nd half. */
- read_relative_register_raw_bytes (i + 1, raw_buf);
+ frame_register_read (selected_frame, i + 1, raw_buf);
/* Copy it into the appropriate part of the virtual buffer. */
memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buf, REGISTER_RAW_SIZE (i));
print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (i, raw_buffer))
+ if (! frame_register_read (selected_frame, i, raw_buffer))
{
printf_filtered ("*value not available*\n");
continue;
+2002-04-09 Andrew Cagney <ac131313@redhat.com>
+
+ * mi-main.c (register_changed_p): Use frame_register_read instead
+ of read_relative_register_raw_bytes.
+ (get_register): Delete out-of-date comment.
+
2002-04-07 Elena Zannoni <ezannoni@redhat.com>
* mi-cmd-disas.c: Run through indent.
{
char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (! frame_register_read (selected_frame, regnum, raw_buffer))
return -1;
if (memcmp (&old_regs[REGISTER_BYTE (regnum)], raw_buffer,
if (format == 'N')
format = 0;
- /* read_relative_register_raw_bytes returns a virtual frame pointer
- (FRAME_FP (selected_frame)) if regnum == FP_REGNUM instead
- of the real contents of the register. To get around this,
- use get_saved_register instead. */
get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, selected_frame,
regnum, (enum lval_type *) NULL);
if (optim)
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
int raw_size = REGISTER_RAW_SIZE (regno);
char *raw_buffer = alloca (raw_size);
- if (read_relative_register_raw_bytes (regno, raw_buffer))
+ if (!frame_register_read (selected_frame, regno, raw_buffer))
error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
if (raw_size == 8)
{
{
/* We have a 64-bit value for this register, and we should use
all 64 bits. */
- if (read_relative_register_raw_bytes (regno, rare_buffer))
+ if (!frame_register_read (selected_frame, regno, rare_buffer))
error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
}
else
char raw_buffer[MAX_REGISTER_RAW_SIZE];
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
{
printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
return;
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))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* pad small registers */
for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++)
/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This file is part of GDB.
printf_filtered ("%s: ", name);
/* Get the data */
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
{
printf_filtered ("[invalid]");
return;
print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (i, raw_buffer))
+ if (!frame_register_read (selected_frame, i, raw_buffer))
{
printf_filtered ("*value not available*\n");
continue;
print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (i, raw_buffer))
+ if (!frame_register_read (selected_frame, i, raw_buffer))
{
printf_filtered ("*value not available*\n");
continue;
raw_buffer = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* Get the register as a number */
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
/* Get the data in raw format. */
- if (read_relative_register_raw_bytes (regnum, raw_buffer))
+ if (!frame_register_read (selected_frame, regnum, raw_buffer))
printf_filtered ("*value not available*\n");
val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
/* Target-dependent code for the SPARC for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+ Inc.
This file is part of GDB.
{
char value[16];
- if (!read_relative_register_raw_bytes (regno, value)
- && !read_relative_register_raw_bytes (regno + 1, value + 4))
+ if (frame_register_read (selected_frame, regno, value)
+ && frame_register_read (selected_frame, regno + 1, value + 4))
{
printf_unfiltered ("\t");
print_floating (value, builtin_type_double, gdb_stdout);
#if 0 /* FIXME: gdb doesn't handle long doubles */
if ((regno & 3) == 0)
{
- if (!read_relative_register_raw_bytes (regno + 2, value + 8)
- && !read_relative_register_raw_bytes (regno + 3, value + 12))
+ if (frame_register_read (selected_frame, regno + 2, value + 8)
+ && frame_register_read (selected_frame, regno + 3, value + 12))
{
printf_unfiltered ("\t");
print_floating (value, builtin_type_long_double, gdb_stdout);
{
char value[16];
- if (!read_relative_register_raw_bytes (regno, value)
- && !read_relative_register_raw_bytes (regno + 1, value + 8))
+ if (frame_register_read (selected_frame, regno, value)
+ && frame_register_read (selected_frame, regno + 1, value + 8))
{
printf_unfiltered ("\t");
print_floating (value, builtin_type_long_double, gdb_stdout);
/* Target-machine dependent code for Zilog Z8000, for GDB.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation, Inc.
This file is part of GDB.
{
unsigned short l[2];
- read_relative_register_raw_bytes (regno, (char *) (l + 0));
- read_relative_register_raw_bytes (regno + 1, (char *) (l + 1));
+ frame_register_read (selected_frame, regno, (char *) (l + 0));
+ frame_register_read (selected_frame, regno + 1, (char *) (l + 1));
printf_unfiltered ("\t");
printf_unfiltered ("%04x%04x", l[0], l[1]);
}
{
unsigned short l[4];
- read_relative_register_raw_bytes (regno, (char *) (l + 0));
- read_relative_register_raw_bytes (regno + 1, (char *) (l + 1));
- read_relative_register_raw_bytes (regno + 2, (char *) (l + 2));
- read_relative_register_raw_bytes (regno + 3, (char *) (l + 3));
+ frame_register_read (selected_frame, regno, (char *) (l + 0));
+ frame_register_read (selected_frame, regno + 1, (char *) (l + 1));
+ frame_register_read (selected_frame, regno + 2, (char *) (l + 2));
+ frame_register_read (selected_frame, regno + 3, (char *) (l + 3));
printf_unfiltered ("\t");
printf_unfiltered ("%04x%04x%04x%04x", l[0], l[1], l[2], l[3]);
unsigned short rval;
int i;
- read_relative_register_raw_bytes (regno, (char *) (&rval));
+ frame_register_read (selected_frame, regno, (char *) (&rval));
printf_unfiltered ("\n");
for (i = 0; i < 10; i += 2)