/* Private data attached to each element in GDB's thread list. */
-struct private_thread_info {
+struct aix_thread_info : public private_thread_info
+{
pthdb_pthread_t pdtid; /* thread's libpthdebug id */
pthdb_tid_t tid; /* kernel thread id */
};
+/* Return the aix_thread_info attached to THREAD. */
+
+static aix_thread_info *
+get_aix_thread_info (thread_info *thread)
+{
+ return static_cast<aix_thread_info *> (thread->priv.get ());
+}
+
/* Information about a thread of which libpthdebug is aware. */
struct pd_thread {
}
else if (gi == gcount)
{
- thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid));
- thread->priv = XNEW (struct private_thread_info);
- thread->priv->pdtid = pbuf[pi].pdtid;
- thread->priv->tid = pbuf[pi].tid;
+ aix_thread_info *priv = new aix_thread_info;
+ priv->pdtid = pbuf[pi].pdtid;
+ priv->tid = pbuf[pi].tid;
+
+ thread = add_thread_with_info (ptid_t (infpid, 0, pbuf[pi].pthid), priv);
+
pi++;
}
else
if (cmp_result == 0)
{
- gbuf[gi]->priv->pdtid = pdtid;
- gbuf[gi]->priv->tid = tid;
+ aix_thread_info *priv = get_aix_thread_info (gbuf[gi]);
+
+ priv->pdtid = pdtid;
+ priv->tid = tid;
pi++;
gi++;
}
else
{
thread = add_thread (pptid);
- thread->priv = XNEW (struct private_thread_info);
- thread->priv->pdtid = pdtid;
- thread->priv->tid = tid;
+
+ aix_thread_info *priv = new aix_thread_info;
+ thread->priv.reset (priv);
+ priv->pdtid = pdtid;
+ priv->tid = tid;
pi++;
}
}
iter_tid (struct thread_info *thread, void *tidp)
{
const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
+ aix_thread_info *priv = get_aix_thread_info (thread);
- return (thread->priv->tid == tid);
+ return priv->tid == tid;
}
/* Synchronize libpthdebug's state with the inferior and with GDB,
error (_("aix-thread resume: unknown pthread %ld"),
ptid_get_lwp (ptid));
- tid[0] = thread->priv->tid;
+ aix_thread_info *priv = get_aix_thread_info (thread);
+
+ tid[0] = priv->tid;
if (tid[0] == PTHDB_INVALID_TID)
error (_("aix-thread resume: no tid for pthread %ld"),
ptid_get_lwp (ptid));
else
{
thread = find_thread_ptid (regcache_get_ptid (regcache));
- tid = thread->priv->tid;
+ aix_thread_info *priv = get_aix_thread_info (thread);
+ tid = priv->tid;
if (tid == PTHDB_INVALID_TID)
- fetch_regs_user_thread (regcache, thread->priv->pdtid);
+ fetch_regs_user_thread (regcache, priv->pdtid);
else
fetch_regs_kernel_thread (regcache, regno, tid);
}
else
{
thread = find_thread_ptid (regcache_get_ptid (regcache));
- tid = thread->priv->tid;
+ aix_thread_info *priv = get_aix_thread_info (thread);
+ tid = priv->tid;
if (tid == PTHDB_INVALID_TID)
- store_regs_user_thread (regcache, thread->priv->pdtid);
+ store_regs_user_thread (regcache, priv->pdtid);
else
store_regs_kernel_thread (regcache, regno, tid);
}
return NULL;
string_file buf;
+ aix_thread_info *priv = get_aix_thread_info (thread);
- pdtid = thread->priv->pdtid;
- tid = thread->priv->tid;
+ pdtid = priv->pdtid;
+ tid = priv->tid;
if (tid != PTHDB_INVALID_TID)
/* i18n: Like "thread-identifier %d, [state] running, suspended" */