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 2001-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright (c) 2015, Joyent, Inc.
28 */
29
30 /*
31 * This header file defines the interfaces available from the CTF debugger
32 * library, libctf. This library provides functions that a debugger can
33 * use to operate on data in the Compact ANSI-C Type Format (CTF). This
34 * 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 libctf in this
38 * release of illumos is almost guaranteed to break in the next release.
39 *
40 * In short, do not user this header file or libctf for any purpose.
41 */
42
43 #ifndef _LIBCTF_H
44 #define _LIBCTF_H
45
46 #include <sys/ctf_api.h>
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 /*
53 * This flag can be used to enable debug messages.
54 */
55 extern int _libctf_debug;
56
57 typedef enum ctf_diff_flag {
58 CTF_DIFF_F_IGNORE_INTNAMES = 0x01
59 } ctf_diff_flag_t;
60
61 typedef struct ctf_diff ctf_diff_t;
62 typedef void (*ctf_diff_type_f)(ctf_file_t *, ctf_id_t, boolean_t, ctf_file_t *,
63 ctf_id_t, void *);
64 typedef void (*ctf_diff_func_f)(ctf_file_t *, ulong_t, boolean_t, ctf_file_t *,
65 ulong_t, void *);
66 typedef void (*ctf_diff_obj_f)(ctf_file_t *, ulong_t, ctf_id_t, boolean_t,
67 ctf_file_t *, ulong_t, ctf_id_t, void *);
68
69 extern int ctf_diff_init(ctf_file_t *, ctf_file_t *, ctf_diff_t **);
70 extern uint_t ctf_diff_getflags(ctf_diff_t *);
71 extern int ctf_diff_setflags(ctf_diff_t *, uint_t);
72 extern int ctf_diff_types(ctf_diff_t *, ctf_diff_type_f, void *);
73 extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *);
74 extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *);
75 extern void ctf_diff_fini(ctf_diff_t *);
76
77 #define CTF_CONVERT_F_IGNNONC 0x01
78 extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *,
79 char *, size_t);
80
81 typedef struct ctf_merge_handle ctf_merge_t;
82 extern ctf_merge_t *ctf_merge_init(int, int *);
83 extern int ctf_merge_add(ctf_merge_t *, ctf_file_t *);
84 extern int ctf_merge_set_nthreads(ctf_merge_t *, const uint_t);
85 extern int ctf_merge_label(ctf_merge_t *, const char *);
86 extern int ctf_merge_uniquify(ctf_merge_t *, ctf_file_t *, const char *);
87 extern int ctf_merge_merge(ctf_merge_t *, ctf_file_t **);
88 extern int ctf_merge_dedup(ctf_merge_t *, ctf_file_t **);
89 extern void ctf_merge_fini(ctf_merge_t *);
90
91 #define CTF_ELFWRITE_F_COMPRESS 0x1
92 extern int ctf_elffdwrite(ctf_file_t *, int, int, int);
93 extern int ctf_elfwrite(ctf_file_t *, const char *, const char *, int);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* _LIBCTF_H */
|
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 2001-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright (c) 2019, Joyent, Inc.
28 */
29
30 /*
31 * This header file defines the interfaces available from the CTF debugger
32 * library, libctf. This library provides functions that a debugger can
33 * use to operate on data in the Compact ANSI-C Type Format (CTF). This
34 * 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 libctf in this
38 * release of illumos is almost guaranteed to break in the next release.
39 *
40 * In short, do not user this header file or libctf for any purpose.
41 */
42
43 #ifndef _LIBCTF_H
44 #define _LIBCTF_H
45
46 #include <sys/ctf_api.h>
47 #include <libelf.h>
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 /*
54 * This flag can be used to enable debug messages.
55 */
56 extern int _libctf_debug;
57
58 typedef enum ctf_diff_flag {
59 CTF_DIFF_F_IGNORE_INTNAMES = 0x01
60 } ctf_diff_flag_t;
61
62 typedef struct ctf_diff ctf_diff_t;
63 typedef void (*ctf_diff_type_f)(ctf_file_t *, ctf_id_t, boolean_t, ctf_file_t *,
64 ctf_id_t, void *);
65 typedef void (*ctf_diff_func_f)(ctf_file_t *, ulong_t, boolean_t, ctf_file_t *,
66 ulong_t, void *);
67 typedef void (*ctf_diff_obj_f)(ctf_file_t *, ulong_t, ctf_id_t, boolean_t,
68 ctf_file_t *, ulong_t, ctf_id_t, void *);
69
70 extern int ctf_diff_init(ctf_file_t *, ctf_file_t *, ctf_diff_t **);
71 extern uint_t ctf_diff_getflags(ctf_diff_t *);
72 extern int ctf_diff_setflags(ctf_diff_t *, uint_t);
73 extern int ctf_diff_types(ctf_diff_t *, ctf_diff_type_f, void *);
74 extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *);
75 extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *);
76 extern void ctf_diff_fini(ctf_diff_t *);
77
78 /*
79 * Normally, we return a failure if we find a C-derived compilation unit that
80 * lacks DWARF or CTF (as required). This flag over-rides this check.
81 */
82 #define CTF_ALLOW_MISSING_DEBUG 0x01
83
84 extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *,
85 char *, size_t);
86
87 typedef enum ctf_hsc_ret {
88 CHR_ERROR = -1,
89 CHR_NO_C_SOURCE = 0,
90 CHR_HAS_C_SOURCE = 1
91 } ctf_hsc_ret_t;
92
93 extern ctf_hsc_ret_t ctf_has_c_source(Elf *, char *, size_t);
94
95 typedef struct ctf_merge_handle ctf_merge_t;
96 extern ctf_merge_t *ctf_merge_init(int, int *);
97 extern int ctf_merge_add(ctf_merge_t *, ctf_file_t *);
98 extern int ctf_merge_set_nthreads(ctf_merge_t *, const uint_t);
99 extern int ctf_merge_label(ctf_merge_t *, const char *);
100 extern int ctf_merge_uniquify(ctf_merge_t *, ctf_file_t *, const char *);
101 extern int ctf_merge_merge(ctf_merge_t *, ctf_file_t **);
102 extern int ctf_merge_dedup(ctf_merge_t *, ctf_file_t **);
103 extern void ctf_merge_fini(ctf_merge_t *);
104
105 #define CTF_ELFWRITE_F_COMPRESS 0x1
106 extern int ctf_elffdwrite(ctf_file_t *, int, int, int);
107 extern int ctf_elfwrite(ctf_file_t *, const char *, const char *, int);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* _LIBCTF_H */
|