xref: /illumos-gate/usr/src/lib/libctf/common/libctf_impl.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2019 Joyent, Inc.
14  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
15  */
16 
17 #ifndef _LIBCTF_IMPL_H
18 #define	_LIBCTF_IMPL_H
19 
20 /*
21  * Portions of libctf implementations that are only suitable for CTF's userland
22  * library, eg. converting and merging related routines.
23  */
24 
25 #include <libelf.h>
26 #include <libctf.h>
27 #include <ctf_impl.h>
28 #include <sys/list.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef struct ctf_convert_filelist {
35 	list_node_t ccf_node;
36 	char *ccf_basename;
37 } ctf_convert_filelist_t;
38 
39 struct ctf_convert_handle {
40 	char *cch_label;
41 	uint_t cch_flags;
42 	uint_t cch_nthreads;
43 	uint_t cch_batchsize;
44 	ctf_convert_warn_f cch_warncb;
45 	list_t cch_nodebug;
46 	void *cch_warncb_arg;
47 };
48 
49 typedef int (*ctf_convert_f)(ctf_convert_t *, int, Elf *, ctf_file_t **,
50     char *, size_t);
51 extern int ctf_dwarf_convert(ctf_convert_t *, int, Elf *, ctf_file_t **,
52     char *, size_t);
53 
54 /*
55  * Symbol walking
56  */
57 typedef int (*ctf_symtab_f)(const Elf64_Sym *, ulong_t, const char *,
58     const char *, boolean_t, void *);
59 extern int ctf_symtab_iter(ctf_file_t *, ctf_symtab_f, void *);
60 
61 /*
62  * zlib compression routines
63  */
64 extern int ctf_compress(ctf_file_t *fp, void **, size_t *, size_t *);
65 
66 extern int ctf_diff_self(ctf_diff_t *, ctf_diff_type_f, void *);
67 
68 /*
69  * Internal debugging aids
70  */
71 extern void ctf_phase_dump(ctf_file_t *, const char *, const char *);
72 extern void ctf_phase_bump(void);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* _LIBCTF_IMPL_H */
79