thread_db_int.h revision 132332
12116Sjkh/*
22116Sjkh * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
32116Sjkh * All rights reserved.
42116Sjkh *
52116Sjkh * Redistribution and use in source and binary forms, with or without
62116Sjkh * modification, are permitted provided that the following conditions
72116Sjkh * are met:
82116Sjkh * 1. Redistributions of source code must retain the above copyright
92116Sjkh *    notice, this list of conditions and the following disclaimer.
102116Sjkh * 2. Redistributions in binary form must reproduce the above copyright
118870Srgrimes *    notice, this list of conditions and the following disclaimer in the
122116Sjkh *    documentation and/or other materials provided with the distribution.
132116Sjkh *
142116Sjkh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
152116Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16176451Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17176451Sdas * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
182116Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
192116Sjkh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
208870Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
218870Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
222116Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
232116Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
242116Sjkh * SUCH DAMAGE.
252116Sjkh *
262116Sjkh * $FreeBSD: head/lib/libthread_db/thread_db_int.h 132332 2004-07-18 04:17:15Z marcel $
272116Sjkh */
282116Sjkh
2997413Salfred#ifndef _THREAD_DB_INT_H_
3097413Salfred#define	_THREAD_DB_INT_H_
312116Sjkh
322116Sjkh#include <sys/types.h>
332116Sjkh#include <sys/queue.h>
34
35#define	TD_THRAGENT_FIELDS			\
36	struct ta_ops		*ta_ops;	\
37	TAILQ_ENTRY(td_thragent) ta_next;	\
38	struct ps_prochandle	*ph
39
40struct ta_ops {
41	td_err_e (*to_init)(void);
42
43	td_err_e (*to_ta_clear_event)(const td_thragent_t *,
44	    td_thr_events_t *);
45	td_err_e (*to_ta_delete)(td_thragent_t *);
46	td_err_e (*to_ta_event_addr)(const td_thragent_t *, td_thr_events_e,
47	    td_notify_t *);
48	td_err_e (*to_ta_event_getmsg)(const td_thragent_t *,
49	    td_event_msg_t *);
50	td_err_e (*to_ta_map_id2thr)(const td_thragent_t *, thread_t,
51	    td_thrhandle_t *);
52	td_err_e (*to_ta_map_lwp2thr)(const td_thragent_t *, lwpid_t,
53	    td_thrhandle_t *);
54	td_err_e (*to_ta_new)(struct ps_prochandle *, td_thragent_t **);
55	td_err_e (*to_ta_set_event)(const td_thragent_t *, td_thr_events_t *);
56	td_err_e (*to_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *,
57	    void *, td_thr_state_e, int, sigset_t *, unsigned int);
58	td_err_e (*to_ta_tsd_iter)(const td_thragent_t *, td_key_iter_f *,
59	    void *);
60
61	td_err_e (*to_thr_clear_event)(const td_thrhandle_t *,
62	    td_thr_events_t *);
63	td_err_e (*to_thr_dbresume)(const td_thrhandle_t *);
64	td_err_e (*to_thr_dbsuspend)(const td_thrhandle_t *);
65	td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int);
66	td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *,
67	    td_event_msg_t *);
68	td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *);
69	td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *);
70	td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t);
71	td_err_e (*to_thr_set_event)(const td_thrhandle_t *,
72	    td_thr_events_t *);
73	td_err_e (*to_thr_setfpregs)(const td_thrhandle_t *,
74	    const prfpregset_t *);
75	td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
76	td_err_e (*to_thr_validate)(const td_thrhandle_t *);
77
78	/* FreeBSD specific extensions. */
79	td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int);
80};
81
82#ifdef TD_DEBUG
83#define TDBG(...) ps_plog(__VA_ARGS__)
84#define TDBG_FUNC() ps_plog("%s\n", __func__)
85#else
86#define TDBG(...)
87#define TDBG_FUNC()
88#endif
89
90#endif /* _THREAD_DB_INT_H_ */
91