replace hexify with bin2hex
[platform/upstream/binutils.git] / gdb / common / ptid.h
1 /* The ptid_t type and common functions operating on it.
2
3    Copyright (C) 1986-2014 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 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.  */
29
30 struct ptid
31 {
32   /* Process id.  */
33   int pid;
34
35   /* Lightweight process id.  */
36   long lwp;
37
38   /* Thread id.  */
39   long tid;
40 };
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
47 /* The (-1,0,0) ptid, often used to indicate either an error condition
48    or a "don't care" condition, i.e, "run all threads."  */
49 extern ptid_t minus_one_ptid;
50
51 /* Make a ptid given the necessary PID, LWP, and TID components.  */
52 ptid_t ptid_build (int pid, long lwp, long tid);
53
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.  */
56 ptid_t pid_to_ptid (int pid);
57
58 /* Fetch the pid (process id) component from a ptid.  */
59 int ptid_get_pid (ptid_t ptid);
60
61 /* Fetch the lwp (lightweight process) component from a ptid.  */
62 long ptid_get_lwp (ptid_t ptid);
63
64 /* Fetch the tid (thread id) component from a ptid.  */
65 long ptid_get_tid (ptid_t ptid);
66
67 /* Compare two ptids to see if they are equal.  */
68 int ptid_equal (ptid_t ptid1, ptid_t ptid2);
69
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.  */
73 int ptid_is_pid (ptid_t ptid);
74
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
81 #endif