* config/tc-alpha.c (O_samegp): New.
[external/binutils.git] / gdb / lin-thread.c
index 495fb43..a14af7b 100644 (file)
 /* Prototypes for supply_gregset etc. */
 #include "gregset.h"
 
-#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
-
 /* Macros for superimposing PID and TID into inferior_ptid.  */
-#define THREAD_FLAG            0x80000000
-#define is_thread(ARG)         (((ARG) & THREAD_FLAG) != 0)
-#define is_lwp(ARG)            (((ARG) & THREAD_FLAG) == 0)
-#define GET_LWP(PID)           TIDGET (PID)
-#define GET_THREAD(PID)                TIDGET (PID)
-#define BUILD_LWP(TID, PID)    MERGEPID (PID, TID)
-#define BUILD_THREAD(TID, PID) (MERGEPID (PID, TID) | THREAD_FLAG)
+#define GET_PID(ptid)          ptid_get_pid (ptid)
+#define GET_LWP(ptid)          ptid_get_lwp (ptid)
+#define GET_THREAD(ptid)       ptid_get_tid (ptid)
+
+#define is_lwp(ptid)           (GET_LWP (ptid) != 0)
+#define is_thread(ptid)                (GET_THREAD (ptid) != 0)
+
+#define BUILD_LWP(lwp, pid)    ptid_build (pid, lwp, 0)
+#define BUILD_THREAD(tid, pid) ptid_build (pid, 0, tid)
+
+/* From linux-thread.c.  FIXME: These should go in a separate header
+   file, but I'm told that the life expectancy of lin-thread.c and
+   linux-thread.c isn't very long... */
+
+extern int linux_child_wait (int, int *, int *);
+extern void check_all_signal_numbers (void);
+extern void linuxthreads_discard_global_state (void);
+extern void attach_thread (int);
 
 /*
  * target_beneath is a pointer to the target_ops underlying this one.
@@ -304,8 +308,6 @@ ps_ptwrite (gdb_ps_prochandle_t ph, /* write to text segment */
   return rw_common (ph, addr, (char *) buf, size, PS_WRITE);
 }
 
-static struct cleanup *save_inferior_ptid    (void);
-static void            restore_inferior_ptid (void *saved_pid);
 static char *thr_err_string   (td_err_e);
 static char *thr_state_string (td_thr_state_e);
 
@@ -623,52 +625,6 @@ init_thread_db_library (void)
  * Local utility functions:
  */
 
-
-/*
-
-   LOCAL FUNCTION
-
-   save_inferior_ptid - Save inferior_ptid on the cleanup list
-   restore_inferior_ptid - Restore inferior_ptid from the cleanup list
-
-   SYNOPSIS
-
-   struct cleanup *save_inferior_ptid (void);
-   void            restore_inferior_ptid (void *saved_pid);
-
-   DESCRIPTION
-
-   These two functions act in unison to restore inferior_ptid in
-   case of an error.
-
-   NOTES
-
-   inferior_ptid is a global variable that needs to be changed by many
-   of these routines before calling functions in procfs.c.  In order
-   to guarantee that inferior_ptid gets restored (in case of errors),
-   you need to call save_inferior_ptid before changing it.  At the end
-   of the function, you should invoke do_cleanups to restore it.
-
- */
-
-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);
-}
-
-static void
-restore_inferior_ptid (void *arg)
-{
-  ptid_t *saved_ptid_ptr = arg;
-  inferior_ptid = *saved_ptid_ptr;
-  xfree (arg);
-}
-
 /*
 
    LOCAL FUNCTION