* target.h: Add enum target_waitkind, enum target_signal, and
[deliverable/binutils-gdb.git] / gdb / remote-vx.c
index cb67787463bf4e90900fcd8f6dc8ea7dbe5577c2..abbd918dfaf9b431458da6ba29c3a506365f25b9 100644 (file)
@@ -459,7 +459,7 @@ vx_write_register (regno)
 
   in_data.bytes = registers;
 
-  in_data.len = VX_NUM_REGS * sizeof (REGISTER_TYPE);
+  in_data.len = VX_NUM_REGS * REGISTER_SIZE;
 
   /* XXX change second param to be a proc number */
   status = net_ptrace_clnt_call (PTRACE_SETREGS, &ptrace_in, &ptrace_out);
@@ -557,32 +557,35 @@ vx_xfer_memory (memaddr, myaddr, len, write, target)
 static void
 vx_files_info ()
 {
-  printf ("\tAttached to host `%s'", vx_host);
-  printf (", which has %sfloating point", target_has_fp? "": "no ");
-  printf (".\n");
+  printf_unfiltered ("\tAttached to host `%s'", vx_host);
+  printf_unfiltered (", which has %sfloating point", target_has_fp? "": "no ");
+  printf_unfiltered (".\n");
 }
 
 static void
 vx_run_files_info ()
 {
-  printf ("\tRunning %s VxWorks process %s", 
+  printf_unfiltered ("\tRunning %s VxWorks process %s", 
          vx_running? "child": "attached",
          local_hex_string((unsigned long) inferior_pid));
   if (vx_running)
-    printf (", function `%s'", vx_running);
-  printf(".\n");
+    printf_unfiltered (", function `%s'", vx_running);
+  printf_unfiltered(".\n");
 }
 
 static void
 vx_resume (pid, step, siggnal)
      int pid;
      int step;
-     int siggnal;
+     enum target_signal siggnal;
 {
   int status;
   Rptrace ptrace_in;
   Ptrace_return ptrace_out;
 
+  if (pid == -1)
+    pid = inferior_pid;
+
   if (siggnal != 0 && siggnal != stop_signal)
     error ("Cannot send signals to VxWorks processes");
 
@@ -855,11 +858,11 @@ sleep_ms (ms)
  */
 
 static int
-vx_wait (status)
-     int *status;
+vx_wait (pid_to_wait_for, status)
+     int pid_to_wait_for;
+     struct target_waitstatus *status;
 {
   register int pid;
-  WAITTYPE w;
   RDB_EVENT rdbEvent;
   int quit_failed;
 
@@ -908,51 +911,48 @@ vx_wait (status)
               local_hex_string((unsigned long) pid));
     } while (pid == 0);
 
-  /* FIXME, eventually do more then SIGTRAP on everything...  */
+  /* The mostly likely kind.  */
+  status->kind = TARGET_WAITKIND_STOPPED;
+
   switch (rdbEvent.eventType)
     {
     case EVENT_EXIT:
-      WSETEXIT (w, 0);
+      status->kind = TARGET_WAITKIND_EXITED;
       /* FIXME is it possible to distinguish between a
-        XXX   normal vs abnormal exit in VxWorks? */
+        normal vs abnormal exit in VxWorks? */
+      status->value.integer = 0;
       break;
 
-    case EVENT_START:          /* Task was just started. */
-      WSETSTOP (w, SIGTRAP);
+    case EVENT_START:
+      /* Task was just started. */
+      status->value.sig = TARGET_SIGNAL_TRAP;
       break;
 
     case EVENT_STOP:
-      WSETSTOP (w, SIGTRAP);
+      status->value.sig = TARGET_SIGNAL_TRAP;
       /* XXX was it stopped by a signal?  act accordingly */
       break;
 
     case EVENT_BREAK:          /* Breakpoint was hit. */
-      WSETSTOP (w, SIGTRAP);
+      status->value.sig = TARGET_SIGNAL_TRAP;
       break;
 
     case EVENT_SUSPEND:                /* Task was suspended, probably by ^C. */
-      WSETSTOP (w, SIGINT);
+      status->value.sig = TARGET_SIGNAL_INT;
       break;
 
     case EVENT_BUS_ERR:                /* Task made evil nasty reference. */
-      WSETSTOP (w, SIGBUS);
+      status->value.sig = TARGET_SIGNAL_BUS;
       break;
 
     case EVENT_ZERO_DIV:       /* Division by zero */
-      WSETSTOP (w, SIGFPE);    /* Like Unix, call it a float exception. */
+      status->value.sig = TARGET_SIGNAL_FPE;
       break;
 
     case EVENT_SIGNAL:
-      /* The target is not running Unix, and its
-        faults/traces do not map nicely into Unix signals.
-        Make sure they do not get confused with Unix signals
-        by numbering them with values higher than the highest
-        legal Unix signal.  code in the arch-dependent PRINT_RANDOM_SIGNAL
-        routine will interpret the value for wait_for_inferior.  */
-      WSETSTOP (w, rdbEvent.sigType + NSIG);
+      status->value.sig = i960_fault_to_signal (rdbEvent.sigType);
       break;
     } /* switch */
-  *status = *(int *)&w;                /* Grumble union wait crap Grumble */
   return pid;
 }
 \f
