aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorHui Zhu <hui@codesourcery.com>2014-02-27 14:30:07 +0000
committerPedro Alves <palves@redhat.com>2014-02-27 14:30:07 +0000
commit2ebd5a35208e40dab7df46c7d6d58f4d614c6e21 (patch)
tree81331bc1c9e20fec4702748467f12562f58e358a /gdb/common
parent5063daf7357ccdc2c9e899ca0421c2e8e580c88d (diff)
downloadgdb-2ebd5a35208e40dab7df46c7d6d58f4d614c6e21.zip
gdb-2ebd5a35208e40dab7df46c7d6d58f4d614c6e21.tar.gz
gdb-2ebd5a35208e40dab7df46c7d6d58f4d614c6e21.tar.bz2
Move ptid_match to common/ptid.c.
So that gdbserver can use it too. gdb/ 2014-02-27 Hui Zhu <hui@codesourcery.com> PR 12702 * infrun.c (ptid_match): Move ... * common/ptid.c (ptid_match): ... here. * inferior.h (ptid_match): Move ... * common/ptid.h (ptid_match): ... here.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/ptid.c14
-rw-r--r--gdb/common/ptid.h10
2 files changed, 24 insertions, 0 deletions
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 49354ad..f614669 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -114,3 +114,17 @@ ptid_tid_p (ptid_t ptid)
return (ptid_get_tid (ptid) != 0);
}
+
+int
+ptid_match (ptid_t ptid, ptid_t filter)
+{
+ if (ptid_equal (filter, minus_one_ptid))
+ return 1;
+ if (ptid_is_pid (filter)
+ && ptid_get_pid (ptid) == ptid_get_pid (filter))
+ return 1;
+ else if (ptid_equal (ptid, filter))
+ return 1;
+
+ return 0;
+}
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index cc1825e..e151a14 100644
--- a/gdb/common/ptid.h
+++ b/gdb/common/ptid.h
@@ -83,4 +83,14 @@ int ptid_lwp_p (ptid_t ptid);
/* Return true if PTID's tid member is non-zero. */
int ptid_tid_p (ptid_t ptid);
+/* Returns true if PTID matches filter FILTER. FILTER can be the wild
+ card MINUS_ONE_PTID (all ptid match it); can be a ptid representing
+ a process (ptid_is_pid returns true), in which case, all lwps and
+ threads of that given process match, lwps and threads of other
+ processes do not; or, it can represent a specific thread, in which
+ case, only that thread will match true. PTID must represent a
+ specific LWP or THREAD, it can never be a wild card. */
+
+extern int ptid_match (ptid_t ptid, ptid_t filter);
+
#endif