Update copyright date.
[deliverable/binutils-gdb.git] / gdb / defs.h
index 72f5184a842a61a49fbe6a7541cd50980af2b846..435e47b32ac128cf3cbb6a349bcdc1c89d3873d5 100644 (file)
@@ -843,6 +843,39 @@ enum val_prettyprint
     /* Use the default setting which the user has specified.  */
     Val_pretty_default
   };
+
+/* The ptid struct is a collection of the various "ids" necessary
+   for identifying the inferior.  This consists of the process id
+   (pid), thread id (tid), and other fields necessary for uniquely
+   identifying the inferior process/thread being debugged.  When
+   manipulating ptids, the constructors, accessors, and predicate
+   declared in inferior.h should be used.  These are as follows:
+
+      ptid_build       - Make a new ptid from a pid, lwp, and tid.
+      pid_to_ptid      - Make a new ptid from just a pid.
+      ptid_get_pid     - Fetch the pid component of a ptid.
+      ptid_get_lwp     - Fetch the lwp component of a ptid.
+      ptid_get_tid     - Fetch the tid component of a ptid.
+      ptid_equal       - Test to see if two ptids are equal.
+
+   Please do NOT access the struct ptid members directly (except, of
+   course, in the implementation of the above ptid manipulation
+   functions).  */
+
+struct ptid
+  {
+    /* Process id */
+    int pid;
+
+    /* Lightweight process id */
+    long lwp;
+
+    /* Thread id */
+    long tid;
+  };
+
+typedef struct ptid ptid_t;
+
 \f
 
 /* Optional host machine definition.  Pure autoconf targets will not
@@ -1302,7 +1335,8 @@ extern void (*readline_end_hook) (void);
 extern void (*register_changed_hook) (int regno);
 extern void (*memory_changed_hook) (CORE_ADDR addr, int len);
 extern void (*context_hook) (int);
-extern int (*target_wait_hook) (int pid, struct target_waitstatus * status);
+extern ptid_t (*target_wait_hook) (ptid_t ptid,
+                                         struct target_waitstatus * status);
 
 extern void (*attach_hook) (void);
 extern void (*detach_hook) (void);
@@ -1358,15 +1392,16 @@ extern int use_windows;
 #define ROOTED_P(X) (SLASH_P((X)[0]))
 #endif
 
-/* On some systems, PIDGET is defined to extract the inferior pid from
-   an internal pid that has the thread id and pid in seperate bit
-   fields.  If not defined, then just use the entire internal pid as
-   the actual pid. */
+/* Provide default definitions of PIDGET, TIDGET, and MERGEPID.
+   The name ``TIDGET'' is a historical accident.  Many uses of TIDGET
+   in the code actually refer to a lightweight process id, i.e,
+   something that can be considered a process id in its own right for
+   certain purposes.  */
 
 #ifndef PIDGET
-#define PIDGET(PID) (PID)
-#define TIDGET(PID) 0
-#define MERGEPID(PID, TID) (PID)
+#define PIDGET(PTID) (ptid_get_pid (PTID))
+#define TIDGET(PTID) (ptid_get_lwp (PTID))
+#define MERGEPID(PID, TID) ptid_build (PID, TID, 0)
 #endif
 
 /* Define well known filenos if the system does not define them.  */
This page took 0.024024 seconds and 4 git commands to generate.