* ada-lang.c (resolve_subexp): Correct arity of binary operators.
[deliverable/binutils-gdb.git] / gdb / remote-sim.c
index 2d8f3a73cb18e6af95e7fc3d4f54cdaf36f8e5a8..48bb1277b5a24dbb9737f32c9c47eea02d25627c 100644 (file)
@@ -73,9 +73,9 @@ static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
 
 static void gdb_os_error (host_callback *, const char *, ...);
 
-static void gdbsim_fetch_register (int regno);
+static void gdbsim_fetch_register (struct regcache *regcache, int regno);
 
-static void gdbsim_store_register (int regno);
+static void gdbsim_store_register (struct regcache *regcache, int regno);
 
 static void gdbsim_kill (void);
 
@@ -91,7 +91,7 @@ static void gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal);
 
 static ptid_t gdbsim_wait (ptid_t ptid, struct target_waitstatus *status);
 
-static void gdbsim_prepare_to_store (void);
+static void gdbsim_prepare_to_store (struct regcache *regcache);
 
 static void gdbsim_files_info (struct target_ops *target);
 
@@ -274,21 +274,21 @@ int
 one2one_register_sim_regno (int regnum)
 {
   /* Only makes sense to supply raw registers.  */
-  gdb_assert (regnum >= 0 && regnum < NUM_REGS);
+  gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch));
   return regnum;
 }
 
 static void
-gdbsim_fetch_register (int regno)
+gdbsim_fetch_register (struct regcache *regcache, int regno)
 {
   if (regno == -1)
     {
-      for (regno = 0; regno < NUM_REGS; regno++)
-       gdbsim_fetch_register (regno);
+      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+       gdbsim_fetch_register (regcache, regno);
       return;
     }
 
-  switch (REGISTER_SIM_REGNO (regno))
+  switch (gdbarch_register_sim_regno (current_gdbarch, regno))
     {
     case LEGACY_SIM_REGNO_IGNORE:
       break;
@@ -299,26 +299,30 @@ gdbsim_fetch_register (int regno)
        char buf[MAX_REGISTER_SIZE];
        int nr_bytes;
        memset (buf, 0, MAX_REGISTER_SIZE);
-       regcache_raw_supply (current_regcache, regno, buf);
-       set_register_cached (regno, -1);
+       regcache_raw_supply (regcache, regno, buf);
        break;
       }
+      
     default:
       {
        static int warn_user = 1;
        char buf[MAX_REGISTER_SIZE];
        int nr_bytes;
-       gdb_assert (regno >= 0 && regno < NUM_REGS);
+       gdb_assert (regno >= 0 && regno < gdbarch_num_regs (current_gdbarch));
        memset (buf, 0, MAX_REGISTER_SIZE);
        nr_bytes = sim_fetch_register (gdbsim_desc,
-                                      REGISTER_SIM_REGNO (regno),
-                                      buf, register_size (current_gdbarch, regno));
+                                      gdbarch_register_sim_regno
+                                        (current_gdbarch, regno),
+                                      buf,
+                                      register_size (current_gdbarch, regno));
        if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user)
          {
            fprintf_unfiltered (gdb_stderr,
                                "Size of register %s (%d/%d) incorrect (%d instead of %d))",
-                               REGISTER_NAME (regno),
-                               regno, REGISTER_SIM_REGNO (regno),
+                               gdbarch_register_name (current_gdbarch, regno),
+                               regno,
+                               gdbarch_register_sim_regno
+                                 (current_gdbarch, regno),
                                nr_bytes, register_size (current_gdbarch, regno));
            warn_user = 0;
          }
@@ -327,7 +331,7 @@ gdbsim_fetch_register (int regno)
           which registers are fetchable.  */
        /* Else if (nr_bytes < 0): an old simulator, that doesn't
           think to return the register size.  Just assume all is ok.  */
-       regcache_raw_supply (current_regcache, regno, buf);
+       regcache_raw_supply (regcache, regno, buf);
        if (remote_debug)
          {
            printf_filtered ("gdbsim_fetch_register: %d", regno);
@@ -341,21 +345,22 @@ gdbsim_fetch_register (int regno)
 
 
 static void
-gdbsim_store_register (int regno)
+gdbsim_store_register (struct regcache *regcache, int regno)
 {
   if (regno == -1)
     {
-      for (regno = 0; regno < NUM_REGS; regno++)
-       gdbsim_store_register (regno);
+      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+       gdbsim_store_register (regcache, regno);
       return;
     }
-  else if (REGISTER_SIM_REGNO (regno) >= 0)
+  else if (gdbarch_register_sim_regno (current_gdbarch, regno) >= 0)
     {
       char tmp[MAX_REGISTER_SIZE];
       int nr_bytes;
-      regcache_cooked_read (current_regcache, regno, tmp);
+      regcache_cooked_read (regcache, regno, tmp);
       nr_bytes = sim_store_register (gdbsim_desc,
-                                    REGISTER_SIM_REGNO (regno),
+                                    gdbarch_register_sim_regno
+                                      (current_gdbarch, regno),
                                     tmp, register_size (current_gdbarch, regno));
       if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno))
        internal_error (__FILE__, __LINE__,
@@ -733,7 +738,7 @@ gdbsim_wait (ptid_t ptid, struct target_waitstatus *status)
    debugged.  */
 
 static void
-gdbsim_prepare_to_store (void)
+gdbsim_prepare_to_store (struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs */
 }
This page took 0.025204 seconds and 4 git commands to generate.