Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>


   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 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
  28  */
  29 
  30 /*
  31  * This header file defines the interfaces available from the CTF debugger
  32  * library, libctf, and an equivalent kernel module.  This API can be used by
  33  * a debugger to operate on data in the Compact ANSI-C Type Format (CTF).
  34  * This is NOT a public interface, although it may eventually become one in
  35  * the fullness of time after we gain more experience with the interfaces.
  36  *
  37  * In the meantime, be aware that any program linked with this API in this
  38  * release of Solaris is almost guaranteed to break in the next release.
  39  *
  40  * In short, do not user this header file or the CTF routines for any purpose.
  41  */
  42 
  43 #ifndef _CTF_API_H
  44 #define _CTF_API_H
  45 
  46 #include <sys/types.h>
  47 #include <sys/param.h>


 134  * visible at the top-level program scope when subsequently doing a lookup.
 135  */
 136 #define CTF_ADD_NONROOT 0       /* type only visible in nested scope */
 137 #define CTF_ADD_ROOT    1       /* type visible at top-level scope */
 138 
 139 /*
 140  * These typedefs are used to define the signature for callback functions
 141  * that can be used with the iteration and visit functions below:
 142  */
 143 typedef int ctf_visit_f(const char *, ctf_id_t, ulong_t, int, void *);
 144 typedef int ctf_member_f(const char *, ctf_id_t, ulong_t, void *);
 145 typedef int ctf_enum_f(const char *, int, void *);
 146 typedef int ctf_type_f(ctf_id_t, void *);
 147 typedef int ctf_label_f(const char *, const ctf_lblinfo_t *, void *);
 148 
 149 extern ctf_file_t *ctf_bufopen(const ctf_sect_t *, const ctf_sect_t *,
 150     const ctf_sect_t *, int *);
 151 extern ctf_file_t *ctf_fdopen(int, int *);
 152 extern ctf_file_t *ctf_open(const char *, int *);
 153 extern ctf_file_t *ctf_create(int *);

 154 extern void ctf_close(ctf_file_t *);
 155 
 156 extern ctf_file_t *ctf_parent_file(ctf_file_t *);
 157 extern const char *ctf_parent_name(ctf_file_t *);
 158 
 159 extern int ctf_import(ctf_file_t *, ctf_file_t *);
 160 extern int ctf_setmodel(ctf_file_t *, int);
 161 extern int ctf_getmodel(ctf_file_t *);
 162 
 163 extern void ctf_setspecific(ctf_file_t *, void *);
 164 extern void *ctf_getspecific(ctf_file_t *);
 165 
 166 extern int ctf_errno(ctf_file_t *);
 167 extern const char *ctf_errmsg(int);
 168 extern int ctf_version(int);
 169 
 170 extern int ctf_func_info(ctf_file_t *, ulong_t, ctf_funcinfo_t *);
 171 extern int ctf_func_args(ctf_file_t *, ulong_t, uint_t, ctf_id_t *);
 172 
 173 extern ctf_id_t ctf_lookup_by_name(ctf_file_t *, const char *);
 174 extern ctf_id_t ctf_lookup_by_symbol(ctf_file_t *, ulong_t);
 175 
 176 extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
 177 extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
 178 extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);


 179 extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
 180 extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
 181 extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
 182 extern ctf_id_t ctf_type_reference(ctf_file_t *, ctf_id_t);
 183 extern ctf_id_t ctf_type_pointer(ctf_file_t *, ctf_id_t);
 184 extern int ctf_type_encoding(ctf_file_t *, ctf_id_t, ctf_encoding_t *);
 185 extern int ctf_type_visit(ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
 186 extern int ctf_type_cmp(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
 187 extern int ctf_type_compat(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
 188 
 189 extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
 190     ctf_membinfo_t *);
 191 extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
 192 
 193 extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
 194 extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
 195 
 196 extern const char *ctf_label_topmost(ctf_file_t *);
 197 extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
 198 




   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 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
  28  */
  29 
  30 /*
  31  * This header file defines the interfaces available from the CTF debugger
  32  * library, libctf, and an equivalent kernel module.  This API can be used by
  33  * a debugger to operate on data in the Compact ANSI-C Type Format (CTF).
  34  * This is NOT a public interface, although it may eventually become one in
  35  * the fullness of time after we gain more experience with the interfaces.
  36  *
  37  * In the meantime, be aware that any program linked with this API in this
  38  * release of Solaris is almost guaranteed to break in the next release.
  39  *
  40  * In short, do not user this header file or the CTF routines for any purpose.
  41  */
  42 
  43 #ifndef _CTF_API_H
  44 #define _CTF_API_H
  45 
  46 #include <sys/types.h>
  47 #include <sys/param.h>


 134  * visible at the top-level program scope when subsequently doing a lookup.
 135  */
 136 #define CTF_ADD_NONROOT 0       /* type only visible in nested scope */
 137 #define CTF_ADD_ROOT    1       /* type visible at top-level scope */
 138 
 139 /*
 140  * These typedefs are used to define the signature for callback functions
 141  * that can be used with the iteration and visit functions below:
 142  */
 143 typedef int ctf_visit_f(const char *, ctf_id_t, ulong_t, int, void *);
 144 typedef int ctf_member_f(const char *, ctf_id_t, ulong_t, void *);
 145 typedef int ctf_enum_f(const char *, int, void *);
 146 typedef int ctf_type_f(ctf_id_t, void *);
 147 typedef int ctf_label_f(const char *, const ctf_lblinfo_t *, void *);
 148 
 149 extern ctf_file_t *ctf_bufopen(const ctf_sect_t *, const ctf_sect_t *,
 150     const ctf_sect_t *, int *);
 151 extern ctf_file_t *ctf_fdopen(int, int *);
 152 extern ctf_file_t *ctf_open(const char *, int *);
 153 extern ctf_file_t *ctf_create(int *);
 154 extern ctf_file_t *ctf_dup(ctf_file_t *);
 155 extern void ctf_close(ctf_file_t *);
 156 
 157 extern ctf_file_t *ctf_parent_file(ctf_file_t *);
 158 extern const char *ctf_parent_name(ctf_file_t *);
 159 
 160 extern int ctf_import(ctf_file_t *, ctf_file_t *);
 161 extern int ctf_setmodel(ctf_file_t *, int);
 162 extern int ctf_getmodel(ctf_file_t *);
 163 
 164 extern void ctf_setspecific(ctf_file_t *, void *);
 165 extern void *ctf_getspecific(ctf_file_t *);
 166 
 167 extern int ctf_errno(ctf_file_t *);
 168 extern const char *ctf_errmsg(int);
 169 extern int ctf_version(int);
 170 
 171 extern int ctf_func_info(ctf_file_t *, ulong_t, ctf_funcinfo_t *);
 172 extern int ctf_func_args(ctf_file_t *, ulong_t, uint_t, ctf_id_t *);
 173 
 174 extern ctf_id_t ctf_lookup_by_name(ctf_file_t *, const char *);
 175 extern ctf_id_t ctf_lookup_by_symbol(ctf_file_t *, ulong_t);
 176 
 177 extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
 178 extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
 179 extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
 180 extern char *ctf_type_qname(ctf_file_t *, ctf_id_t, char *, size_t,
 181     const char *);
 182 extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
 183 extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
 184 extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
 185 extern ctf_id_t ctf_type_reference(ctf_file_t *, ctf_id_t);
 186 extern ctf_id_t ctf_type_pointer(ctf_file_t *, ctf_id_t);
 187 extern int ctf_type_encoding(ctf_file_t *, ctf_id_t, ctf_encoding_t *);
 188 extern int ctf_type_visit(ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
 189 extern int ctf_type_cmp(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
 190 extern int ctf_type_compat(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
 191 
 192 extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
 193     ctf_membinfo_t *);
 194 extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
 195 
 196 extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
 197 extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
 198 
 199 extern const char *ctf_label_topmost(ctf_file_t *);
 200 extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
 201