* ppc-opc.c: Support optional L form mtmsr.
[deliverable/binutils-gdb.git] / gdb / monitor.c
index 550f8afa80be5df728e2c92758ae0decaf22b586..41308ded476f8f8a56a564879bc789c9a62f854a 100644 (file)
@@ -1,7 +1,7 @@
 /* Remote debugging interface for boot monitors, for GDB.
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2006, 2007 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.  Written by Rob Savoye for Cygnus.
    Resurrected from the ashes by Stu Grossman.
@@ -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 <http://www.gnu.org/licenses/>.  */
 
 /* This file was derived from various remote-* modules. It is a collection
    of generic support functions so GDB can talk directly to a ROM based
@@ -885,7 +883,9 @@ monitor_supply_register (struct regcache *regcache, int regno, char *valstr)
 
   /* supply register stores in target byte order, so swap here */
 
-  store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), val);
+  store_unsigned_integer (regbuf,
+                         register_size (get_regcache_arch (regcache), regno),
+                         val);
 
   regcache_raw_supply (regcache, regno, regbuf);
 
@@ -1109,10 +1109,10 @@ monitor_wait (ptid_t ptid, struct target_waitstatus *status)
     }
 
   if (current_monitor->register_pattern)
-    parse_register_dump (current_regcache, buf, resp_len);
+    parse_register_dump (get_current_regcache (), buf, resp_len);
 #else
   monitor_debug ("Wait fetching registers after stop\n");
-  monitor_dump_regs (current_regcache);
+  monitor_dump_regs (get_current_regcache ());
 #endif
 
   status->kind = TARGET_WAITKIND_STOPPED;
@@ -1192,7 +1192,7 @@ monitor_fetch_register (struct regcache *regcache, int regno)
      spaces, but stop reading if something else is seen.  Some monitors
      like to drop leading zeros.  */
 
-  for (i = 0; i < register_size (current_gdbarch, regno) * 2; i++)
+  for (i = 0; i < register_size (get_regcache_arch (regcache), regno) * 2; i++)
     {
       int c;
       c = readchar (timeout);
@@ -1279,7 +1279,8 @@ monitor_fetch_registers (struct regcache *regcache, int regno)
          return;
        }
 
-      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+      for (regno = 0; regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno++)
        monitor_fetch_register (regcache, regno);
     }
   else
@@ -1309,7 +1310,8 @@ monitor_store_register (struct regcache *regcache, int regno)
 
   regcache_cooked_read_unsigned (regcache, regno, &val);
   monitor_debug ("MON storeg %d %s\n", regno,
-                phex (val, register_size (current_gdbarch, regno)));
+                phex (val,
+                      register_size (get_regcache_arch (regcache), regno)));
 
   /* send the register deposit command */
 
@@ -1356,7 +1358,8 @@ monitor_store_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+  for (regno = 0; regno < gdbarch_num_regs (get_regcache_arch (regcache));
+       regno++)
     monitor_store_register (regcache, regno);
 }
 
@@ -1388,7 +1391,7 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
   monitor_debug ("MON write %d %s\n", len, paddr (memaddr));
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    memaddr = ADDR_BITS_REMOVE (memaddr);
+    memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr);
 
   /* Use memory fill command for leading 0 bytes.  */
 
@@ -1787,7 +1790,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
                 paddr_nz (memaddr), (long) myaddr, len);
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    memaddr = ADDR_BITS_REMOVE (memaddr);
+    memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr);
 
   if (current_monitor->flags & MO_GETMEM_READ_SINGLE)
     return monitor_read_memory_single (memaddr, myaddr, len);
@@ -2013,7 +2016,7 @@ monitor_insert_breakpoint (struct bp_target_info *bp_tgt)
     error (_("No set_break defined for this monitor"));
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    addr = ADDR_BITS_REMOVE (addr);
+    addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
 
   /* Determine appropriate breakpoint size for this address.  */
   bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen);
@@ -2230,6 +2233,7 @@ init_base_monitor_ops (void)
   monitor_ops.to_mourn_inferior = monitor_mourn_inferior;
   monitor_ops.to_stop = monitor_stop;
   monitor_ops.to_rcmd = monitor_rcmd;
+  monitor_ops.to_log_command = serial_log_command;
   monitor_ops.to_stratum = process_stratum;
   monitor_ops.to_has_all_memory = 1;
   monitor_ops.to_has_memory = 1;
This page took 0.030124 seconds and 4 git commands to generate.