]>
Commit | Line | Data |
---|---|---|
d26e3629 KY |
1 | /* The ptid_t type and common functions operating on it. |
2 | ||
28e7fd62 | 3 | Copyright (C) 1986-2013 Free Software Foundation, Inc. |
d26e3629 KY |
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 | |
bd1df410 TT |
27 | manipulating ptids, the constructors, accessors, and predicates |
28 | declared in this file should be used. These are as follows: | |
d26e3629 KY |
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. | |
dfd4cc63 LM |
36 | ptid_is_pid - Test if a ptid is of the form (pid, 0, 0). |
37 | ptid_lwp_p - Test if a ptid's lwp component is non-zero. | |
38 | ptid_tid_p - Test if a ptid's tid component is non-zero. | |
d26e3629 KY |
39 | |
40 | Please do NOT access the struct ptid members directly (except, of | |
41 | course, in the implementation of the above ptid manipulation | |
42 | functions). */ | |
43 | ||
44 | struct ptid | |
45 | { | |
46 | /* Process id */ | |
47 | int pid; | |
48 | ||
49 | /* Lightweight process id */ | |
50 | long lwp; | |
51 | ||
52 | /* Thread id */ | |
53 | long tid; | |
54 | }; | |
55 | ||
56 | typedef struct ptid ptid_t; | |
57 | ||
58 | /* The null or zero ptid, often used to indicate no process. */ | |
59 | extern ptid_t null_ptid; | |
60 | ||
61 | /* The -1 ptid, often used to indicate either an error condition | |
62 | or a "don't care" condition, i.e, "run all threads." */ | |
63 | extern ptid_t minus_one_ptid; | |
64 | ||
65 | /* Attempt to find and return an existing ptid with the given PID, LWP, | |
66 | and TID components. If none exists, create a new one and return | |
67 | that. */ | |
68 | ptid_t ptid_build (int pid, long lwp, long tid); | |
69 | ||
70 | /* Find/Create a ptid from just a pid. */ | |
71 | ptid_t pid_to_ptid (int pid); | |
72 | ||
73 | /* Fetch the pid (process id) component from a ptid. */ | |
74 | int ptid_get_pid (ptid_t ptid); | |
75 | ||
76 | /* Fetch the lwp (lightweight process) component from a ptid. */ | |
77 | long ptid_get_lwp (ptid_t ptid); | |
78 | ||
79 | /* Fetch the tid (thread id) component from a ptid. */ | |
80 | long ptid_get_tid (ptid_t ptid); | |
81 | ||
82 | /* Compare two ptids to see if they are equal */ | |
83 | int ptid_equal (ptid_t p1, ptid_t p2); | |
84 | ||
85 | /* Return true if PTID represents a process id. */ | |
86 | int ptid_is_pid (ptid_t ptid); | |
87 | ||
dfd4cc63 LM |
88 | /* Return true if PTID's lwp member is non-zero. */ |
89 | int ptid_lwp_p (ptid_t ptid); | |
90 | ||
91 | /* Return true if PTID's tid member is non-zero. */ | |
92 | int ptid_tid_p (ptid_t ptid); | |
93 | ||
d26e3629 | 94 | #endif |