/* 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));
&& status->value.sig == GDB_SIGNAL_TRAP)
{
struct regcache *regcache = get_thread_regcache (ptid);
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
if (regcache_read_pc (regcache)
- gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
static void
supply_gprs64 (struct regcache *regcache, uint64_t *vals)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
static void
supply_fprs (struct regcache *regcache, double *vals)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int regno;
uint64_t lr, uint64_t ctr, uint32_t xer,
uint32_t fpscr)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch),
uint32_t lr, uint32_t ctr, uint32_t xer,
uint32_t fpscr)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch),
static void
fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int status, i;
pthdb_context_t ctx;
fetch_regs_kernel_thread (struct regcache *regcache, int regno,
pthdb_tid_t tid)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
uint64_t gprs64[ppc_num_gprs];
uint32_t gprs32[ppc_num_gprs];
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);
}
static void
fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
static void
fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
static void
fill_fprs (const struct regcache *regcache, double *vals)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int regno;
uint64_t *lr, uint64_t *ctr, uint32_t *xer,
uint32_t *fpscr)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Verify that the size of the size of the IAR buffer is the
uint32_t *lr, uint32_t *ctr, uint32_t *xer,
uint32_t *fpscr)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Verify that the size of the size of the IAR buffer is the
static void
store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int status, i;
pthdb_context_t ctx;
store_regs_kernel_thread (const struct regcache *regcache, int regno,
pthdb_tid_t tid)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
uint64_t gprs64[ppc_num_gprs];
uint32_t gprs32[ppc_num_gprs];
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" */
/* Module startup initialization function, automagically called by
init.c. */
-void _initialize_aix_thread (void);
-
void
_initialize_aix_thread (void)
{