/* Low level interface for debugging AIX 4.3+ pthreads.
- Copyright (C) 1999, 2000, 2002, 2007, 2008 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.
/* 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
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);
}
/* 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(). */