aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/ptid.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-10-04 10:04:14 +0000
committerPedro Alves <palves@redhat.com>2013-10-04 10:04:14 +0000
commit9a2c3737b0feb226ee428b4e9cdc2ed46aa6450a (patch)
tree8007c3041c7b446efe6d187dc225e86f501dd254 /gdb/common/ptid.c
parentf5371440e08b9626b92f0e24a0a5c93318ef4d20 (diff)
downloadgdb-9a2c3737b0feb226ee428b4e9cdc2ed46aa6450a.zip
gdb-9a2c3737b0feb226ee428b4e9cdc2ed46aa6450a.tar.gz
gdb-9a2c3737b0feb226ee428b4e9cdc2ed46aa6450a.tar.bz2
Clean up ptid.h/ptid.c.
The ptid_t contructors, accessors and predicates are documented in _three_ places, and each place uses a different wording. E.g, the descriptions in the .c file of the new ptid_lwp_p, ptid_tid_p weren't updated in the final revision like the descriptions in the .h file were. Clearly, switching to a style that has a single central description avoids such issues. Worse, some of the existing descriptions are plain wrong, such as: /* Attempt to find and return an existing ptid with the given PID, LWP, and TID components. If none exists, create a new one and return that. */ ptid_t ptid_build (int pid, long lwp, long tid); The function does nothing that complicated. It's just a simple constructor. So this gets rid of all the unnecessary descriptions, leaving only the ones near the function declarations in the header file, and fixes/clarifies those that remain. gdb/ 2013-10-04 Pedro Alves <palves@redhat.com> * common/ptid.c (null_ptid, minus_one_ptid, ptid_build) (pid_to_ptid, ptid_get_pid, ptid_get_lwp, ptid_get_tid) (ptid_equal, ptid_is_pid, ptid_lwp_p, ptid_tid_p): Replace describing comments with references to ptid.h. * common/ptid.h: Remove intro description of constructors, accessors and predicates. (struct ptid): Reformat. (minus_one_ptid, ptid_build, pid_to_ptid, ptid_get_pid) (ptid_get_lwp, ptid_get_tid, ptid_equal, ptid_is_pid): Change describing comments.
Diffstat (limited to 'gdb/common/ptid.c')
-rw-r--r--gdb/common/ptid.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index e8d25c0..d7780d3 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -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,7 +79,7 @@ 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)
@@ -90,7 +91,7 @@ ptid_is_pid (ptid_t ptid)
return (ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) == 0);
}
-/* Returns true if PTID represents a lwp. */
+/* See ptid.h. */
int
ptid_lwp_p (ptid_t ptid)
@@ -102,7 +103,7 @@ ptid_lwp_p (ptid_t ptid)
return (ptid_get_lwp (ptid) != 0);
}
-/* Returns true if PTID represents a tid. */
+/* See ptid.h. */
int
ptid_tid_p (ptid_t ptid)