Upgrade GDB from 7.3 to 7.4.1 on the vendor branch
[dragonfly.git] / contrib / gdb-7 / gdb / common / ptid.h
1 /* The ptid_t type and common functions operating on it.
2
3    Copyright (C) 1986, 1988-2012 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 #ifndef PTID_H
21 #define PTID_H
22
23 /* The ptid struct is a collection of the various "ids" necessary
24    for identifying the inferior.  This consists of the process id
25    (pid), thread id (tid), and other fields necessary for uniquely
26    identifying the inferior process/thread being debugged.  When
27    manipulating ptids, the constructors, accessors, and predicate
28    declared in server.h should be used.  These are as follows:
29
30       ptid_build        - Make a new ptid from a pid, lwp, and tid.
31       pid_to_ptid       - Make a new ptid from just a pid.
32       ptid_get_pid      - Fetch the pid component of a ptid.
33       ptid_get_lwp      - Fetch the lwp component of a ptid.
34       ptid_get_tid      - Fetch the tid component of a ptid.
35       ptid_equal        - Test to see if two ptids are equal.
36
37    Please do NOT access the struct ptid members directly (except, of
38    course, in the implementation of the above ptid manipulation
39    functions).  */
40
41 struct ptid
42   {
43     /* Process id */
44     int pid;
45
46     /* Lightweight process id */
47     long lwp;
48
49     /* Thread id */
50     long tid;
51   };
52
53 typedef struct ptid ptid_t;
54
55 /* The null or zero ptid, often used to indicate no process. */
56 extern ptid_t null_ptid;
57
58 /* The -1 ptid, often used to indicate either an error condition
59    or a "don't care" condition, i.e, "run all threads."  */
60 extern ptid_t minus_one_ptid;
61
62 /* Attempt to find and return an existing ptid with the given PID, LWP,
63    and TID components.  If none exists, create a new one and return
64    that.  */
65 ptid_t ptid_build (int pid, long lwp, long tid);
66
67 /* Find/Create a ptid from just a pid. */
68 ptid_t pid_to_ptid (int pid);
69
70 /* Fetch the pid (process id) component from a ptid. */
71 int ptid_get_pid (ptid_t ptid);
72
73 /* Fetch the lwp (lightweight process) component from a ptid. */
74 long ptid_get_lwp (ptid_t ptid);
75
76 /* Fetch the tid (thread id) component from a ptid. */
77 long ptid_get_tid (ptid_t ptid);
78
79 /* Compare two ptids to see if they are equal */
80 int ptid_equal (ptid_t p1, ptid_t p2);
81
82 /* Return true if PTID represents a process id.  */
83 int ptid_is_pid (ptid_t ptid);
84
85 #endif