@@ -970,9 +970,9 @@ add_symbol_stub (arg)
 {
   struct ldfile *pLoadFile = (struct ldfile *)arg;
 
-  printf("\t%s: ", pLoadFile->name);
+  printf_unfiltered("\t%s: ", pLoadFile->name);
   symbol_file_add (pLoadFile->name, 0, pLoadFile->txt_addr, 0, 0, 0);
-  printf ("ok\n");
+  printf_unfiltered ("ok\n");
   return 1;
 }
 /* Target command for VxWorks target systems.
@@ -1000,8 +1000,8 @@ vx_open (args, from_tty)
   target_preopen (from_tty);
   
   unpush_target (&vx_ops);
-  printf ("Attaching remote machine across net...\n");
-  fflush (stdout);
+  printf_unfiltered ("Attaching remote machine across net...\n");
+  gdb_flush (gdb_stdout);
 
   /* Allow the user to kill the connect attempt by typing ^C.
      Wait until the call to target_has_fp () completes before
@@ -1035,7 +1035,7 @@ vx_open (args, from_tty)
             "Error while reading symbols from boot file:\n", RETURN_MASK_ALL))
          puts_filtered ("ok\n");
       } else if (from_tty)
-       printf ("VxWorks kernel symbols not loaded.\n");
+       printf_unfiltered ("VxWorks kernel symbols not loaded.\n");
     }
   else
     error ("Can't retrieve boot file name from target machine.");
@@ -1099,7 +1099,7 @@ vx_attach (args, from_tty)
     error ("Invalid process-id -- give a single number in decimal or 0xhex");
 
   if (from_tty)
-      printf ("Attaching pid %s.\n",
+      printf_unfiltered ("Attaching pid %s.\n",
              local_hex_string((unsigned long) pid));
 
   memset ((char *)&ptrace_in,  '\0', sizeof (ptrace_in));
@@ -1145,7 +1145,7 @@ vx_detach (args, from_tty)
     error ("Argument given to VxWorks \"detach\".");
 
   if (from_tty)
-      printf ("Detaching pid %s.\n",
+      printf_unfiltered ("Detaching pid %s.\n",
              local_hex_string((unsigned long) inferior_pid));
 
   if (args)            /* FIXME, should be possible to leave suspended */
@@ -1177,7 +1177,7 @@ vx_kill ()
   Ptrace_return ptrace_out;
   int status;
 
-  printf ("Killing pid %s.\n", local_hex_string((unsigned long) inferior_pid));
+  printf_unfiltered ("Killing pid %s.\n", local_hex_string((unsigned long) inferior_pid));
 
   memset ((char *)&ptrace_in,  '\0', sizeof (ptrace_in));
   memset ((char *)&ptrace_out, '\0', sizeof (ptrace_out));
This page took 0.026675 seconds and 4 git commands to generate.