1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2019, Joyent, Inc.
*/
/*
* This header file defines the interfaces available from the CTF debugger
* library, libctf. This library provides functions that a debugger can
* use to operate on data in the Compact ANSI-C Type Format (CTF). This
* is NOT a public interface, although it may eventually become one in
* the fullness of time after we gain more experience with the interfaces.
*
* In the meantime, be aware that any program linked with libctf in this
* release of illumos is almost guaranteed to break in the next release.
*
* In short, do not user this header file or libctf for any purpose.
*/
#ifndef _LIBCTF_H
#define _LIBCTF_H
#include <sys/ctf_api.h>
#include <libelf.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This flag can be used to enable debug messages.
*/
extern int _libctf_debug;
typedef enum ctf_diff_flag {
CTF_DIFF_F_IGNORE_INTNAMES = 0x01
} ctf_diff_flag_t;
typedef struct ctf_diff ctf_diff_t;
typedef void (*ctf_diff_type_f)(ctf_file_t *, ctf_id_t, boolean_t, ctf_file_t *,
ctf_id_t, void *);
typedef void (*ctf_diff_func_f)(ctf_file_t *, ulong_t, boolean_t, ctf_file_t *,
ulong_t, void *);
typedef void (*ctf_diff_obj_f)(ctf_file_t *, ulong_t, ctf_id_t, boolean_t,
ctf_file_t *, ulong_t, ctf_id_t, void *);
extern int ctf_diff_init(ctf_file_t *, ctf_file_t *, ctf_diff_t **);
extern uint_t ctf_diff_getflags(ctf_diff_t *);
extern int ctf_diff_setflags(ctf_diff_t *, uint_t);
extern int ctf_diff_types(ctf_diff_t *, ctf_diff_type_f, void *);
extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *);
extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *);
extern void ctf_diff_fini(ctf_diff_t *);
/*
* Normally, we return a failure if we find a C-derived compilation unit that
* lacks DWARF or CTF (as required). This flag over-rides this check.
*/
#define CTF_ALLOW_MISSING_DEBUG 0x01
extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *,
char *, size_t);
typedef enum ctf_hsc_ret {
CHR_ERROR = -1,
CHR_NO_C_SOURCE = 0,
CHR_HAS_C_SOURCE = 1
} ctf_hsc_ret_t;
extern ctf_hsc_ret_t ctf_has_c_source(Elf *, char *, size_t);
typedef struct ctf_merge_handle ctf_merge_t;
extern ctf_merge_t *ctf_merge_init(int, int *);
extern int ctf_merge_add(ctf_merge_t *, ctf_file_t *);
extern int ctf_merge_set_nthreads(ctf_merge_t *, const uint_t);
extern int ctf_merge_label(ctf_merge_t *, const char *);
extern int ctf_merge_uniquify(ctf_merge_t *, ctf_file_t *, const char *);
extern int ctf_merge_merge(ctf_merge_t *, ctf_file_t **);
extern int ctf_merge_dedup(ctf_merge_t *, ctf_file_t **);
extern void ctf_merge_fini(ctf_merge_t *);
#define CTF_ELFWRITE_F_COMPRESS 0x1
extern int ctf_elffdwrite(ctf_file_t *, int, int, int);
extern int ctf_elfwrite(ctf_file_t *, const char *, const char *, int);
#ifdef __cplusplus
}
#endif
#endif /* _LIBCTF_H */
|