static void check_thread_signals (void);
-static void record_thread (struct thread_db_info *info,
- struct thread_info *tp,
- ptid_t ptid, const td_thrhandle_t *th_p,
- const td_thrinfo_t *ti_p);
+static struct thread_info *record_thread
+ (struct thread_db_info *info, struct thread_info *tp,
+ ptid_t ptid, const td_thrhandle_t *th_p, const td_thrinfo_t *ti_p);
/* Add the current inferior to the list of processes using libpthread.
Return a pointer to the newly allocated object that was added to
\f
/* Fetch the user-level thread id of PTID. */
-static void
+static struct thread_info *
thread_from_lwp (ptid_t ptid)
{
td_thrhandle_t th;
/* Fill the cache. */
tp = find_thread_ptid (ptid);
- record_thread (info, tp, ptid, &th, &ti);
+ return record_thread (info, tp, ptid, &th, &ti);
}
\f
}
/* Record a new thread in GDB's thread list. Creates the thread's
- private info. If TP is NULL, creates a new thread. Otherwise,
- uses TP. */
+ private info. If TP is NULL or TP is marked as having exited,
+ creates a new thread. Otherwise, uses TP. */
-static void
+static struct thread_info *
record_thread (struct thread_db_info *info,
struct thread_info *tp,
ptid_t ptid, const td_thrhandle_t *th_p,
initialized yet. Leave private == NULL until the thread library
has initialized. */
if (ti_p->ti_tid == 0)
- return;
+ return tp;
/* Construct the thread's private data. */
priv = XCNEW (struct private_thread_info);
if (target_has_execution)
check_thread_signals ();
+
+ return tp;
}
static void
/* We may not have discovered the thread yet. */
if (thread_info != NULL && thread_info->priv == NULL)
- {
- thread_from_lwp (ptid);
- thread_info = find_thread_ptid (ptid);
- }
+ thread_info = thread_from_lwp (ptid);
if (thread_info != NULL && thread_info->priv != NULL)
{