2004-08-02 Andrew Cagney <cagney@gnu.org>
* regcache.h: Delete DEPRECATED_REGISTER_VIRTUAL_SIZE and DEPRECATED_REGISTER_RAW_SIZE from comments. * regcache.c (init_regcache_descr, regcache_dump): Do not check or use DEPRECATED_REGISTER_VIRTUAL_SIZE and DEPRECATED_REGISTER_RAW_SIZE. * findvar.c (value_of_register): Simplify by assuming that the registers raw and virtual sizes are identical. * regcache.h: Delete DEPRECATED_REGISTER_VIRTUAL_TYPE in comment. * arch-utils.c (generic_register_size): Simplify by assuming register_type.
This commit is contained in:
parent
73f458fb31
commit
01e1877c5f
5 changed files with 21 additions and 88 deletions
|
@ -1,5 +1,17 @@
|
||||||
2004-08-02 Andrew Cagney <cagney@gnu.org>
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* regcache.h: Delete DEPRECATED_REGISTER_VIRTUAL_SIZE and
|
||||||
|
DEPRECATED_REGISTER_RAW_SIZE from comments.
|
||||||
|
* regcache.c (init_regcache_descr, regcache_dump): Do not check or
|
||||||
|
use DEPRECATED_REGISTER_VIRTUAL_SIZE and
|
||||||
|
DEPRECATED_REGISTER_RAW_SIZE.
|
||||||
|
* findvar.c (value_of_register): Simplify by assuming that the
|
||||||
|
registers raw and virtual sizes are identical.
|
||||||
|
* regcache.h: Delete DEPRECATED_REGISTER_VIRTUAL_TYPE in
|
||||||
|
comment.
|
||||||
|
* arch-utils.c (generic_register_size): Simplify by assuming
|
||||||
|
register_type.
|
||||||
|
|
||||||
* regcache.c (legacy_read_register_gen, real_register)
|
* regcache.c (legacy_read_register_gen, real_register)
|
||||||
(legacy_write_register_gen): Delete, not used.
|
(legacy_write_register_gen): Delete, not used.
|
||||||
|
|
||||||
|
|
|
@ -289,13 +289,7 @@ int
|
||||||
generic_register_size (int regnum)
|
generic_register_size (int regnum)
|
||||||
{
|
{
|
||||||
gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
|
gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
|
||||||
if (gdbarch_register_type_p (current_gdbarch))
|
return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
|
||||||
return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
|
|
||||||
else
|
|
||||||
/* FIXME: cagney/2003-03-01: Once all architectures implement
|
|
||||||
gdbarch_register_type(), this entire function can go away. It
|
|
||||||
is made obsolete by register_size(). */
|
|
||||||
return TYPE_LENGTH (DEPRECATED_REGISTER_VIRTUAL_TYPE (regnum)); /* OK */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assume all registers are adjacent. */
|
/* Assume all registers are adjacent. */
|
||||||
|
|
|
@ -282,18 +282,8 @@ value_of_register (int regnum, struct frame_info *frame)
|
||||||
|
|
||||||
reg_val = allocate_value (register_type (current_gdbarch, regnum));
|
reg_val = allocate_value (register_type (current_gdbarch, regnum));
|
||||||
|
|
||||||
/* Convert raw data to virtual format if necessary. */
|
memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
|
||||||
|
register_size (current_gdbarch, regnum));
|
||||||
if (DEPRECATED_REGISTER_RAW_SIZE (regnum) == DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum))
|
|
||||||
memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
|
|
||||||
DEPRECATED_REGISTER_RAW_SIZE (regnum));
|
|
||||||
else
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
"Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
|
|
||||||
REGISTER_NAME (regnum),
|
|
||||||
regnum,
|
|
||||||
DEPRECATED_REGISTER_RAW_SIZE (regnum),
|
|
||||||
DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
|
|
||||||
VALUE_LVAL (reg_val) = lval;
|
VALUE_LVAL (reg_val) = lval;
|
||||||
VALUE_ADDRESS (reg_val) = addr;
|
VALUE_ADDRESS (reg_val) = addr;
|
||||||
VALUE_REGNO (reg_val) = regnum;
|
VALUE_REGNO (reg_val) = regnum;
|
||||||
|
|
|
@ -144,20 +144,6 @@ init_regcache_descr (struct gdbarch *gdbarch)
|
||||||
buffer. Ulgh! */
|
buffer. Ulgh! */
|
||||||
descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
|
descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
|
||||||
|
|
||||||
/* Sanity check. Confirm that there is agreement between the
|
|
||||||
regcache and the target's redundant DEPRECATED_REGISTER_BYTE (new
|
|
||||||
targets should not even be defining it). */
|
|
||||||
for (i = 0; i < descr->nr_cooked_registers; i++)
|
|
||||||
{
|
|
||||||
if (DEPRECATED_REGISTER_BYTE_P ())
|
|
||||||
gdb_assert (descr->register_offset[i] == DEPRECATED_REGISTER_BYTE (i));
|
|
||||||
#if 0
|
|
||||||
gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_RAW_SIZE (i));
|
|
||||||
gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_VIRTUAL_SIZE (i));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
/* gdb_assert (descr->sizeof_raw_registers == DEPRECATED_REGISTER_BYTES (i)); */
|
|
||||||
|
|
||||||
return descr;
|
return descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1311,25 +1297,8 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
|
||||||
if (regnum < 0)
|
if (regnum < 0)
|
||||||
fprintf_unfiltered (file, " %5s ", "Size");
|
fprintf_unfiltered (file, " %5s ", "Size");
|
||||||
else
|
else
|
||||||
{
|
fprintf_unfiltered (file, " %5ld",
|
||||||
fprintf_unfiltered (file, " %5ld",
|
regcache->descr->sizeof_register[regnum]);
|
||||||
regcache->descr->sizeof_register[regnum]);
|
|
||||||
if ((regcache->descr->sizeof_register[regnum]
|
|
||||||
!= DEPRECATED_REGISTER_RAW_SIZE (regnum))
|
|
||||||
|| (regcache->descr->sizeof_register[regnum]
|
|
||||||
!= DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum))
|
|
||||||
|| (regcache->descr->sizeof_register[regnum]
|
|
||||||
!= TYPE_LENGTH (register_type (regcache->descr->gdbarch,
|
|
||||||
regnum)))
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!footnote_register_size)
|
|
||||||
footnote_register_size = ++footnote_nr;
|
|
||||||
fprintf_unfiltered (file, "*%d", footnote_register_size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf_unfiltered (file, " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Type. */
|
/* Type. */
|
||||||
{
|
{
|
||||||
|
@ -1373,7 +1342,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
|
||||||
regcache_raw_read (regcache, regnum, buf);
|
regcache_raw_read (regcache, regnum, buf);
|
||||||
fprintf_unfiltered (file, "0x");
|
fprintf_unfiltered (file, "0x");
|
||||||
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
||||||
DEPRECATED_REGISTER_RAW_SIZE (regnum));
|
regcache->descr->sizeof_register[regnum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1387,7 +1356,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
|
||||||
regcache_cooked_read (regcache, regnum, buf);
|
regcache_cooked_read (regcache, regnum, buf);
|
||||||
fprintf_unfiltered (file, "0x");
|
fprintf_unfiltered (file, "0x");
|
||||||
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
||||||
DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
|
regcache->descr->sizeof_register[regnum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,45 +116,13 @@ extern int register_offset_hack (struct gdbarch *gdbarch, int regnum);
|
||||||
|
|
||||||
/* The type of a register. This function is slightly more efficient
|
/* The type of a register. This function is slightly more efficient
|
||||||
then its gdbarch vector counterpart since it returns a precomputed
|
then its gdbarch vector counterpart since it returns a precomputed
|
||||||
value stored in a table.
|
value stored in a table. */
|
||||||
|
|
||||||
NOTE: cagney/2002-08-17: The original macro was called
|
|
||||||
DEPRECATED_REGISTER_VIRTUAL_TYPE. This was because the register
|
|
||||||
could have different raw and cooked (nee virtual) representations.
|
|
||||||
The CONVERTABLE methods being used to convert between the two
|
|
||||||
representations. Current code does not do this. Instead, the
|
|
||||||
first [0..NUM_REGS) registers are 1:1 raw:cooked, and the type
|
|
||||||
exactly describes the register's representation. Consequently, the
|
|
||||||
``virtual'' has been dropped.
|
|
||||||
|
|
||||||
FIXME: cagney/2002-08-17: A number of architectures, including the
|
|
||||||
MIPS, are currently broken in this regard. */
|
|
||||||
|
|
||||||
extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
|
extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
|
||||||
|
|
||||||
|
|
||||||
/* Return the size of register REGNUM. All registers should have only
|
/* Return the size of register REGNUM. All registers should have only
|
||||||
one size.
|
one size. */
|
||||||
|
|
||||||
FIXME: cagney/2003-02-28:
|
|
||||||
|
|
||||||
Unfortunately, thanks to some legacy architectures, this doesn't
|
|
||||||
hold. A register's cooked (nee virtual) and raw size can differ
|
|
||||||
(see MIPS). Such architectures should be using different register
|
|
||||||
numbers for the different sized views of identical registers.
|
|
||||||
|
|
||||||
Anyway, the up-shot is that, until that mess is fixed, core code
|
|
||||||
can end up being very confused - should the RAW or VIRTUAL size be
|
|
||||||
used? As a rule of thumb, use DEPRECATED_REGISTER_VIRTUAL_SIZE in
|
|
||||||
cooked code, but with the comment:
|
|
||||||
|
|
||||||
OK: REGISTER_VIRTUAL_SIZE
|
|
||||||
|
|
||||||
or just
|
|
||||||
|
|
||||||
OK
|
|
||||||
|
|
||||||
appended to the end of the line. */
|
|
||||||
|
|
||||||
extern int register_size (struct gdbarch *gdbarch, int regnum);
|
extern int register_size (struct gdbarch *gdbarch, int regnum);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue