summaryrefslogtreecommitdiff
path: root/nptl_db
diff options
context:
space:
mode:
Diffstat (limited to 'nptl_db')
-rw-r--r--nptl_db/structs.def1
-rw-r--r--nptl_db/td_ta_thr_iter.c56
-rw-r--r--nptl_db/td_thr_validate.c23
3 files changed, 18 insertions, 62 deletions
diff --git a/nptl_db/structs.def b/nptl_db/structs.def
index a9b621b126..1cb6a46391 100644
--- a/nptl_db/structs.def
+++ b/nptl_db/structs.def
@@ -48,7 +48,6 @@ DB_STRUCT (pthread)
DB_STRUCT_FIELD (pthread, list)
DB_STRUCT_FIELD (pthread, report_events)
DB_STRUCT_FIELD (pthread, tid)
-DB_STRUCT_FIELD (pthread, pid)
DB_STRUCT_FIELD (pthread, start_routine)
DB_STRUCT_FIELD (pthread, cancelhandling)
DB_STRUCT_FIELD (pthread, schedpolicy)
diff --git a/nptl_db/td_ta_thr_iter.c b/nptl_db/td_ta_thr_iter.c
index a990fed150..9e5059956b 100644
--- a/nptl_db/td_ta_thr_iter.c
+++ b/nptl_db/td_ta_thr_iter.c
@@ -76,48 +76,28 @@ iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
if (ps_pdread (ta->ph, addr, copy, ta->ta_sizeof_pthread) != PS_OK)
return TD_ERR;
- /* Verify that this thread's pid field matches the child PID.
- If its pid field is negative, it's about to do a fork or it
- is the sole thread in a fork child. */
- psaddr_t pid;
- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, pid, 0);
- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0)
- {
- if (-(pid_t) (uintptr_t) pid == match_pid)
- /* It is about to do a fork, but is really still the parent PID. */
- pid = (psaddr_t) (uintptr_t) match_pid;
- else
- /* It must be a fork child, whose new PID is in the tid field. */
- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, tid, 0);
- }
+ err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread,
+ schedpolicy, 0);
if (err != TD_OK)
break;
+ err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread,
+ schedparam_sched_priority, 0);
+ if (err != TD_OK)
+ break;
+
+ /* Now test whether this thread matches the specified conditions. */
- if ((pid_t) (uintptr_t) pid == match_pid)
+ /* Only if the priority level is as high or higher. */
+ int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER
+ ? 0 : (uintptr_t) schedprio);
+ if (descr_pri >= ti_pri)
{
- err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread,
- schedpolicy, 0);
- if (err != TD_OK)
- break;
- err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread,
- schedparam_sched_priority, 0);
- if (err != TD_OK)
- break;
-
- /* Now test whether this thread matches the specified conditions. */
-
- /* Only if the priority level is as high or higher. */
- int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER
- ? 0 : (uintptr_t) schedprio);
- if (descr_pri >= ti_pri)
- {
- /* Yep, it matches. Call the callback function. */
- td_thrhandle_t th;
- th.th_ta_p = (td_thragent_t *) ta;
- th.th_unique = addr;
- if (callback (&th, cbdata_p) != 0)
- return TD_DBERR;
- }
+ /* Yep, it matches. Call the callback function. */
+ td_thrhandle_t th;
+ th.th_ta_p = (td_thragent_t *) ta;
+ th.th_unique = addr;
+ if (callback (&th, cbdata_p) != 0)
+ return TD_DBERR;
}
/* Get the pointer to the next element. */
diff --git a/nptl_db/td_thr_validate.c b/nptl_db/td_thr_validate.c
index f3c8a7bed6..9b89fecad2 100644
--- a/nptl_db/td_thr_validate.c
+++ b/nptl_db/td_thr_validate.c
@@ -80,28 +80,5 @@ td_thr_validate (const td_thrhandle_t *th)
err = TD_OK;
}
- if (err == TD_OK)
- {
- /* Verify that this is not a stale element in a fork child. */
- pid_t match_pid = ps_getpid (th->th_ta_p->ph);
- psaddr_t pid;
- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, pthread, pid, 0);
- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0)
- {
- /* This was a thread that was about to fork, or it is the new sole
- thread in a fork child. In the latter case, its tid was stored
- via CLONE_CHILD_SETTID and so is already the proper child PID. */
- if (-(pid_t) (uintptr_t) pid == match_pid)
- /* It is about to do a fork, but is really still the parent PID. */
- pid = (psaddr_t) (uintptr_t) match_pid;
- else
- /* It must be a fork child, whose new PID is in the tid field. */
- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique,
- pthread, tid, 0);
- }
- if (err == TD_OK && (pid_t) (uintptr_t) pid != match_pid)
- err = TD_NOTHR;
- }
-
return err;
}