2007-07-03 Paul Gilliam <pgilliam@us.ibm.com>
[deliverable/binutils-gdb.git] / gdb / monitor.c
index 6266ab09ffecd5bbb158691a4c7d8812e3bdcf0b..efcd047f23c94ebdcb48143acf76889587b2f5f2 100644 (file)
@@ -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;
@@ -1129,7 +1129,7 @@ monitor_wait (ptid_t ptid, struct target_waitstatus *status)
    errno value.  */
 
 static void
-monitor_fetch_register (int regno)
+monitor_fetch_register (struct regcache *regcache, int regno)
 {
   const char *name;
   char *zerobuf;
@@ -1149,7 +1149,7 @@ monitor_fetch_register (int regno)
   if (!name || (*name == '\0'))
     {
       monitor_debug ("No register known for %d\n", regno);
-      regcache_raw_supply (current_regcache, regno, zerobuf);
+      regcache_raw_supply (regcache, regno, zerobuf);
       return;
     }
 
@@ -1228,7 +1228,7 @@ monitor_fetch_register (int regno)
       current_monitor->getreg.term_cmd)                /* ack expected */
     monitor_expect_prompt (NULL, 0);   /* get response */
 
-  monitor_supply_register (current_regcache, regno, regbuf);
+  monitor_supply_register (regcache, regno, regbuf);
 }
 
 /* Sometimes, it takes several commands to dump the registers */
@@ -1268,30 +1268,30 @@ monitor_dump_regs (struct regcache *regcache)
 }
 
 static void
-monitor_fetch_registers (int regno)
+monitor_fetch_registers (struct regcache *regcache, int regno)
 {
   monitor_debug ("MON fetchregs\n");
   if (current_monitor->getreg.cmd)
     {
       if (regno >= 0)
        {
-         monitor_fetch_register (regno);
+         monitor_fetch_register (regcache, regno);
          return;
        }
 
-      for (regno = 0; regno < NUM_REGS; regno++)
-       monitor_fetch_register (regno);
+      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+       monitor_fetch_register (regcache, regno);
     }
   else
     {
-      monitor_dump_regs (current_regcache);
+      monitor_dump_regs (regcache);
     }
 }
 
 /* Store register REGNO, or all if REGNO == 0.  Return errno value.  */
 
 static void
-monitor_store_register (int regno)
+monitor_store_register (struct regcache *regcache, int regno)
 {
   const char *name;
   ULONGEST val;
@@ -1307,7 +1307,7 @@ monitor_store_register (int regno)
       return;
     }
 
-  val = read_register (regno);
+  regcache_cooked_read_unsigned (regcache, regno, &val);
   monitor_debug ("MON storeg %d %s\n", regno,
                 phex (val, register_size (current_gdbarch, regno)));
 
@@ -1348,16 +1348,16 @@ monitor_store_register (int regno)
 /* Store the remote registers.  */
 
 static void
-monitor_store_registers (int regno)
+monitor_store_registers (struct regcache *regcache, int regno)
 {
   if (regno >= 0)
     {
-      monitor_store_register (regno);
+      monitor_store_register (regcache, regno);
       return;
     }
 
-  for (regno = 0; regno < NUM_REGS; regno++)
-    monitor_store_register (regno);
+  for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+    monitor_store_register (regcache, regno);
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -1367,7 +1367,7 @@ monitor_store_registers (int regno)
    debugged.  */
 
 static void
-monitor_prepare_to_store (void)
+monitor_prepare_to_store (struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs */
 }
@@ -1388,7 +1388,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 +1787,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 +2013,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);
This page took 0.027841 seconds and 4 git commands to generate.