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