/* Low level interface for debugging AIX 4.3+ pthreads.
- Copyright (C) 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2007, 2008, 2009
+ Free Software Foundation, Inc.
Written by Nick Duffek <nsd@redhat.com>.
This file is part of GDB.
/* Floating-point registers. */
if (flags & PTHDB_FLAG_FPRS)
{
- if (!ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL))
+ if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
- memcpy (context->fpr, fprs, sizeof(fprs));
+ memcpy (context->fpr, fprs, sizeof(fprs));
}
/* Special-purpose registers. */
}
else
{
- ptrace32 (PTT_WRITE_SPRS, tid, (int *) &context->msr, 0, NULL);
+ ptrace32 (PTT_WRITE_SPRS, tid, (void *) &context->msr, 0, NULL);
}
}
return 0;
/* Attach to process specified by ARGS. */
static void
-aix_thread_attach (char *args, int from_tty)
+aix_thread_attach (struct target_ops *ops, char *args, int from_tty)
{
- base_target.to_attach (args, from_tty);
+ base_target.to_attach (&base_target, args, from_tty);
pd_activate (1);
}
/* Detach from the process attached to by aix_thread_attach(). */
static void
-aix_thread_detach (char *args, int from_tty)
+aix_thread_detach (struct target_ops *ops, char *args, int from_tty)
{
pd_disable ();
- base_target.to_detach (args, from_tty);
+ base_target.to_detach (&base_target, args, from_tty);
}
/* Tell the inferior process to continue running thread PID if != -1
if (arch64)
ptrace64aix (PTT_CONTINUE, tid[0], 1,
- target_signal_to_host (sig), (int *) tid);
+ target_signal_to_host (sig), (void *) tid);
else
ptrace32 (PTT_CONTINUE, tid[0], (int *) 1,
- target_signal_to_host (sig), (int *) tid);
+ target_signal_to_host (sig), (void *) tid);
}
}
thread. */
static ptid_t
-aix_thread_wait (ptid_t ptid, struct target_waitstatus *status)
+aix_thread_wait (struct target_ops *ops,
+ ptid_t ptid, struct target_waitstatus *status)
{
struct cleanup *cleanup = save_inferior_ptid ();
pid_to_prc (&ptid);
inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
- ptid = base_target.to_wait (ptid, status);
+ ptid = base_target.to_wait (&base_target, ptid, status);
do_cleanups (cleanup);
if (PIDGET (ptid) == -1)
return pid_to_ptid (-1);
/* Check whether libpthdebug might be ready to be initialized. */
- if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED &&
- status->value.sig == TARGET_SIGNAL_TRAP
- && read_pc_pid (ptid)
- - gdbarch_decr_pc_after_break (current_gdbarch) == pd_brk_addr)
- return pd_activate (0);
+ if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED
+ && status->value.sig == TARGET_SIGNAL_TRAP)
+ {
+ struct regcache *regcache = get_thread_regcache (ptid);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+
+ if (regcache_read_pc (regcache)
+ - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
+ return pd_activate (0);
+ }
return pd_update (0);
}
/* Predicate to test whether given register number is a "special" register. */
static int
-special_register_p (int regno)
+special_register_p (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- return regno == gdbarch_pc_regnum (current_gdbarch)
+ return regno == gdbarch_pc_regnum (gdbarch)
|| regno == tdep->ppc_ps_regnum
|| regno == tdep->ppc_cr_regnum
|| regno == tdep->ppc_lr_regnum
|| (regno >= tdep->ppc_fp0_regnum
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
- if (!ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL))
+ if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
supply_fprs (regcache, fprs);
}
/* Special-purpose registers. */
- if (regno == -1 || special_register_p (regno))
+ if (regno == -1 || special_register_p (gdbarch, regno))
{
if (arch64)
{
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
/* Pre-fetch: some regs may not be in the cache. */
- ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL);
+ ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL);
fill_fprs (regcache, fprs);
- ptrace32 (PTT_WRITE_FPRS, tid, (int *) fprs, 0, NULL);
+ ptrace32 (PTT_WRITE_FPRS, tid, (void *) fprs, 0, NULL);
}
/* Special-purpose registers. */
- if (regno == -1 || special_register_p (regno))
+ if (regno == -1 || special_register_p (gdbarch, regno))
{
if (arch64)
{
/* Clean up after the inferior exits. */
static void
-aix_thread_mourn_inferior (void)
+aix_thread_mourn_inferior (struct target_ops *ops)
{
pd_deactivate ();
- base_target.to_mourn_inferior ();
+ base_target.to_mourn_inferior (&base_target);
}
/* Return whether thread PID is still valid. */
"info threads" output. */
static char *
-aix_thread_pid_to_str (ptid_t ptid)
+aix_thread_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char *ret = NULL;
if (!PD_TID (ptid))
- return base_target.to_pid_to_str (ptid);
+ return base_target.to_pid_to_str (&base_target, ptid);
/* Free previous return value; a new one will be allocated by
xstrprintf(). */