xref: /titanic_50/usr/src/lib/libctf/common/libctf.h (revision f3e7f55e73a39377d55a030f124cc86b3b66a9cc)
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*f3e7f55eSRobert Mustacchi /*
27*f3e7f55eSRobert Mustacchi  * Copyright (c) 2015, Joyent, Inc.
28*f3e7f55eSRobert 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*f3e7f55eSRobert 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*f3e7f55eSRobert Mustacchi typedef enum ctf_diff_flag {
58*f3e7f55eSRobert Mustacchi 	CTF_DIFF_F_IGNORE_INTNAMES = 0x01
59*f3e7f55eSRobert Mustacchi } ctf_diff_flag_t;
60*f3e7f55eSRobert Mustacchi 
61*f3e7f55eSRobert Mustacchi typedef struct ctf_diff ctf_diff_t;
62*f3e7f55eSRobert Mustacchi typedef void (*ctf_diff_type_f)(ctf_file_t *, ctf_id_t, boolean_t, ctf_file_t *,
63*f3e7f55eSRobert Mustacchi     ctf_id_t, void *);
64*f3e7f55eSRobert Mustacchi typedef void (*ctf_diff_func_f)(ctf_file_t *, ulong_t, boolean_t, ctf_file_t *,
65*f3e7f55eSRobert Mustacchi     ulong_t, void *);
66*f3e7f55eSRobert Mustacchi typedef void (*ctf_diff_obj_f)(ctf_file_t *, ulong_t, ctf_id_t, boolean_t,
67*f3e7f55eSRobert Mustacchi     ctf_file_t *, ulong_t, ctf_id_t, void *);
68*f3e7f55eSRobert Mustacchi 
69*f3e7f55eSRobert Mustacchi extern int ctf_diff_init(ctf_file_t *, ctf_file_t *, ctf_diff_t **);
70*f3e7f55eSRobert Mustacchi extern uint_t ctf_diff_getflags(ctf_diff_t *);
71*f3e7f55eSRobert Mustacchi extern int ctf_diff_setflags(ctf_diff_t *, uint_t);
72*f3e7f55eSRobert Mustacchi extern int ctf_diff_types(ctf_diff_t *, ctf_diff_type_f, void *);
73*f3e7f55eSRobert Mustacchi extern int ctf_diff_functions(ctf_diff_t *, ctf_diff_func_f, void *);
74*f3e7f55eSRobert Mustacchi extern int ctf_diff_objects(ctf_diff_t *, ctf_diff_obj_f, void *);
75*f3e7f55eSRobert Mustacchi extern void ctf_diff_fini(ctf_diff_t *);
76*f3e7f55eSRobert Mustacchi 
77*f3e7f55eSRobert Mustacchi #define	CTF_CONVERT_F_IGNNONC	0x01
78*f3e7f55eSRobert Mustacchi extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *,
79*f3e7f55eSRobert Mustacchi     char *, size_t);
80*f3e7f55eSRobert Mustacchi 
81*f3e7f55eSRobert Mustacchi typedef struct ctf_merge_handle ctf_merge_t;
82*f3e7f55eSRobert Mustacchi extern ctf_merge_t *ctf_merge_init(int, int *);
83*f3e7f55eSRobert Mustacchi extern int ctf_merge_add(ctf_merge_t *, ctf_file_t *);
84*f3e7f55eSRobert Mustacchi extern int ctf_merge_set_nthreads(ctf_merge_t *, const uint_t);
85*f3e7f55eSRobert Mustacchi extern int ctf_merge_label(ctf_merge_t *, const char *);
86*f3e7f55eSRobert Mustacchi extern int ctf_merge_uniquify(ctf_merge_t *, ctf_file_t *, const char *);
87*f3e7f55eSRobert Mustacchi extern int ctf_merge_merge(ctf_merge_t *, ctf_file_t **);
88*f3e7f55eSRobert Mustacchi extern int ctf_merge_dedup(ctf_merge_t *, ctf_file_t **);
89*f3e7f55eSRobert Mustacchi extern void ctf_merge_fini(ctf_merge_t *);
90*f3e7f55eSRobert Mustacchi 
91*f3e7f55eSRobert Mustacchi #define	CTF_ELFWRITE_F_COMPRESS		0x1
92*f3e7f55eSRobert Mustacchi extern int ctf_elffdwrite(ctf_file_t *, int, int, int);
93*f3e7f55eSRobert Mustacchi extern int ctf_elfwrite(ctf_file_t *, const char *, const char *, int);
94*f3e7f55eSRobert Mustacchi 
957c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
967c478bd9Sstevel@tonic-gate }
977c478bd9Sstevel@tonic-gate #endif
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #endif	/* _LIBCTF_H */
100