1 /* The ptid_t type and common functions operating on it.
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.
7 This file is part of GDB.
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.
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.
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/>. */
25 ptid_t null_ptid
= { 0, 0, 0 };
26 ptid_t minus_one_ptid
= { -1, 0, 0 };
28 /* Create a ptid given the necessary PID, LWP, and TID components. */
31 ptid_build (int pid
, long lwp
, long tid
)
41 /* Create a ptid from just a pid. */
46 return ptid_build (pid
, 0, 0);
49 /* Fetch the pid (process id) component from a ptid. */
52 ptid_get_pid (ptid_t ptid
)
57 /* Fetch the lwp (lightweight process) component from a ptid. */
60 ptid_get_lwp (ptid_t ptid
)
65 /* Fetch the tid (thread id) component from a ptid. */
68 ptid_get_tid (ptid_t ptid
)
73 /* ptid_equal() is used to test equality of two ptids. */
76 ptid_equal (ptid_t ptid1
, ptid_t ptid2
)
78 return (ptid1
.pid
== ptid2
.pid
79 && ptid1
.lwp
== ptid2
.lwp
80 && ptid1
.tid
== ptid2
.tid
);
83 /* Returns true if PTID represents a process. */
86 ptid_is_pid (ptid_t ptid
)
88 if (ptid_equal (minus_one_ptid
, ptid
))
90 if (ptid_equal (null_ptid
, ptid
))
93 return (ptid_get_lwp (ptid
) == 0 && ptid_get_tid (ptid
) == 0);
This page took 0.035448 seconds and 5 git commands to generate.