X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fremote-mips.c;h=244df5aedf99d96093f3654c304ff5ef6e3bc877;hb=9b254dd1ce46c19dde1dde5b8d1e22e862dfacce;hp=a5f3cbf94a6431ff8309f0d30ed5ab7d0eb859e2;hpb=1143fffb920d9d9995854541dae2c8f6add8387a;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index a5f3cbf94a..244df5aedf 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1,7 +1,7 @@ /* Remote debugging interface for MIPS remote debugging protocol. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Ian Lance Taylor . @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -19,9 +19,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ #include "defs.h" #include "inferior.h" @@ -1755,19 +1753,30 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status) &rpc, &rfp, &rsp, flags); if (nfields >= 3) { + struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); char buf[MAX_REGISTER_SIZE]; - store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rpc); - regcache_raw_supply (current_regcache, PC_REGNUM, buf); + store_unsigned_integer (buf, + register_size + (gdbarch, gdbarch_pc_regnum (gdbarch)), rpc); + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), buf); - store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rfp); - regcache_raw_supply (current_regcache, 30, buf); /* This register they are avoiding and so it is unnamed */ + store_unsigned_integer + (buf, register_size (gdbarch, gdbarch_pc_regnum (gdbarch)), rfp); + regcache_raw_supply (regcache, 30, buf); /* This register they are avoiding and so it is unnamed */ - store_unsigned_integer (buf, register_size (current_gdbarch, SP_REGNUM), rsp); - regcache_raw_supply (current_regcache, SP_REGNUM, buf); + store_unsigned_integer (buf, register_size (gdbarch, + gdbarch_sp_regnum (gdbarch)), rsp); + regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), buf); - store_unsigned_integer (buf, register_size (current_gdbarch, DEPRECATED_FP_REGNUM), 0); - regcache_raw_supply (current_regcache, DEPRECATED_FP_REGNUM, buf); + store_unsigned_integer (buf, + register_size (gdbarch, + gdbarch_deprecated_fp_regnum + (gdbarch)), + 0); + regcache_raw_supply (regcache, + gdbarch_deprecated_fp_regnum (gdbarch), buf); if (nfields == 9) { @@ -1894,18 +1903,20 @@ mips_map_regno (int regno) static void mips_fetch_registers (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); unsigned LONGEST val; int err; if (regno == -1) { - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) mips_fetch_registers (regcache, regno); return; } - if (regno == DEPRECATED_FP_REGNUM || regno == MIPS_ZERO_REGNUM) - /* DEPRECATED_FP_REGNUM on the mips is a hack which is just + if (regno == gdbarch_deprecated_fp_regnum (gdbarch) + || regno == MIPS_ZERO_REGNUM) + /* gdbarch_deprecated_fp_regnum on the mips is a hack which is just supposed to read zero (see also mips-nat.c). */ val = 0; else @@ -1937,7 +1948,7 @@ mips_fetch_registers (struct regcache *regcache, int regno) /* We got the number the register holds, but gdb expects to see a value in the target byte ordering. */ - store_unsigned_integer (buf, register_size (current_gdbarch, regno), val); + store_unsigned_integer (buf, register_size (gdbarch, regno), val); regcache_raw_supply (regcache, regno, buf); } } @@ -1955,12 +1966,13 @@ mips_prepare_to_store (struct regcache *regcache) static void mips_store_registers (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); ULONGEST val; int err; if (regno == -1) { - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) mips_store_registers (regcache, regno); return; } @@ -3262,7 +3274,8 @@ mips_load (char *file, int from_tty) /* Work around problem where PMON monitor updates the PC after a load to a different value than GDB thinks it has. The following ensures that the write_pc() WILL update the PC value: */ - deprecated_register_valid[PC_REGNUM] = 0; + regcache_set_valid_p (get_current_regcache (), + gdbarch_pc_regnum (current_gdbarch), 0); } if (exec_bfd) write_pc (bfd_get_start_address (exec_bfd)); @@ -3321,6 +3334,7 @@ _initialize_remote_mips (void) mips_ops.to_load = mips_load; mips_ops.to_create_inferior = mips_create_inferior; mips_ops.to_mourn_inferior = mips_mourn_inferior; + mips_ops.to_log_command = serial_log_command; mips_ops.to_stratum = process_stratum; mips_ops.to_has_all_memory = 1; mips_ops.to_has_memory = 1;