Remove definition of EM_MIPS_RS4_BE. The constant was never in active use
[deliverable/binutils-gdb.git] / gdb / lin-lwp.c
index 58ad3c5857ee52b267d5b422622eca45e6dbaf3c..2d2a2b6d9f579c6e96515f8a0a2ca40296b5cc5d 100644 (file)
@@ -102,18 +102,10 @@ static int num_lwps;
 static int threaded;
 \f
 
-#ifndef TIDGET
-#define TIDGET(PID)            (((PID) & 0x7fffffff) >> 16)
-#define PIDGET0(PID)           (((PID) & 0xffff))
-#define PIDGET(PID)            ((PIDGET0 (PID) == 0xffff) ? -1 : PIDGET0 (PID))
-#define MERGEPID(PID, TID)     (((PID) & 0xffff) | ((TID) << 16))
-#endif
-
-#define THREAD_FLAG            0x80000000
-#define is_lwp(pid)            (((pid) & THREAD_FLAG) == 0 && TIDGET (pid))
-#define GET_LWP(pid)           TIDGET (pid)
-#define GET_PID(pid)           PIDGET (pid)
-#define BUILD_LWP(tid, pid)    MERGEPID (pid, tid)
+#define GET_LWP(ptid)          ptid_get_lwp (ptid)
+#define GET_PID(ptid)          ptid_get_pid (ptid)
+#define is_lwp(ptid)           (GET_LWP (ptid) != 0)
+#define BUILD_LWP(lwp, pid)    ptid_build (pid, lwp, 0)
 
 #define is_cloned(pid) (GET_LWP (pid) != GET_PID (pid))
 
@@ -267,27 +259,6 @@ iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
 }
 \f
 
-/* Helper functions.  */
-
-static void
-restore_inferior_ptid (void *arg)
-{
-  ptid_t *saved_ptid_ptr = arg;
-  inferior_ptid = *saved_ptid_ptr;
-  xfree (arg);
-}
-
-static struct cleanup *
-save_inferior_ptid (void)
-{
-  ptid_t *saved_ptid_ptr;
-
-  saved_ptid_ptr = xmalloc (sizeof (ptid_t));
-  *saved_ptid_ptr = inferior_ptid;
-  return make_cleanup (restore_inferior_ptid, saved_ptid_ptr);
-}
-\f
-
 /* Implementation of the PREPARE_TO_PROCEED hook for the Linux LWP
    layer.
 
@@ -369,7 +340,7 @@ lin_lwp_attach (char *args, int from_tty)
   child_ops.to_attach (args, from_tty);
 
   /* Add the initial process as the first LWP to the list.  */
-  lp = add_lwp (BUILD_LWP (inferior_ptid, inferior_ptid));
+  lp = add_lwp (BUILD_LWP (PIDGET (inferior_ptid), PIDGET (inferior_ptid)));
 
   /* Make sure the initial process is stopped.  The user-level threads
      layer might want to poke around in the inferior, and that won't
@@ -388,7 +359,7 @@ detach_callback (struct lwp_info *lp, void *data)
   gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
 
   if (debug_lin_lwp && lp->status)
-    fprintf_unfiltered (gdb_stdlog, "Pending %s for LWP %d on detach.\n",
+    fprintf_unfiltered (gdb_stdlog, "Pending %s for LWP %ld on detach.\n",
                        strsignal (WSTOPSIG (lp->status)), GET_LWP (lp->ptid));
 
   while (lp->signalled && lp->stopped)
@@ -435,7 +406,7 @@ lin_lwp_detach (char *args, int from_tty)
   sigprocmask (SIG_SETMASK, &normal_mask, NULL);
   sigemptyset (&blocked_mask);
 
-  inferior_ptid = GET_PID (inferior_ptid);
+  inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
   child_ops.to_detach (args, from_tty);
 }
 \f
@@ -705,8 +676,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
        {
          if (debug_lin_lwp)
            fprintf_unfiltered (gdb_stdlog, 
-                               "Using pending wait status for LWP %d.\n",
-                               (int) GET_LWP (lp->ptid));
+                               "Using pending wait status for LWP %ld.\n",
+                               GET_LWP (lp->ptid));
 
          status = lp->status;
          lp->status = 0;
@@ -721,8 +692,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
     {
       if (debug_lin_lwp)
        fprintf_unfiltered (gdb_stdlog, 
-                           "Waiting for specific LWP %d.\n",
-                           (int) GET_LWP (ptid));
+                           "Waiting for specific LWP %ld.\n",
+                           GET_LWP (ptid));
 
       /* We have a specific LWP to check.  */
       lp = find_lwp_pid (ptid);
@@ -733,7 +704,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
       if (debug_lin_lwp)
        if (status)
          fprintf_unfiltered (gdb_stdlog, 
-                             "Using pending wait status for LWP %d.\n",
+                             "Using pending wait status for LWP %ld.\n",
                              GET_LWP (lp->ptid));
 
       /* If we have to wait, take into account whether PID is a cloned
This page took 0.024554 seconds and 4 git commands to generate.