* config/tc-dvp.c (VU_LABEL_PREFIX): New macro.
[deliverable/binutils-gdb.git] / gdb / remote-sim.c
index 0bdb3542646bbe3a5a25ed16bb28e5629b306c27..4ec4cd392470f99b802cc0be19b612c8aee6cabd 100644 (file)
@@ -337,18 +337,29 @@ gdb_os_error (p, va_alist)
 
 static void
 gdbsim_fetch_register (regno)
-int regno;
+     int regno;
 {
+  static int warn_user = 1;
   if (regno == -1) 
     {
       for (regno = 0; regno < NUM_REGS; regno++)
        gdbsim_fetch_register (regno);
     }
-  else
+  else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
     {
       char buf[MAX_REGISTER_RAW_SIZE];
-
-      sim_fetch_register (gdbsim_desc, regno, buf);
+      int nr_bytes = sim_fetch_register (gdbsim_desc, regno, buf, REGISTER_RAW_SIZE (regno));
+      if (nr_bytes == 0)
+       /* register not applicable, supply zero's */
+       memset (buf, 0, MAX_REGISTER_RAW_SIZE);
+      else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)
+              && warn_user)
+       {
+         printf_unfiltered ("Size of register %s (%d) incorrect (%d instead of %d))",
+                            reg_names [regno], regno,
+                            nr_bytes, REGISTER_RAW_SIZE (regno));
+         warn_user = 0;
+       }
       supply_register (regno, buf);
       if (sr_get_debug ())
        {
@@ -362,19 +373,21 @@ int regno;
 
 static void
 gdbsim_store_register (regno)
-int regno;
+     int regno;
 {
   if (regno  == -1) 
     {
       for (regno = 0; regno < NUM_REGS; regno++)
        gdbsim_store_register (regno);
     }
-  else
+  else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
     {
-      /* FIXME: Until read_register() returns LONGEST, we have this.  */
       char tmp[MAX_REGISTER_RAW_SIZE];
+      int nr_bytes;
       read_register_gen (regno, tmp);
-      sim_store_register (gdbsim_desc, regno, tmp);
+      nr_bytes = sim_store_register (gdbsim_desc, regno, tmp, REGISTER_RAW_SIZE (regno));
+      if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
+       fatal ("Register size different to expected");
       if (sr_get_debug ())
        {
          printf_filtered ("gdbsim_store_register: %d", regno);
@@ -474,6 +487,8 @@ gdbsim_create_inferior (exec_file, args, env)
   inferior_pid = 42;
   insert_breakpoints (); /* Needed to get correct instruction in cache */
 
+  clear_proceed_status ();
+
   /* NB: Entry point already set by sim_create_inferior. */
   proceed ((CORE_ADDR)-1, TARGET_SIGNAL_DEFAULT, 0);
 }
@@ -506,7 +521,7 @@ gdbsim_open (args, from_tty)
 
   len = (7 + 1 /* gdbsim */
         + strlen (" -E little")
-        + strlen (" --arch=xxxxxxxxxx")
+        + strlen (" --architecture=xxxxxxxxxx")
         + (args ? strlen (args) : 0)
         + 50) /* slack */;
   arg_buf = (char *) alloca (len);
@@ -533,7 +548,7 @@ gdbsim_open (args, from_tty)
      explicitly specified */
   if (!target_architecture_auto)
     {
-      strcat (arg_buf, " --arch=");
+      strcat (arg_buf, " --architecture=");
       strcat (arg_buf, target_architecture->printable_name);
     }
   /* finally, any explicit args */
@@ -672,7 +687,8 @@ gdb_os_poll_quit (p)
    just as `wait' would. */
 
 static void
-gdbsim_cntrl_c (int signo)
+gdbsim_cntrl_c (signo)
+     int signo;
 {
   gdbsim_stop ();
 }
@@ -689,7 +705,18 @@ gdbsim_wait (pid, status)
   if (sr_get_debug ())
     printf_filtered ("gdbsim_wait\n");
 
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+  {
+    struct sigaction sa, osa;
+    sa.sa_handler = gdbsim_cntrl_c;
+    sigemptyset (&sa.sa_mask);
+    sa.sa_flags = 0;
+    sigaction (SIGINT, &sa, &osa);
+    prev_sigint = osa.sa_handler;
+  }
+#else
   prev_sigint = signal (SIGINT, gdbsim_cntrl_c);
+#endif
   sim_resume (gdbsim_desc, resume_step,
              target_signal_to_host (resume_siggnal));
   signal (SIGINT, prev_sigint);
This page took 0.026604 seconds and 4 git commands to generate.