aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2001-05-15 00:03:38 +0000
committerKevin Buettner <kevinb@redhat.com>2001-05-15 00:03:38 +0000
commitca6724c16a360b6297d7827cfd0173441ccd95c2 (patch)
tree3e1e58042a222bbe8532507bb67f404be5c9e80f /gdb/defs.h
parent67a659f60e569d0938cb8ce51489514bcf0d4cca (diff)
downloadgdb-ca6724c16a360b6297d7827cfd0173441ccd95c2.zip
gdb-ca6724c16a360b6297d7827cfd0173441ccd95c2.tar.gz
gdb-ca6724c16a360b6297d7827cfd0173441ccd95c2.tar.bz2
Redefine ptid_t to be a struct rather than an int.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h70
1 files changed, 36 insertions, 34 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 166dde8..435e47b 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -844,36 +844,37 @@ enum val_prettyprint
Val_pretty_default
};
-/* 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.
-
- The present typedef is obviously quite naive with respect to
- the magnitudes that real life pids and tids can take on and
- will be replaced with something more robust shortly. */
-
-typedef int ptid_t;
-
-/* Convert a pid to a ptid_t. This macro is temporary and will
- be replaced shortly. */
-
-#define pid_to_ptid(PID) ((ptid_t) MERGEPID ((PID),0))
-
-/* Define a value for the null (or zero) pid. This macro is temporary
- and will go away shortly. */
-
-#define null_ptid (pid_to_ptid (0))
-
-/* Define a value for the -1 pid. This macro is temporary and will go
- away shortly. */
+/* 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;
-#define minus_one_ptid (pid_to_ptid (-1))
+ /* Lightweight process id */
+ long lwp;
-/* Define a ptid comparison operator. This macro is temporary and will
- be replaced with a real function shortly. */
+ /* Thread id */
+ long tid;
+ };
-#define ptid_equal(PTID1,PTID2) ((PTID1) == (PTID2))
+typedef struct ptid ptid_t;
@@ -1391,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. */