1 /* The ptid_t type and common functions operating on it.
3 Copyright (C) 1986-2015 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #include "common-defs.h"
23 /* See ptid.h for these. */
25 ptid_t null_ptid
= { 0, 0, 0 };
26 ptid_t minus_one_ptid
= { -1, 0, 0 };
31 ptid_build (int pid
, long lwp
, long tid
)
46 return ptid_build (pid
, 0, 0);
52 ptid_get_pid (ptid_t ptid
)
60 ptid_get_lwp (ptid_t ptid
)
68 ptid_get_tid (ptid_t ptid
)
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
);
86 ptid_is_pid (ptid_t ptid
)
88 if (ptid_equal (minus_one_ptid
, ptid
)
89 || ptid_equal (null_ptid
, ptid
))
92 return (ptid_get_lwp (ptid
) == 0 && ptid_get_tid (ptid
) == 0);
98 ptid_lwp_p (ptid_t ptid
)
100 if (ptid_equal (minus_one_ptid
, ptid
)
101 || ptid_equal (null_ptid
, ptid
))
104 return (ptid_get_lwp (ptid
) != 0);
110 ptid_tid_p (ptid_t ptid
)
112 if (ptid_equal (minus_one_ptid
, ptid
)
113 || ptid_equal (null_ptid
, ptid
))
116 return (ptid_get_tid (ptid
) != 0);
120 ptid_match (ptid_t ptid
, ptid_t filter
)
122 if (ptid_equal (filter
, minus_one_ptid
))
124 if (ptid_is_pid (filter
)
125 && ptid_get_pid (ptid
) == ptid_get_pid (filter
))
127 else if (ptid_equal (ptid
, filter
))
This page took 0.031845 seconds and 4 git commands to generate.