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 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _DT_XLATOR_H 28 #define _DT_XLATOR_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <libctf.h> 33 #include <dtrace.h> 34 #include <dt_ident.h> 35 #include <dt_list.h> 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 struct dt_node; 42 43 typedef struct dt_xlator { 44 dt_list_t dx_list; /* list forward/back pointers */ 45 dt_idhash_t *dx_locals; /* hash of local scope identifiers */ 46 dt_ident_t *dx_ident; /* identifier ref for input param */ 47 dt_ident_t dx_souid; /* fake identifier for sou output */ 48 dt_ident_t dx_ptrid; /* fake identifier for ptr output */ 49 ctf_file_t *dx_src_ctfp; /* CTF container for input type */ 50 ctf_id_t dx_src_type; /* CTF reference for input type */ 51 ctf_id_t dx_src_base; /* CTF reference for input base */ 52 ctf_file_t *dx_dst_ctfp; /* CTF container for output type */ 53 ctf_id_t dx_dst_type; /* CTF reference for output type */ 54 ctf_id_t dx_dst_base; /* CTF reference for output base */ 55 struct dt_node *dx_members; /* list of member translations */ 56 struct dt_node *dx_nodes; /* list of parse tree nodes */ 57 ulong_t dx_gen; /* generation number that created me */ 58 } dt_xlator_t; 59 60 extern dt_xlator_t *dt_xlator_create(dtrace_hdl_t *, 61 const dtrace_typeinfo_t *, const dtrace_typeinfo_t *, 62 const char *, struct dt_node *, struct dt_node *); 63 64 #define DT_XLATE_FUZZY 0 /* lookup any matching translator */ 65 #define DT_XLATE_EXACT 1 /* lookup only exact type matches */ 66 67 extern dt_xlator_t *dt_xlator_lookup(dtrace_hdl_t *, 68 struct dt_node *, struct dt_node *, int); 69 70 extern dt_ident_t *dt_xlator_ident(dt_xlator_t *, ctf_file_t *, ctf_id_t); 71 extern struct dt_node *dt_xlator_member(dt_xlator_t *, const char *); 72 extern void dt_xlator_destroy(dtrace_hdl_t *, dt_xlator_t *); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _DT_XLATOR_H */ 79