thread_db_int.h revision 146818
1238106Sdes/*
2238106Sdes * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
3238106Sdes * All rights reserved.
4238106Sdes *
5238106Sdes * Redistribution and use in source and binary forms, with or without
6238106Sdes * modification, are permitted provided that the following conditions
7238106Sdes * are met:
8238106Sdes * 1. Redistributions of source code must retain the above copyright
9238106Sdes *    notice, this list of conditions and the following disclaimer.
10238106Sdes * 2. Redistributions in binary form must reproduce the above copyright
11238106Sdes *    notice, this list of conditions and the following disclaimer in the
12238106Sdes *    documentation and/or other materials provided with the distribution.
13238106Sdes *
14238106Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15238106Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16238106Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17238106Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18238106Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19238106Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20238106Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21238106Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22238106Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23238106Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24269257Sdes * SUCH DAMAGE.
25269257Sdes *
26269257Sdes * $FreeBSD: head/lib/libthread_db/thread_db_int.h 146818 2005-05-31 09:43:04Z dfr $
27269257Sdes */
28269257Sdes
29269257Sdes#ifndef _THREAD_DB_INT_H_
30269257Sdes#define	_THREAD_DB_INT_H_
31269257Sdes
32269257Sdes#include <sys/types.h>
33269257Sdes#include <sys/queue.h>
34238106Sdes
35238106Sdes#define	TD_THRAGENT_FIELDS			\
36238106Sdes	struct ta_ops		*ta_ops;	\
37238106Sdes	TAILQ_ENTRY(td_thragent) ta_next;	\
38238106Sdes	struct ps_prochandle	*ph
39238106Sdes
40238106Sdesstruct ta_ops {
41238106Sdes	td_err_e (*to_init)(void);
42238106Sdes
43238106Sdes	td_err_e (*to_ta_clear_event)(const td_thragent_t *,
44238106Sdes	    td_thr_events_t *);
45238106Sdes	td_err_e (*to_ta_delete)(td_thragent_t *);
46238106Sdes	td_err_e (*to_ta_event_addr)(const td_thragent_t *, td_thr_events_e,
47238106Sdes	    td_notify_t *);
48238106Sdes	td_err_e (*to_ta_event_getmsg)(const td_thragent_t *,
49238106Sdes	    td_event_msg_t *);
50238106Sdes	td_err_e (*to_ta_map_id2thr)(const td_thragent_t *, thread_t,
51238106Sdes	    td_thrhandle_t *);
52238106Sdes	td_err_e (*to_ta_map_lwp2thr)(const td_thragent_t *, lwpid_t,
53238106Sdes	    td_thrhandle_t *);
54238106Sdes	td_err_e (*to_ta_new)(struct ps_prochandle *, td_thragent_t **);
55238106Sdes	td_err_e (*to_ta_set_event)(const td_thragent_t *, td_thr_events_t *);
56238106Sdes	td_err_e (*to_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *,
57238106Sdes	    void *, td_thr_state_e, int, sigset_t *, unsigned int);
58238106Sdes	td_err_e (*to_ta_tsd_iter)(const td_thragent_t *, td_key_iter_f *,
59238106Sdes	    void *);
60238106Sdes
61238106Sdes	td_err_e (*to_thr_clear_event)(const td_thrhandle_t *,
62238106Sdes	    td_thr_events_t *);
63238106Sdes	td_err_e (*to_thr_dbresume)(const td_thrhandle_t *);
64238106Sdes	td_err_e (*to_thr_dbsuspend)(const td_thrhandle_t *);
65238106Sdes	td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int);
66238106Sdes	td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *,
67238106Sdes	    td_event_msg_t *);
68238106Sdes	td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *);
69238106Sdes	td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *);
70238106Sdes	td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t);
71238106Sdes	td_err_e (*to_thr_set_event)(const td_thrhandle_t *,
72238106Sdes	    td_thr_events_t *);
73238106Sdes	td_err_e (*to_thr_setfpregs)(const td_thrhandle_t *,
74238106Sdes	    const prfpregset_t *);
75238106Sdes	td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
76238106Sdes	td_err_e (*to_thr_validate)(const td_thrhandle_t *);
77238106Sdes	td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *,
78238106Sdes                   void *, size_t, void **);
79238106Sdes
80238106Sdes	/* FreeBSD specific extensions. */
81238106Sdes	td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int);
82238106Sdes#if defined(__i386__)
83238106Sdes	td_err_e (*to_thr_getxmmregs)(const td_thrhandle_t *, char *);
84238106Sdes	td_err_e (*to_thr_setxmmregs)(const td_thrhandle_t *, const char *);
85238106Sdes#endif
86238106Sdes};
87238106Sdes
88238106Sdes#ifdef TD_DEBUG
89238106Sdes#define TDBG(...) ps_plog(__VA_ARGS__)
90238106Sdes#define TDBG_FUNC() ps_plog("%s\n", __func__)
91238106Sdes#else
92238106Sdes#define TDBG(...)
93238106Sdes#define TDBG_FUNC()
94238106Sdes#endif
95238106Sdes
96238106Sdes#endif /* _THREAD_DB_INT_H_ */
97238106Sdes