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