Print this page
12259 CTF shouldn't assume enum size


   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 2019 Joyent, Inc.
  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>


 267 extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
 268     ctf_membinfo_t *);
 269 extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
 270 
 271 extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
 272 extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
 273 
 274 extern const char *ctf_label_topmost(ctf_file_t *);
 275 extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
 276 
 277 extern int ctf_member_iter(ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
 278 extern int ctf_enum_iter(ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
 279 extern int ctf_type_iter(ctf_file_t *, boolean_t, ctf_type_f *, void *);
 280 extern int ctf_label_iter(ctf_file_t *, ctf_label_f *, void *);
 281 extern int ctf_function_iter(ctf_file_t *, ctf_function_f *, void *);
 282 extern int ctf_object_iter(ctf_file_t *, ctf_object_f *, void *);
 283 extern int ctf_string_iter(ctf_file_t *, ctf_string_f *, void *);
 284 
 285 extern ctf_id_t ctf_add_array(ctf_file_t *, uint_t, const ctf_arinfo_t *);
 286 extern ctf_id_t ctf_add_const(ctf_file_t *, uint_t, const char *, ctf_id_t);
 287 extern ctf_id_t ctf_add_enum(ctf_file_t *, uint_t, const char *);
 288 extern ctf_id_t ctf_add_float(ctf_file_t *, uint_t,
 289     const char *, const ctf_encoding_t *);
 290 extern ctf_id_t ctf_add_forward(ctf_file_t *, uint_t, const char *, uint_t);
 291 extern ctf_id_t ctf_add_funcptr(ctf_file_t *, uint_t, const ctf_funcinfo_t *,
 292     const ctf_id_t *);
 293 extern ctf_id_t ctf_add_integer(ctf_file_t *, uint_t,
 294     const char *, const ctf_encoding_t *);
 295 extern ctf_id_t ctf_add_pointer(ctf_file_t *, uint_t, const char *, ctf_id_t);
 296 extern ctf_id_t ctf_add_type(ctf_file_t *, ctf_file_t *, ctf_id_t);
 297 extern ctf_id_t ctf_add_typedef(ctf_file_t *, uint_t, const char *, ctf_id_t);
 298 extern ctf_id_t ctf_add_restrict(ctf_file_t *, uint_t, const char *, ctf_id_t);
 299 extern ctf_id_t ctf_add_struct(ctf_file_t *, uint_t, const char *);
 300 extern ctf_id_t ctf_add_union(ctf_file_t *, uint_t, const char *);
 301 extern ctf_id_t ctf_add_volatile(ctf_file_t *, uint_t, const char *, ctf_id_t);
 302 
 303 extern int ctf_add_enumerator(ctf_file_t *, ctf_id_t, const char *, int);
 304 extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t,
 305     ulong_t);
 306 
 307 




   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 2020 Joyent, Inc.
  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>


 267 extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
 268     ctf_membinfo_t *);
 269 extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
 270 
 271 extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
 272 extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
 273 
 274 extern const char *ctf_label_topmost(ctf_file_t *);
 275 extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
 276 
 277 extern int ctf_member_iter(ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
 278 extern int ctf_enum_iter(ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
 279 extern int ctf_type_iter(ctf_file_t *, boolean_t, ctf_type_f *, void *);
 280 extern int ctf_label_iter(ctf_file_t *, ctf_label_f *, void *);
 281 extern int ctf_function_iter(ctf_file_t *, ctf_function_f *, void *);
 282 extern int ctf_object_iter(ctf_file_t *, ctf_object_f *, void *);
 283 extern int ctf_string_iter(ctf_file_t *, ctf_string_f *, void *);
 284 
 285 extern ctf_id_t ctf_add_array(ctf_file_t *, uint_t, const ctf_arinfo_t *);
 286 extern ctf_id_t ctf_add_const(ctf_file_t *, uint_t, const char *, ctf_id_t);
 287 extern ctf_id_t ctf_add_enum(ctf_file_t *, uint_t, const char *, size_t);
 288 extern ctf_id_t ctf_add_float(ctf_file_t *, uint_t,
 289     const char *, const ctf_encoding_t *);
 290 extern ctf_id_t ctf_add_forward(ctf_file_t *, uint_t, const char *, uint_t);
 291 extern ctf_id_t ctf_add_funcptr(ctf_file_t *, uint_t, const ctf_funcinfo_t *,
 292     const ctf_id_t *);
 293 extern ctf_id_t ctf_add_integer(ctf_file_t *, uint_t,
 294     const char *, const ctf_encoding_t *);
 295 extern ctf_id_t ctf_add_pointer(ctf_file_t *, uint_t, const char *, ctf_id_t);
 296 extern ctf_id_t ctf_add_type(ctf_file_t *, ctf_file_t *, ctf_id_t);
 297 extern ctf_id_t ctf_add_typedef(ctf_file_t *, uint_t, const char *, ctf_id_t);
 298 extern ctf_id_t ctf_add_restrict(ctf_file_t *, uint_t, const char *, ctf_id_t);
 299 extern ctf_id_t ctf_add_struct(ctf_file_t *, uint_t, const char *);
 300 extern ctf_id_t ctf_add_union(ctf_file_t *, uint_t, const char *);
 301 extern ctf_id_t ctf_add_volatile(ctf_file_t *, uint_t, const char *, ctf_id_t);
 302 
 303 extern int ctf_add_enumerator(ctf_file_t *, ctf_id_t, const char *, int);
 304 extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t,
 305     ulong_t);
 306 
 307