]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/common/ptid.h
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / common / ptid.h
CommitLineData
d26e3629
KY
1/* The ptid_t type and common functions operating on it.
2
32d0add0 3 Copyright (C) 1986-2015 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
c658158d
PA
28 NOT access the struct ptid members directly.
29
30 process_stratum targets that handle threading themselves should
31 prefer using the ptid.lwp field, leaving the ptid.tid field for any
32 thread_stratum target that might want to sit on top.
33*/
d26e3629
KY
34
35struct ptid
9a2c3737
PA
36{
37 /* Process id. */
38 int pid;
d26e3629 39
9a2c3737
PA
40 /* Lightweight process id. */
41 long lwp;
d26e3629 42
9a2c3737
PA
43 /* Thread id. */
44 long tid;
45};
d26e3629
KY
46
47typedef struct ptid ptid_t;
48
49/* The null or zero ptid, often used to indicate no process. */
50extern ptid_t null_ptid;
51
9a2c3737 52/* The (-1,0,0) ptid, often used to indicate either an error condition
d26e3629
KY
53 or a "don't care" condition, i.e, "run all threads." */
54extern ptid_t minus_one_ptid;
55
9a2c3737 56/* Make a ptid given the necessary PID, LWP, and TID components. */
d26e3629
KY
57ptid_t ptid_build (int pid, long lwp, long tid);
58
9a2c3737
PA
59/* Make a new ptid from just a pid. This ptid is usually used to
60 represent a whole process, including all its lwps/threads. */
d26e3629
KY
61ptid_t pid_to_ptid (int pid);
62
9a2c3737 63/* Fetch the pid (process id) component from a ptid. */
d26e3629
KY
64int ptid_get_pid (ptid_t ptid);
65
9a2c3737 66/* Fetch the lwp (lightweight process) component from a ptid. */
d26e3629
KY
67long ptid_get_lwp (ptid_t ptid);
68
9a2c3737 69/* Fetch the tid (thread id) component from a ptid. */
d26e3629
KY
70long ptid_get_tid (ptid_t ptid);
71
9a2c3737
PA
72/* Compare two ptids to see if they are equal. */
73int ptid_equal (ptid_t ptid1, ptid_t ptid2);
d26e3629 74
9a2c3737
PA
75/* Returns true if PTID represents a whole process, including all its
76 lwps/threads. Such ptids have the form of (pid,0,0), with pid !=
77 -1. */
d26e3629
KY
78int ptid_is_pid (ptid_t ptid);
79
dfd4cc63
LM
80/* Return true if PTID's lwp member is non-zero. */
81int ptid_lwp_p (ptid_t ptid);
82
83/* Return true if PTID's tid member is non-zero. */
84int ptid_tid_p (ptid_t ptid);
85
2ebd5a35
HZ
86/* Returns true if PTID matches filter FILTER. FILTER can be the wild
87 card MINUS_ONE_PTID (all ptid match it); can be a ptid representing
88 a process (ptid_is_pid returns true), in which case, all lwps and
89 threads of that given process match, lwps and threads of other
90 processes do not; or, it can represent a specific thread, in which
91 case, only that thread will match true. PTID must represent a
92 specific LWP or THREAD, it can never be a wild card. */
93
94extern int ptid_match (ptid_t ptid, ptid_t filter);
95
d26e3629 96#endif