5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _DT_PARSER_H
27 #define _DT_PARSER_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 #include <sys/types.h>
32 #include <sys/dtrace.h>
33
34 #include <libctf.h>
35 #include <stdarg.h>
36 #include <stdio.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #include <dt_errtags.h>
43 #include <dt_ident.h>
44 #include <dt_decl.h>
45 #include <dt_xlator.h>
46 #include <dt_list.h>
47
48 typedef struct dt_node {
49 ctf_file_t *dn_ctfp; /* CTF type container for node's type */
50 ctf_id_t dn_type; /* CTF type reference for node's type */
206 extern dt_node_t *dt_node_pdesc_by_id(uintmax_t);
207 extern dt_node_t *dt_node_clause(dt_node_t *, dt_node_t *, dt_node_t *);
208 extern dt_node_t *dt_node_inline(dt_node_t *);
209 extern dt_node_t *dt_node_member(dt_decl_t *, char *, dt_node_t *);
210 extern dt_node_t *dt_node_xlator(dt_decl_t *, dt_decl_t *, char *, dt_node_t *);
211 extern dt_node_t *dt_node_probe(char *, int, dt_node_t *, dt_node_t *);
212 extern dt_node_t *dt_node_provider(char *, dt_node_t *);
213 extern dt_node_t *dt_node_program(dt_node_t *);
214
215 extern dt_node_t *dt_node_link(dt_node_t *, dt_node_t *);
216 extern dt_node_t *dt_node_cook(dt_node_t *, uint_t);
217
218 extern dt_node_t *dt_node_xalloc(dtrace_hdl_t *, int);
219 extern void dt_node_free(dt_node_t *);
220
221 extern dtrace_attribute_t dt_node_list_cook(dt_node_t **, uint_t);
222 extern void dt_node_list_free(dt_node_t **);
223 extern void dt_node_link_free(dt_node_t **);
224
225 extern void dt_node_attr_assign(dt_node_t *, dtrace_attribute_t);
226 extern void dt_node_type_assign(dt_node_t *, ctf_file_t *, ctf_id_t);
227 extern void dt_node_type_propagate(const dt_node_t *, dt_node_t *);
228 extern const char *dt_node_type_name(const dt_node_t *, char *, size_t);
229 extern size_t dt_node_type_size(const dt_node_t *);
230
231 extern dt_ident_t *dt_node_resolve(const dt_node_t *, uint_t);
232 extern size_t dt_node_sizeof(const dt_node_t *);
233 extern void dt_node_promote(dt_node_t *, dt_node_t *, dt_node_t *);
234
235 extern void dt_node_diftype(dtrace_hdl_t *,
236 const dt_node_t *, dtrace_diftype_t *);
237 extern void dt_node_printr(dt_node_t *, FILE *, int);
238 extern const char *dt_node_name(const dt_node_t *, char *, size_t);
239 extern int dt_node_root(dt_node_t *);
240
241 struct dtrace_typeinfo; /* see <dtrace.h> */
242 struct dt_pcb; /* see <dt_impl.h> */
243
244 #define IS_CHAR(e) \
245 (((e).cte_format & (CTF_INT_CHAR | CTF_INT_SIGNED)) == \
246 (CTF_INT_CHAR | CTF_INT_SIGNED) && (e).cte_bits == NBBY)
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright (c) 2013 by Delphix. All rights reserved.
27 * Copyright (c) 2013 Joyent, Inc. All rights reserved.
28 */
29
30 #ifndef _DT_PARSER_H
31 #define _DT_PARSER_H
32
33 #include <sys/types.h>
34 #include <sys/dtrace.h>
35
36 #include <libctf.h>
37 #include <stdarg.h>
38 #include <stdio.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #include <dt_errtags.h>
45 #include <dt_ident.h>
46 #include <dt_decl.h>
47 #include <dt_xlator.h>
48 #include <dt_list.h>
49
50 typedef struct dt_node {
51 ctf_file_t *dn_ctfp; /* CTF type container for node's type */
52 ctf_id_t dn_type; /* CTF type reference for node's type */
208 extern dt_node_t *dt_node_pdesc_by_id(uintmax_t);
209 extern dt_node_t *dt_node_clause(dt_node_t *, dt_node_t *, dt_node_t *);
210 extern dt_node_t *dt_node_inline(dt_node_t *);
211 extern dt_node_t *dt_node_member(dt_decl_t *, char *, dt_node_t *);
212 extern dt_node_t *dt_node_xlator(dt_decl_t *, dt_decl_t *, char *, dt_node_t *);
213 extern dt_node_t *dt_node_probe(char *, int, dt_node_t *, dt_node_t *);
214 extern dt_node_t *dt_node_provider(char *, dt_node_t *);
215 extern dt_node_t *dt_node_program(dt_node_t *);
216
217 extern dt_node_t *dt_node_link(dt_node_t *, dt_node_t *);
218 extern dt_node_t *dt_node_cook(dt_node_t *, uint_t);
219
220 extern dt_node_t *dt_node_xalloc(dtrace_hdl_t *, int);
221 extern void dt_node_free(dt_node_t *);
222
223 extern dtrace_attribute_t dt_node_list_cook(dt_node_t **, uint_t);
224 extern void dt_node_list_free(dt_node_t **);
225 extern void dt_node_link_free(dt_node_t **);
226
227 extern void dt_node_attr_assign(dt_node_t *, dtrace_attribute_t);
228 extern void dt_node_type_assign(dt_node_t *, ctf_file_t *, ctf_id_t, boolean_t);
229 extern void dt_node_type_propagate(const dt_node_t *, dt_node_t *);
230 extern const char *dt_node_type_name(const dt_node_t *, char *, size_t);
231 extern size_t dt_node_type_size(const dt_node_t *);
232
233 extern dt_ident_t *dt_node_resolve(const dt_node_t *, uint_t);
234 extern size_t dt_node_sizeof(const dt_node_t *);
235 extern void dt_node_promote(dt_node_t *, dt_node_t *, dt_node_t *);
236
237 extern void dt_node_diftype(dtrace_hdl_t *,
238 const dt_node_t *, dtrace_diftype_t *);
239 extern void dt_node_printr(dt_node_t *, FILE *, int);
240 extern const char *dt_node_name(const dt_node_t *, char *, size_t);
241 extern int dt_node_root(dt_node_t *);
242
243 struct dtrace_typeinfo; /* see <dtrace.h> */
244 struct dt_pcb; /* see <dt_impl.h> */
245
246 #define IS_CHAR(e) \
247 (((e).cte_format & (CTF_INT_CHAR | CTF_INT_SIGNED)) == \
248 (CTF_INT_CHAR | CTF_INT_SIGNED) && (e).cte_bits == NBBY)
|