Commit | Line | Data |
---|---|---|
d26e3629 KY |
1 | /* The ptid_t type and common functions operating on it. |
2 | ||
ecd75fc8 | 3 | Copyright (C) 1986-2014 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 | ||
9a2c3737 PA |
23 | /* The ptid struct is a collection of the various "ids" necessary for |
24 | identifying the inferior process/thread being debugged. This | |
25 | consists of the process id (pid), lightweight process id (lwp) and | |
26 | thread id (tid). When manipulating ptids, the constructors, | |
27 | accessors, and predicates declared in this file should be used. Do | |
28 | NOT access the struct ptid members directly. */ | |
d26e3629 KY |
29 | |
30 | struct ptid | |
9a2c3737 PA |
31 | { |
32 | /* Process id. */ | |
33 | int pid; | |
d26e3629 | 34 | |
9a2c3737 PA |
35 | /* Lightweight process id. */ |
36 | long lwp; | |
d26e3629 | 37 | |
9a2c3737 PA |
38 | /* Thread id. */ |
39 | long tid; | |
40 | }; | |
d26e3629 KY |
41 | |
42 | typedef struct ptid ptid_t; | |
43 | ||
44 | /* The null or zero ptid, often used to indicate no process. */ | |
45 | extern ptid_t null_ptid; | |
46 | ||
9a2c3737 | 47 | /* The (-1,0,0) ptid, often used to indicate either an error condition |
d26e3629 KY |
48 | or a "don't care" condition, i.e, "run all threads." */ |
49 | extern ptid_t minus_one_ptid; | |
50 | ||
9a2c3737 | 51 | /* Make a ptid given the necessary PID, LWP, and TID components. */ |
d26e3629 KY |
52 | ptid_t ptid_build (int pid, long lwp, long tid); |
53 | ||
9a2c3737 PA |
54 | /* Make a new ptid from just a pid. This ptid is usually used to |
55 | represent a whole process, including all its lwps/threads. */ | |
d26e3629 KY |
56 | ptid_t pid_to_ptid (int pid); |
57 | ||
9a2c3737 | 58 | /* Fetch the pid (process id) component from a ptid. */ |
d26e3629 KY |
59 | int ptid_get_pid (ptid_t ptid); |
60 | ||
9a2c3737 | 61 | /* Fetch the lwp (lightweight process) component from a ptid. */ |
d26e3629 KY |
62 | long ptid_get_lwp (ptid_t ptid); |
63 | ||
9a2c3737 | 64 | /* Fetch the tid (thread id) component from a ptid. */ |
d26e3629 KY |
65 | long ptid_get_tid (ptid_t ptid); |
66 | ||
9a2c3737 PA |
67 | /* Compare two ptids to see if they are equal. */ |
68 | int ptid_equal (ptid_t ptid1, ptid_t ptid2); | |
d26e3629 | 69 | |
9a2c3737 PA |
70 | /* Returns true if PTID represents a whole process, including all its |
71 | lwps/threads. Such ptids have the form of (pid,0,0), with pid != | |
72 | -1. */ | |
d26e3629 KY |
73 | int ptid_is_pid (ptid_t ptid); |
74 | ||
dfd4cc63 LM |
75 | /* Return true if PTID's lwp member is non-zero. */ |
76 | int ptid_lwp_p (ptid_t ptid); | |
77 | ||
78 | /* Return true if PTID's tid member is non-zero. */ | |
79 | int ptid_tid_p (ptid_t ptid); | |
80 | ||
d26e3629 | 81 | #endif |