X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fregcache.c;h=12721c330e35ac72234eb4df38b75e825674e721;hb=fb603883409b7c56d89b9a8a7a344d18f861bbc5;hp=3720640913f942f155e95ccd82f873a91270ba43;hpb=73f458fb31b348df77ccd8fb6394847e0619d62d;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/regcache.c b/gdb/regcache.c index 3720640913..12721c330e 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -144,20 +144,6 @@ init_regcache_descr (struct gdbarch *gdbarch) buffer. Ulgh! */ 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; } @@ -563,7 +549,7 @@ deprecated_read_register_bytes (int in_start, char *in_buf, int in_len) int byte; reg_start = DEPRECATED_REGISTER_BYTE (regnum); - reg_len = DEPRECATED_REGISTER_RAW_SIZE (regnum); + reg_len = register_size (current_gdbarch, regnum); reg_end = reg_start + reg_len; if (reg_end <= in_start || in_end <= reg_start) @@ -628,6 +614,15 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) } if (!register_cached (regnum)) target_fetch_registers (regnum); +#if 0 + /* FIXME: cagney/2004-08-07: At present a number of targets + forget (or didn't know that they needed) set this leading to + panics. Also is the problem that target's need to indicate + that a register is in one of the possible states: valid, + undefined, unknown. The last of which isn't yet + possible. */ + gdb_assert (register_cached (regnum)); +#endif } /* Copy the value directly into the register cache. */ memcpy (buf, register_buffer (regcache, regnum), @@ -833,7 +828,7 @@ deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen) int regstart, regend; regstart = DEPRECATED_REGISTER_BYTE (regnum); - regend = regstart + DEPRECATED_REGISTER_RAW_SIZE (regnum); + regend = regstart + register_size (current_gdbarch, regnum); /* Is this register completely outside the range the user is writing? */ if (myregend <= regstart || regend <= myregstart) @@ -957,14 +952,22 @@ register_offset_hack (struct gdbarch *gdbarch, int regnum) return descr->register_offset[regnum]; } +/* Hack to keep code using register_bytes working. */ + +int +deprecated_register_bytes (void) +{ + return current_regcache->descr->sizeof_raw_registers; +} + /* Return the contents of register REGNUM as an unsigned integer. */ ULONGEST read_register (int regnum) { - char *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum)); + char *buf = alloca (register_size (current_gdbarch, regnum)); deprecated_read_register_gen (regnum, buf); - return (extract_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum))); + return (extract_unsigned_integer (buf, register_size (current_gdbarch, regnum))); } ULONGEST @@ -995,7 +998,7 @@ write_register (int regnum, LONGEST val) { void *buf; int size; - size = DEPRECATED_REGISTER_RAW_SIZE (regnum); + size = register_size (current_gdbarch, regnum); buf = alloca (size); store_signed_integer (buf, size, (LONGEST) val); deprecated_write_register_gen (regnum, buf); @@ -1071,19 +1074,18 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf) } -/* read_pc, write_pc, read_sp, deprecated_read_fp, etc. Special - handling for registers PC, SP, and FP. */ +/* read_pc, write_pc, read_sp, etc. Special handling for registers + PC, SP, and FP. */ -/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc(), - read_sp(), and deprecated_read_fp(), will eventually be replaced by - per-frame methods. Instead of relying on the global INFERIOR_PTID, - they will use the contextual information provided by the FRAME. - These functions do not belong in the register cache. */ +/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc() and + read_sp(), will eventually be replaced by per-frame methods. + Instead of relying on the global INFERIOR_PTID, they will use the + contextual information provided by the FRAME. These functions do + not belong in the register cache. */ /* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(), - write_pc_pid(), write_pc(), and deprecated_read_fp(), all need to - be replaced by something that does not rely on global state. But - what? */ + write_pc_pid() and write_pc(), all need to be replaced by something + that does not rely on global state. But what? */ CORE_ADDR read_pc_pid (ptid_t ptid) @@ -1162,24 +1164,6 @@ read_sp (void) internal_error (__FILE__, __LINE__, "read_sp: Unable to find SP"); } -void -deprecated_write_sp (CORE_ADDR val) -{ - gdb_assert (SP_REGNUM >= 0); - write_register (SP_REGNUM, val); -} - -CORE_ADDR -deprecated_read_fp (void) -{ - if (DEPRECATED_TARGET_READ_FP_P ()) - return DEPRECATED_TARGET_READ_FP (); - else if (DEPRECATED_FP_REGNUM >= 0) - return read_register (DEPRECATED_FP_REGNUM); - else - internal_error (__FILE__, __LINE__, "deprecated_read_fp"); -} - static void reg_flush_command (char *command, int from_tty) { @@ -1311,25 +1295,8 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, if (regnum < 0) fprintf_unfiltered (file, " %5s ", "Size"); else - { - fprintf_unfiltered (file, " %5ld", - 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, " "); - } + fprintf_unfiltered (file, " %5ld", + regcache->descr->sizeof_register[regnum]); /* Type. */ { @@ -1373,7 +1340,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, regcache_raw_read (regcache, regnum, buf); fprintf_unfiltered (file, "0x"); dump_endian_bytes (file, TARGET_BYTE_ORDER, buf, - DEPRECATED_REGISTER_RAW_SIZE (regnum)); + regcache->descr->sizeof_register[regnum]); } } @@ -1387,7 +1354,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, regcache_cooked_read (regcache, regnum, buf); fprintf_unfiltered (file, "0x"); dump_endian_bytes (file, TARGET_BYTE_ORDER, buf, - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); + regcache->descr->sizeof_register[regnum]); } }