xref: /titanic_51/usr/src/lib/libctf/common/libctf.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
26*7fd79137SRobert Mustacchi /*
27*7fd79137SRobert Mustacchi  * Copyright (c) 2015, Joyent, Inc.
28*7fd79137SRobert Mustacchi  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * This header file defines the interfaces available from the CTF debugger
327c478bd9Sstevel@tonic-gate  * library, libctf.  This library provides functions that a debugger can
337c478bd9Sstevel@tonic-gate  * use to operate on data in the Compact ANSI-C Type Format (CTF).  This
347c478bd9Sstevel@tonic-gate  * is NOT a public interface, although it may eventually become one in
357c478bd9Sstevel@tonic-gate  * the fullness of time after we gain more experience with the interfaces.
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  * In the meantime, be aware that any program linked with libctf in this
38*7fd79137SRobert Mustacchi  * release of illumos is almost guaranteed to break in the next release.
397c478bd9Sstevel@tonic-gate  *
407c478bd9Sstevel@tonic-gate  * In short, do not user this header file or libctf for any purpose.
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifndef	_LIBCTF_H
447c478bd9Sstevel@tonic-gate #define	_LIBCTF_H
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #include <sys/ctf_api.h>
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
497c478bd9Sstevel@tonic-gate extern "C" {
507c478bd9Sstevel@tonic-gate #endif
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * This flag can be used to enable debug messages.
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate extern int _libctf_debug;
567c478bd9Sstevel@tonic-gate 
57*7fd79137SRobert Mustacchi typedef enum ctf_diff_flag {
58*7fd79137SRobert Mustacchi 	CTF_DIFF_F_IGNORE_INTNAMES = 0x01
59*7fd79137SRobert Mustacchi } ctf_diff_flag_t;
60*7fd79137SRobert Mustacchi 
61*7fd79137SRobert Mustacchi typedef struct ctf_diff ctf_diff_t;
62*7fd79137SRobert Mustacchi typedef void (*ctf_diff_type_f)(ctf_file_t *, ctf_id_t, boolean_t, ctf_file_t *,
63*7fd79137SRobert Mustacchi     ctf_id_t, void *);
64*7fd79137SRobert Mustacchi typedef void (*ctf_diff_func_f)(ctf_file_t *, ulong_t, boolean_t, ctf_file_t *,
65*7fd79137SRobert Mustacchi     ulong_t, void *);
66*7fd79137SRobert Mustacchi typedef void (*ctf_diff_obj_f)(ctf_file_t *, ulong_t, ctf_id_t, boolean_t,
67*7fd79137SRobert Mustacchi     ctf_file_t *, ulong_t, ctf_id_t, void *);
68*7fd79137SRobert Mustacchi 
69*7fd79137SRobert Mustacchi extern int ctf_diff_init(ctf_file_t *, ctf_file_t *, ctf_diff_t **);
70*7fd79137SRobert Mustacchi extern uint_t ctf_diff_getflags(ctf_diff_t *);
71*7fd79137SRobert Mustacchi extern int ctf_diff_setflags(ctf_diff_t *, uint_t);
72*7fd79137SRobert Mustacchi extern int ctf_diff_types(ctf_diff_t *, ctf_diff_type_f, void *);
73*7fd79137SRobert Mustacchi extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *);
74*7fd79137SRobert Mustacchi extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *);
75*7fd79137SRobert Mustacchi extern void ctf_diff_fini(ctf_diff_t *);
76*7fd79137SRobert Mustacchi 
77*7fd79137SRobert Mustacchi #define	CTF_CONVERT_F_IGNNONC	0x01
78*7fd79137SRobert Mustacchi extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *,
79*7fd79137SRobert Mustacchi     char *, size_t);
80*7fd79137SRobert Mustacchi 
81*7fd79137SRobert Mustacchi typedef struct ctf_merge_handle ctf_merge_t;
82*7fd79137SRobert Mustacchi extern ctf_merge_t *ctf_merge_init(int, int *);
83*7fd79137SRobert Mustacchi extern int ctf_merge_add(ctf_merge_t *, ctf_file_t *);
84*7fd79137SRobert Mustacchi extern int ctf_merge_set_nthreads(ctf_merge_t *, const uint_t);
85*7fd79137SRobert Mustacchi extern int ctf_merge_label(ctf_merge_t *, const char *);
86*7fd79137SRobert Mustacchi extern int ctf_merge_uniquify(ctf_merge_t *, ctf_file_t *, const char *);
87*7fd79137SRobert Mustacchi extern int ctf_merge_merge(ctf_merge_t *, ctf_file_t **);
88*7fd79137SRobert Mustacchi extern int ctf_merge_dedup(ctf_merge_t *, ctf_file_t **);
89*7fd79137SRobert Mustacchi extern void ctf_merge_fini(ctf_merge_t *);
90*7fd79137SRobert Mustacchi 
91*7fd79137SRobert Mustacchi #define	CTF_ELFWRITE_F_COMPRESS		0x1
92*7fd79137SRobert Mustacchi extern int ctf_elffdwrite(ctf_file_t *, int, int, int);
93*7fd79137SRobert Mustacchi extern int ctf_elfwrite(ctf_file_t *, const char *, const char *, int);
94*7fd79137SRobert Mustacchi 
957c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
967c478bd9Sstevel@tonic-gate }
977c478bd9Sstevel@tonic-gate #endif
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #endif	/* _LIBCTF_H */
100