* symfile.h (struct sym_fns): Add new field sym_read_linetable.
[deliverable/binutils-gdb.git] / gdb / remote-sim.c
index 2d8f3a73cb18e6af95e7fc3d4f54cdaf36f8e5a8..fcfb55ef6c05cd3feb6c865047c3e27ea9fe8bdb 100644 (file)
@@ -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/>.  */
 
 #include "defs.h"
 #include "inferior.h"
@@ -73,9 +71,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 +89,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 +272,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 +297,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 +329,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 +343,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 +736,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.029254 seconds and 4 git commands to generate.