xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_tdb.h (revision a61ed2ce7a86a4d6428f2a83eb4739fae945447e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_MDB_TDB_H
28 #define	_MDB_TDB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef _MDB
37 
38 #include <sys/types.h>
39 #include <sys/param.h>
40 #include <thread_db.h>
41 
42 typedef struct mdb_tdb_ops {
43 	td_err_e (*td_ta_new)(struct ps_prochandle *, td_thragent_t **);
44 	td_err_e (*td_ta_delete)(td_thragent_t *);
45 	td_err_e (*td_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *,
46 	    void *, td_thr_state_e, int, sigset_t *, uint_t);
47 	td_err_e (*td_ta_map_id2thr)(const td_thragent_t *,
48 	    thread_t, td_thrhandle_t *);
49 	td_err_e (*td_ta_map_lwp2thr)(const td_thragent_t *,
50 	    lwpid_t, td_thrhandle_t *);
51 	td_err_e (*td_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *);
52 	td_err_e (*td_thr_getgregs)(const td_thrhandle_t *, prgregset_t);
53 	td_err_e (*td_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
54 	td_err_e (*td_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *);
55 	td_err_e (*td_thr_setfpregs)(const td_thrhandle_t *,
56 	    const prfpregset_t *);
57 	td_err_e (*td_thr_tlsbase)(const td_thrhandle_t *, ulong_t, psaddr_t *);
58 #ifdef __sparc
59 	td_err_e (*td_thr_getxregs)(const td_thrhandle_t *, void *);
60 	td_err_e (*td_thr_setxregs)(const td_thrhandle_t *, const void *);
61 #endif
62 } mdb_tdb_ops_t;
63 
64 typedef struct mdb_tdb_lib {
65 	char tdb_pathname[MAXPATHLEN];	/* Absolute pathname of library */
66 	mdb_tdb_ops_t tdb_ops;		/* Ops vector for this library */
67 	void *tdb_handle;		/* Library rtld object handle */
68 	struct mdb_tdb_lib *tdb_next;	/* Pointer to next library in cache */
69 } mdb_tdb_lib_t;
70 
71 extern const mdb_tdb_ops_t *mdb_tdb_load(const char *);
72 extern void mdb_tdb_flush(void);
73 
74 #endif	/* _MDB */
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _MDB_TDB_H */
81