53 #include <proc_service.h> 54 #include <thread_db.h> 117 sigset_t *ti_sigmask_p,
118 unsigned ti_user_flags);
129 const caddr_t xregset);
131 const sigset_t ti_sigmask);
135 const uchar_t ti_pending_flag,
136 const sigset_t ti_pending);
140 const caddr_t xregset);
187 {
TD_OK,
"generic \"call succeeded\"" },
188 {
TD_ERR,
"generic error." },
189 {
TD_NOTHR,
"no thread can be found to satisfy query" },
190 {
TD_NOSV,
"no synch. variable can be found to satisfy query" },
191 {
TD_NOLWP,
"no lwp can be found to satisfy query" },
192 {
TD_BADPH,
"invalid process handle" },
193 {
TD_BADTH,
"invalid thread handle" },
194 {
TD_BADSH,
"invalid synchronization handle" },
195 {
TD_BADTA,
"invalid thread agent" },
197 {
TD_NOMSG,
"td_thr_event_getmsg() called when there was no message" },
198 {
TD_NOFPREGS,
"FPU register set not available for given thread" },
200 {
TD_NOEVENT,
"requested event is not supported" },
202 {
TD_DBERR,
"Debugger service failed" },
203 {
TD_NOAPLIC,
"Operation not applicable to" },
204 {
TD_NOTSD,
"No thread specific data for this thread" },
206 {
TD_PARTIALREG,
"Only part of register set was written/read" },
207 {
TD_NOXREGS,
"X register set not available for given thread" }
209 const int td_err_size =
sizeof td_err_table /
sizeof (
struct string_map);
213 for (i = 0; i < td_err_size; i++)
214 if (td_err_table[i].
num == errcode)
215 return td_err_table[i].
str;
217 xsnprintf (buf,
sizeof (buf),
"Unknown libthread_db error code: %d",
229 static struct string_map td_thr_state_table[] =
240 const int td_thr_state_table_size =
241 sizeof td_thr_state_table /
sizeof (
struct string_map);
245 for (i = 0; i < td_thr_state_table_size; i++)
246 if (td_thr_state_table[i].
num == statecode)
247 return td_thr_state_table[i].
str;
249 xsnprintf (buf,
sizeof (buf),
"Unknown libthread_db state code: %d",
277 else if (val !=
TD_OK)
283 else if (val !=
TD_OK)
288 if (default_lwp != -1)
290 error (
_(
"thread_to_lwp: thread state not active: %s"),
320 else if (val !=
TD_OK)
326 else if (val !=
TD_OK)
332 else if (val !=
TD_OK)
368 ptid_t ptid,
int step,
enum gdb_signal signo)
384 error (
_(
"This version of Solaris can't start inactive threads."));
386 warning (
_(
"Specified thread %ld seems to have terminated"),
417 error (
_(
"This version of Solaris can't start inactive threads."));
419 warning (
_(
"Specified thread %ld seems to have terminated"),
471 error (
_(
"sol_thread_fetch_registers: thread == 0"));
475 error (
_(
"sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
482 error (
_(
"sol_thread_fetch_registers: td_thr_getgregs %s"),
492 error (
_(
"sol_thread_fetch_registers: td_thr_getfpregs %s"),
528 error (
_(
"sol_thread_store_registers: td_ta_map_id2thr %s"),
535 error (
_(
"sol_thread_store_registers: td_thr_getgregs %s"),
539 error (
_(
"sol_thread_store_registers: td_thr_getfpregs %s"),
548 error (
_(
"sol_thread_store_registers: td_thr_setgregs %s"),
552 error (
_(
"sol_thread_store_registers: td_thr_setfpregs %s"),
562 const char *annex,
gdb_byte *readbuf,
581 writebuf,
offset, len, xfered_len);
638 warning (
_(
"Cannot initialize thread debugging library: %s"),
744 const char *ld_symbol_name,
psaddr_t *ld_symbol_addr)
776 #if defined (__sparcv9) 779 if (bfd_get_arch_size (
exec_bfd) == 32)
803 const void *buf,
size_t size)
820 const void *buf,
size_t size)
863 va_start (args, fmt);
933 *data_model = PR_MODEL_UNKNOWN;
934 else if (bfd_get_arch_size (
exec_bfd) == 32)
935 *data_model = PR_MODEL_ILP32;
937 *data_model = PR_MODEL_LP64;
943 #if (defined(__i386__) || defined(__x86_64__)) && defined (sun) 967 memcpy (pldt, ret,
sizeof (
struct ssd));
982 static char buf[100];
991 xsnprintf (buf,
sizeof (buf),
"Thread %ld (defunct)",
994 xsnprintf (buf,
sizeof (buf),
"Thread %ld (LWP %ld)",
997 xsnprintf (buf,
sizeof (buf),
"Thread %ld ",
1020 if (retval !=
TD_OK)
1116 warning (
_(
"info sol-thread: failed to get info for thread."));
1138 long *
tid = (
long *) data;
1194 dlhandle = dlopen (
"libthread_db.so.1", RTLD_NOW);
1198 #define resolve(X) \ 1199 if (!(p_##X = (X ## _ftype *) dlsym (dlhandle, #X))) \ 1237 [GDB will not be able to debug user-mode threads: %s]\n", dlerror ());
static td_thr_getgregs_ftype * p_td_thr_getgregs
struct gdbarch * target_gdbarch(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
void() td_log_ftype(const int on_off)
int target_thread_alive(ptid_t ptid)
ptid_t procfs_first_available(void)
#define TD_THR_LOWEST_PRIORITY
td_err_e() td_thr_tsd_ftype(const td_thrhandle_t *th_p, const thread_key_t key, void **data_pp)
td_err_e td_thr_getxregs(const td_thrhandle_t *__th, void *__xregs)
static int info_cb(const td_thrhandle_t *th, void *s)
static constexpr ptid_t tid
struct thread_info * add_thread(ptid_t ptid)
void _initialize_sol_thread(void)
ps_err_e ps_ptread(struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
static td_thr_getfpregs_ftype * p_td_thr_getfpregs
int td_key_iter_f(thread_key_t, void(*)(void *), void *)
td_err_e td_ta_get_nthreads(const td_thragent_t *__ta, int *__np)
static td_thr_get_info_ftype * p_td_thr_get_info
int target_write_memory(CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
int ptid_get_pid(const ptid_t &ptid)
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
static ps_err_e rw_common(int dowrite, const struct ps_prochandle *ph, psaddr_t addr, gdb_byte *buf, int size)
static int sol_thread_alive(struct target_ops *ops, ptid_t ptid)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
void warning(const char *fmt,...)
td_err_e() td_thr_setfpregs_ftype(const td_thrhandle_t *th_p, const prfpregset_t *fpregset)
ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lwpid, const prfpregset_t *fpregset)
td_err_e() td_ta_map_lwp2thr_ftype(const td_thragent_t *ta_p, lwpid_t lwpid, td_thrhandle_t *th_p)
td_err_e td_thr_setgregs(const td_thrhandle_t *__th, prgregset_t __gregs)
void push_target(struct target_ops *t)
ps_err_e ps_lcontinue(struct ps_prochandle *ph, lwpid_t lwpid)
struct cmd_list_element * maintenanceinfolist
td_err_e td_thr_setsigpending(const td_thrhandle_t *__th, unsigned char __n, const sigset_t *__ss)
static const char * td_state_string(td_thr_state_e statecode)
ptid_t regcache_get_ptid(const struct regcache *regcache)
int unpush_target(struct target_ops *t)
#define target_can_run(t)
static td_thr_getxregs_ftype * p_td_thr_getxregs
static void sol_thread_new_objfile(struct objfile *objfile)
static td_thr_sigsetmask_ftype * p_td_thr_sigsetmask
const char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
td_err_e() td_thr_getfpregs_ftype(const td_thrhandle_t *th_p, prfpregset_t *fpregset)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
td_err_e td_ta_get_ph(const td_thragent_t *__ta, struct ps_prochandle **__ph)
td_err_e() td_thr_setprio_ftype(const td_thrhandle_t *th_p, const int ti_pri)
static td_ta_delete_ftype * p_td_ta_delete
static td_ta_map_id2thr_ftype * p_td_ta_map_id2thr
void target_fetch_registers(struct regcache *regcache, int regno)
static td_init_ftype * p_td_init
td_err_e td_thr_getxregsize(const td_thrhandle_t *__th, int *__sizep)
td_err_e td_thr_setprio(const td_thrhandle_t *__th, int __prio)
pthread_key_t thread_key_t
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
td_err_e td_ta_map_lwp2thr(const td_thragent_t *__ta, lwpid_t __lwpid, td_thrhandle_t *__th)
void printf_filtered(const char *format,...)
static ptid_t sol_get_ada_task_ptid(struct target_ops *self, long lwp, long thread)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
static td_ta_tsd_iter_ftype * p_td_ta_tsd_iter
ptid_t ptid_build(int pid, long lwp, long tid)
static ptid_t sol_thread_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
td_err_e td_thr_getfpregs(const td_thrhandle_t *__th, prfpregset_t *__regset)
int in_thread_list(ptid_t ptid)
td_err_e() td_ta_thr_iter_ftype(const td_thragent_t *ta_p, td_thr_iter_f *cb, void *cbdata_p, td_thr_state_e state, int ti_pri, sigset_t *ti_sigmask_p, unsigned ti_user_flags)
struct thread_info * iterate_over_threads(thread_callback_func, void *)
#define MSYMBOL_PRINT_NAME(symbol)
td_err_e() td_thr_setxregs_ftype(const td_thrhandle_t *th_p, const caddr_t xregset)
gdb_fpregset_t prfpregset_t
ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf, size_t size)
static td_log_ftype * p_td_log
td_err_e() td_thr_sigsetmask_ftype(const td_thrhandle_t *th_p, const sigset_t ti_sigmask)
td_err_e() td_thr_getxregsize_ftype(const td_thrhandle_t *th_p, int *xregsize)
void ps_plog(const char *fmt,...)
struct target_ops current_target
static td_ta_thr_iter_ftype * p_td_ta_thr_iter
int td_thr_iter_f(const td_thrhandle_t *, void *)
ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
void complete_target_initialization(struct target_ops *t)
ps_err_e ps_lgetxregsize(struct ps_prochandle *ph, lwpid_t lwpid, int *xregsize)
GDB_GREGSET_T gdb_gregset_t
td_err_e td_thr_sigsetmask(const td_thrhandle_t *__th, const sigset_t *__ss)
void vfprintf_filtered(struct ui_file *stream, const char *format, va_list args)
long ptid_get_tid(const ptid_t &ptid)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
ps_err_e ps_ptwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf, size_t size)
static td_thr_setgregs_ftype * p_td_thr_setgregs
GDB_FPREGSET_T gdb_fpregset_t
static void sol_thread_store_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
ptid_t pid_to_ptid(int pid)
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
static void init_sol_thread_ops(void)
static td_thr_tsd_ftype * p_td_thr_tsd
struct td_thragent td_thragent_t
int ptid_tid_p(const ptid_t &ptid)
static td_ta_get_ph_ftype * p_td_ta_get_ph
td_err_e td_ta_delete(td_thragent_t *__ta)
td_err_e td_thr_getgregs(const td_thrhandle_t *__th, prgregset_t __gregs)
static void sol_thread_detach(struct target_ops *ops, const char *args, int from_tty)
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
static td_thragent_t * main_ta
struct target_ops * find_target_beneath(struct target_ops *t)
void printf_unfiltered(const char *format,...)
td_err_e() td_ta_map_id2thr_ftype(const td_thragent_t *ta_p, thread_t tid, td_thrhandle_t *th_p)
void(* to_detach)(struct target_ops *ops, const char *, int) TARGET_DEFAULT_IGNORE()
ps_err_e ps_lgetxregs(struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset)
static ptid_t thread_to_lwp(ptid_t thread_id, int default_lwp)
static ptid_t lwp_to_thread(ptid_t lwp)
long ptid_get_lwp(const ptid_t &ptid)
td_err_e() td_ta_tsd_iter_ftype(const td_thragent_t *ta_p, td_key_iter_f *cb, void *cbdata_p)
ps_err_e ps_pcontinue(struct ps_prochandle *ph)
ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *ld_object_name, const char *ld_symbol_name, psaddr_t *ld_symbol_addr)
td_err_e() td_thr_setgregs_ftype(const td_thrhandle_t *th_p, const prgregset_t regset)
#define TD_THR_ANY_USER_FLAGS
static int sol_update_thread_list_callback(const td_thrhandle_t *th, void *ignored)
ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
static td_ta_get_nthreads_ftype * p_td_ta_get_nthreads
td_err_e td_ta_tsd_iter(const td_thragent_t *__ta, td_key_iter_f *__ki, void *__p)
gdb_gregset_t prgregset_t
static td_thr_validate_ftype * p_td_thr_validate
td_err_e td_thr_setxregs(const td_thrhandle_t *__th, const void *__addr)
void target_update_thread_list(void)
static td_thr_setxregs_ftype * p_td_thr_setxregs
int ptid_lwp_p(const ptid_t &ptid)
static int thread_db_find_thread_from_tid(struct thread_info *thread, void *data)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
td_err_e td_ta_thr_iter(const td_thragent_t *__ta, td_thr_iter_f *__callback, void *__cbdata_p, td_thr_state_e __state, int __ti_pri, sigset_t *__ti_sigmask_p, unsigned int __ti_user_flags)
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
td_err_e td_thr_validate(const td_thrhandle_t *__th)
static const char * td_err_string(td_err_e errcode)
td_err_e() td_thr_getgregs_ftype(const td_thrhandle_t *th_p, prgregset_t regset)
td_err_e() td_thr_get_info_ftype(const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
static void info_solthreads(const char *args, int from_tty)
int xsnprintf(char *str, size_t size, const char *format,...)
static const char * solaris_pid_to_str(struct target_ops *ops, ptid_t ptid)
enum target_waitkind kind
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
struct minimal_symbol * minsym
td_err_e td_thr_get_info(const td_thrhandle_t *__th, td_thrinfo_t *__infop)
td_err_e td_ta_new(struct ps_prochandle *__ps, td_thragent_t **__ta)
td_err_e td_thr_setfpregs(const td_thrhandle_t *__th, const prfpregset_t *__fpregs)
static td_thr_setfpregs_ftype * p_td_thr_setfpregs
static constexpr ptid_t lwp
static void sol_update_thread_list(struct target_ops *ops)
ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
td_err_e() td_thr_validate_ftype(const td_thrhandle_t *th_p)
static int sol_thread_active
td_err_e td_ta_map_id2thr(const td_thragent_t *__ta, pthread_t __pt, td_thrhandle_t *__th)
static struct ps_prochandle main_ph
static td_thr_setsigpending_ftype * p_td_thr_setsigpending
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
static td_ta_map_lwp2thr_ftype * p_td_ta_map_lwp2thr
static void check_for_thread_db(void)
int is_exited(ptid_t ptid)
const char * to_shortname
struct target_ops sol_thread_ops
unsigned long long ULONGEST
td_err_e() td_init_ftype(void)
static td_thr_getxregsize_ftype * p_td_thr_getxregsize
void target_store_registers(struct regcache *regcache, int regno)
static enum target_xfer_status sol_thread_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
static void sol_thread_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
struct observer * observer_attach_new_objfile(observer_new_objfile_ftype *f)
ps_err_e ps_pstop(struct ps_prochandle *ph)
td_err_e() td_ta_get_nthreads_ftype(const td_thragent_t *ta_p, int *nthread_p)
ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset)
td_err_e() td_ta_get_ph_ftype(const td_thragent_t *ta_p, struct ps_prochandle **ph_pp)
td_err_e() td_thr_setsigpending_ftype(const td_thrhandle_t *th_p, const uchar_t ti_pending_flag, const sigset_t ti_pending)
static td_thr_setprio_ftype * p_td_thr_setprio
static td_ta_new_ftype * p_td_ta_new
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lwpid)
td_err_e td_thr_tsd(const td_thrhandle_t *__th, const thread_key_t __tk, void **__data)
td_err_e() td_ta_new_ftype(const struct ps_prochandle *ph_p, td_thragent_t **ta_pp)
void(* to_update_thread_list)(struct target_ops *) TARGET_DEFAULT_IGNORE()
ps_err_e ps_lsetxregs(struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
td_err_e() td_thr_getxregs_ftype(const td_thrhandle_t *th_p, const caddr_t xregset)
static void sol_thread_mourn_inferior(struct target_ops *ops)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_FUNC(default_target_wait)
ptid_t(* to_get_ada_task_ptid)(struct target_ops *, long lwp, long thread) TARGET_DEFAULT_FUNC(default_get_ada_task_ptid)
td_err_e() td_ta_delete_ftype(td_thragent_t *ta_p)
static void sol_thread_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signo)
void error(const char *fmt,...)
struct target_ops * beneath
struct regcache * get_thread_arch_regcache(ptid_t ptid, struct gdbarch *gdbarch)
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)