/* Solaris threads debugging interface.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_regcache (inferior_ptid);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_regcache (inferior_ptid);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_regcache (inferior_ptid);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_regcache (inferior_ptid);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
printf_filtered (" startfunc: %s\n",
SYMBOL_PRINT_NAME (msym));
else
- printf_filtered (" startfunc: 0x%s\n", paddr (ti.ti_startfunc));
+ printf_filtered (" startfunc: %s\n",
+ paddress (target_gdbarch, ti.ti_startfunc));
}
/* If thread is asleep, print function that went to sleep. */
printf_filtered (" - Sleep func: %s\n",
SYMBOL_PRINT_NAME (msym));
else
- printf_filtered (" - Sleep func: 0x%s\n", paddr (ti.ti_startfunc));
+ printf_filtered (" - Sleep func: %s\n",
+ paddress (target_gdbarch, ti.ti_startfunc));
}
/* Wrap up line, if necessary. */
TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
}
+/* Callback routine used to find a thread based on the TID part of
+ its PTID. */
+
+static int
+thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
+{
+ long *tid = (long *) data;
+
+ if (ptid_get_tid (thread->ptid) == *tid)
+ return 1;
+
+ return 0;
+}
+
+static ptid_t
+sol_get_ada_task_ptid (long lwp, long thread)
+{
+ struct thread_info *thread_info =
+ iterate_over_threads (thread_db_find_thread_from_tid, &thread);
+
+ if (thread_info == NULL)
+ {
+ /* The list of threads is probably not up to date. Find any
+ thread that is missing from the list, and try again. */
+ sol_find_new_threads (¤t_target);
+ thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
+ &thread);
+ }
+
+ gdb_assert (thread_info != NULL);
+
+ return (thread_info->ptid);
+}
+
static void
init_sol_thread_ops (void)
{
sol_thread_ops.to_pid_to_str = solaris_pid_to_str;
sol_thread_ops.to_find_new_threads = sol_find_new_threads;
sol_thread_ops.to_stratum = thread_stratum;
+ sol_thread_ops.to_get_ada_task_ptid = sol_get_ada_task_ptid;
sol_thread_ops.to_magic = OPS_MAGIC;
}