Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: gdb/common/ptid.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/common/ptid.h ('k') | gdb/common/queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/common/ptid.c
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index f5add4d606152f42eb780aae4982aae3b69e7b44..d7780d3750ce781429a6c004374d62ca28e7974c 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -1,6 +1,6 @@
/* The ptid_t type and common functions operating on it.
- Copyright (C) 1986, 1988-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,11 +19,12 @@
#include "ptid.h"
-/* Oft used ptids */
+/* See ptid.h for these. */
+
ptid_t null_ptid = { 0, 0, 0 };
ptid_t minus_one_ptid = { -1, 0, 0 };
-/* Create a ptid given the necessary PID, LWP, and TID components. */
+/* See ptid.h. */
ptid_t
ptid_build (int pid, long lwp, long tid)
@@ -36,7 +37,7 @@ ptid_build (int pid, long lwp, long tid)
return ptid;
}
-/* Create a ptid from just a pid. */
+/* See ptid.h. */
ptid_t
pid_to_ptid (int pid)
@@ -44,7 +45,7 @@ pid_to_ptid (int pid)
return ptid_build (pid, 0, 0);
}
-/* Fetch the pid (process id) component from a ptid. */
+/* See ptid.h. */
int
ptid_get_pid (ptid_t ptid)
@@ -52,7 +53,7 @@ ptid_get_pid (ptid_t ptid)
return ptid.pid;
}
-/* Fetch the lwp (lightweight process) component from a ptid. */
+/* See ptid.h. */
long
ptid_get_lwp (ptid_t ptid)
@@ -60,7 +61,7 @@ ptid_get_lwp (ptid_t ptid)
return ptid.lwp;
}
-/* Fetch the tid (thread id) component from a ptid. */
+/* See ptid.h. */
long
ptid_get_tid (ptid_t ptid)
@@ -68,7 +69,7 @@ ptid_get_tid (ptid_t ptid)
return ptid.tid;
}
-/* ptid_equal() is used to test equality of two ptids. */
+/* See ptid.h. */
int
ptid_equal (ptid_t ptid1, ptid_t ptid2)
@@ -78,15 +79,38 @@ ptid_equal (ptid_t ptid1, ptid_t ptid2)
&& ptid1.tid == ptid2.tid);
}
-/* Returns true if PTID represents a process. */
+/* See ptid.h. */
int
ptid_is_pid (ptid_t ptid)
{
- if (ptid_equal (minus_one_ptid, ptid))
- return 0;
- if (ptid_equal (null_ptid, ptid))
+ if (ptid_equal (minus_one_ptid, ptid)
+ || ptid_equal (null_ptid, ptid))
return 0;
return (ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) == 0);
}
+
+/* See ptid.h. */
+
+int
+ptid_lwp_p (ptid_t ptid)
+{
+ if (ptid_equal (minus_one_ptid, ptid)
+ || ptid_equal (null_ptid, ptid))
+ return 0;
+
+ return (ptid_get_lwp (ptid) != 0);
+}
+
+/* See ptid.h. */
+
+int
+ptid_tid_p (ptid_t ptid)
+{
+ if (ptid_equal (minus_one_ptid, ptid)
+ || ptid_equal (null_ptid, ptid))
+ return 0;
+
+ return (ptid_get_tid (ptid) != 0);
+}
« no previous file with comments | « gdb/common/ptid.h ('k') | gdb/common/queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698