gdb/
[deliverable/binutils-gdb.git] / gdb / gdbserver / nto-low.c
index d82e951423196798e797d053df3486a710f1fcda..73618cdd29006c8207eeb9c57d0f5dd0fe722ca5 100644 (file)
@@ -1,6 +1,6 @@
 /* QNX Neutrino specific low level interface, for the remote server
    for GDB.
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,6 +19,7 @@
 
 
 #include "server.h"
+#include "gdbthread.h"
 #include "nto-low.h"
 
 #include <limits.h>
@@ -174,7 +175,7 @@ do_attach (pid_t pid)
       close (nto_inferior.ctl_fd);
       init_nto_inferior (&nto_inferior);
     }
-  snprintf (nto_inferior.nto_procfs_path, PATH_MAX - 1, "/proc/%d/as", pid);
+  xsnprintf (nto_inferior.nto_procfs_path, PATH_MAX - 1, "/proc/%d/as", pid);
   nto_inferior.ctl_fd = open (nto_inferior.nto_procfs_path, O_RDWR);
   if (nto_inferior.ctl_fd == -1)
     {
@@ -406,6 +407,12 @@ nto_detach (int pid)
   return 0;
 }
 
+static void
+nto_mourn (struct process_info *process)
+{
+  remove_process (process);
+}
+
 /* Check if the given thread is alive.  
 
    Return 1 if alive, 0 otherwise.  */
@@ -525,14 +532,14 @@ nto_wait (ptid_t ptid,
     {
       TRACE ("SSTEP\n");
       ourstatus->kind = TARGET_WAITKIND_STOPPED;
-      ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+      ourstatus->value.sig = GDB_SIGNAL_TRAP;
     }
   /* Was it a breakpoint?  */
   else if (status.flags & trace_mask)
     {
       TRACE ("STOPPED\n");
       ourstatus->kind = TARGET_WAITKIND_STOPPED;
-      ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+      ourstatus->value.sig = GDB_SIGNAL_TRAP;
     }
   else if (status.flags & _DEBUG_FLAG_ISTOP)
     {
@@ -543,7 +550,7 @@ nto_wait (ptid_t ptid,
          TRACE ("  SIGNALLED\n");
          ourstatus->kind = TARGET_WAITKIND_STOPPED;
          ourstatus->value.sig =
-           target_signal_from_host (status.info.si_signo);
+           gdb_signal_from_host (status.info.si_signo);
          nto_inferior.exit_signo = ourstatus->value.sig;
          break;
        case _DEBUG_WHY_FAULTED:
@@ -557,7 +564,7 @@ nto_wait (ptid_t ptid,
          else
            {
              ourstatus->value.sig =
-               target_signal_from_host (status.info.si_signo);
+               gdb_signal_from_host (status.info.si_signo);
              nto_inferior.exit_signo = ourstatus->value.sig;
            }
          break;
@@ -588,7 +595,7 @@ nto_wait (ptid_t ptid,
          TRACE ("REQUESTED\n");
          /* We are assuming a requested stop is due to a SIGINT.  */
          ourstatus->kind = TARGET_WAITKIND_STOPPED;
-         ourstatus->value.sig = TARGET_SIGNAL_INT;
+         ourstatus->value.sig = GDB_SIGNAL_INT;
          nto_inferior.exit_signo = 0;
          break;
        }
@@ -601,7 +608,7 @@ nto_wait (ptid_t ptid,
    If REGNO is -1, fetch all registers, or REGNO register only otherwise.  */
 
 static void
-nto_fetch_registers (int regno)
+nto_fetch_registers (struct regcache *regcache, int regno)
 {
   int regsize;
   procfs_greg greg;
@@ -629,7 +636,8 @@ nto_fetch_registers (int regno)
            {
              const unsigned int registeroffset
                = the_low_target.register_offset (regno);
-             supply_register (regno, ((char *)&greg) + registeroffset);
+             supply_register (regcache, regno,
+                              ((char *)&greg) + registeroffset);
            }
        }
       else
@@ -638,7 +646,7 @@ nto_fetch_registers (int regno)
            = the_low_target.register_offset (regno);
          if (registeroffset == -1)
            return;
-         supply_register (regno, ((char *)&greg) + registeroffset);
+         supply_register (regcache, regno, ((char *)&greg) + registeroffset);
        }
     }
   else
@@ -649,7 +657,7 @@ nto_fetch_registers (int regno)
    We always store all registers, regardless of REGNO.  */
 
 static void
-nto_store_registers (int regno)
+nto_store_registers (struct regcache *regcache, int regno)
 {
   procfs_greg greg;
   int err;
@@ -671,7 +679,7 @@ nto_store_registers (int regno)
     {
       const unsigned int regoffset
        = the_low_target.register_offset (regno);
-      collect_register (regno, ((char *)&greg) + regoffset);
+      collect_register (regcache, regno, ((char *)&greg) + regoffset);
     }
   err = devctl (nto_inferior.ctl_fd, DCMD_PROC_SETGREG, &greg, sizeof (greg),
                0);
@@ -900,12 +908,15 @@ static struct target_ops nto_target_ops = {
   nto_attach,
   nto_kill,
   nto_detach,
+  nto_mourn,
   NULL, /* nto_join */
   nto_thread_alive,
   nto_resume,
   nto_wait,
   nto_fetch_registers,
   nto_store_registers,
+  NULL, /* prepare_to_access_memory */
+  NULL, /* done_accessing_memory */
   nto_read_memory,
   nto_write_memory,
   NULL, /* nto_look_up_symbols */
This page took 0.027609 seconds and 4 git commands to generate.