2 * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _THREAD_DB_INT_H_
30 #define _THREAD_DB_INT_H_
32 #include <sys/types.h>
33 #include <sys/queue.h>
36 const td_thragent_t *ti_ta_p;
39 td_thr_state_e ti_state;
40 td_thr_type_e ti_type;
41 td_thr_events_t ti_events;
49 psaddr_t ti_startfunc;
54 #define TD_THRAGENT_FIELDS \
55 struct ta_ops *ta_ops; \
56 TAILQ_ENTRY(td_thragent) ta_next; \
57 struct ps_prochandle *ph
60 td_err_e (*to_init)(void);
62 td_err_e (*to_ta_clear_event)(const td_thragent_t *,
64 td_err_e (*to_ta_delete)(td_thragent_t *);
65 td_err_e (*to_ta_event_addr)(const td_thragent_t *, td_thr_events_e,
67 td_err_e (*to_ta_event_getmsg)(const td_thragent_t *,
69 td_err_e (*to_ta_map_id2thr)(const td_thragent_t *, thread_t,
71 td_err_e (*to_ta_map_lwp2thr)(const td_thragent_t *, lwpid_t,
73 td_err_e (*to_ta_new)(struct ps_prochandle *, td_thragent_t **);
74 td_err_e (*to_ta_set_event)(const td_thragent_t *, td_thr_events_t *);
75 td_err_e (*to_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *,
76 void *, td_thr_state_e, int, sigset_t *, unsigned int);
77 td_err_e (*to_ta_tsd_iter)(const td_thragent_t *, td_key_iter_f *,
80 td_err_e (*to_thr_clear_event)(const td_thrhandle_t *,
82 td_err_e (*to_thr_dbresume)(const td_thrhandle_t *);
83 td_err_e (*to_thr_dbsuspend)(const td_thrhandle_t *);
84 td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int);
85 td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *,
87 td_err_e (*to_thr_old_get_info)(const td_thrhandle_t *,
89 td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *);
90 td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *);
91 td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t);
92 td_err_e (*to_thr_set_event)(const td_thrhandle_t *,
94 td_err_e (*to_thr_setfpregs)(const td_thrhandle_t *,
95 const prfpregset_t *);
96 td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
97 td_err_e (*to_thr_validate)(const td_thrhandle_t *);
98 td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *, psaddr_t,
101 /* FreeBSD specific extensions. */
102 td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int);
103 #if defined(__i386__)
104 td_err_e (*to_thr_getxmmregs)(const td_thrhandle_t *, char *);
105 td_err_e (*to_thr_setxmmregs)(const td_thrhandle_t *, const char *);
110 #define TDBG(...) ps_plog(__VA_ARGS__)
111 #define TDBG_FUNC() ps_plog("%s\n", __func__)
119 int thr_pread_int(const struct td_thragent *, psaddr_t, uint32_t *);
120 int thr_pread_long(const struct td_thragent *, psaddr_t, uint64_t *);
121 int thr_pread_ptr(const struct td_thragent *, psaddr_t, psaddr_t *);
123 int thr_pwrite_int(const struct td_thragent *, psaddr_t, uint32_t);
124 int thr_pwrite_long(const struct td_thragent *, psaddr_t, uint64_t);
125 int thr_pwrite_ptr(const struct td_thragent *, psaddr_t, psaddr_t);
127 td_err_e td_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info);
129 #endif /* _THREAD_DB_INT_H_ */