xref: /onnv-gate/usr/src/cmd/sgs/include/debug.h (revision 1109:1a3bd84f03cd)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22*1109Srie 
230Sstevel@tonic-gate /*
240Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate  * Use is subject to license terms.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifndef	_DEBUG_H
290Sstevel@tonic-gate #define	_DEBUG_H
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * Global include file for linker debugging.
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * ld(1) and ld.so carry out all diagnostic debugging calls via dlopen'ing
370Sstevel@tonic-gate  * the library liblddbg.so.  Thus debugging is always enabled.  The utility
380Sstevel@tonic-gate  * elfdump() is explicitly dependent upon this library.  There are two
390Sstevel@tonic-gate  * categories of routines defined in this library:
400Sstevel@tonic-gate  *
410Sstevel@tonic-gate  *  o	Debugging routines that have specific linker knowledge, and test the
420Sstevel@tonic-gate  *	class of debugging allowable before proceeding, start with the `Dbg_'
430Sstevel@tonic-gate  *	prefix.
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  *  o	Lower level routines that provide generic ELF structure interpretation
460Sstevel@tonic-gate  *	start with the `Elf_' prefix.  These latter routines are the only
470Sstevel@tonic-gate  *	routines used by the elfdump() utility.
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate #include <libelf.h>
510Sstevel@tonic-gate #include <sgs.h>
520Sstevel@tonic-gate #include <libld.h>
530Sstevel@tonic-gate #include <rtld.h>
540Sstevel@tonic-gate #include <machdep.h>
550Sstevel@tonic-gate #include <gelf.h>
560Sstevel@tonic-gate 
570Sstevel@tonic-gate #ifdef	__cplusplus
580Sstevel@tonic-gate extern "C" {
590Sstevel@tonic-gate #endif
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /*
620Sstevel@tonic-gate  * Define any interface flags.  These flags direct the debugging routine to
630Sstevel@tonic-gate  * generate different diagnostics, thus the strings themselves are maintained
640Sstevel@tonic-gate  * in this library.
650Sstevel@tonic-gate  */
660Sstevel@tonic-gate #define	DBG_SUP_ENVIRON		1
670Sstevel@tonic-gate #define	DBG_SUP_CMDLINE		2
680Sstevel@tonic-gate #define	DBG_SUP_DEFAULT		3
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	DBG_CONF_IGNORE		1	/* configuration processing errors */
710Sstevel@tonic-gate #define	DBG_CONF_VERSION	2
720Sstevel@tonic-gate #define	DBG_CONF_PRCFAIL	3
730Sstevel@tonic-gate #define	DBG_CONF_CORRUPT	4
740Sstevel@tonic-gate 
750Sstevel@tonic-gate #define	DBG_ORDER_INFO_RANGE	1	/* sh_link out of range */
760Sstevel@tonic-gate #define	DBG_ORDER_INFO_ORDER	2	/* sh_info also ordered */
770Sstevel@tonic-gate #define	DBG_ORDER_LINK_OUTRANGE	3	/* sh_link out of range */
780Sstevel@tonic-gate #define	DBG_ORDER_FLAGS		4	/* sh_flags do not match */
790Sstevel@tonic-gate #define	DBG_ORDER_CYCLIC	5	/* sh_link cyclic */
800Sstevel@tonic-gate #define	DBG_ORDER_LINK_ERROR	6	/* sh_link (one) has an error */
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #define	DBG_INIT_SORT		1	/* calling init from sorted order */
830Sstevel@tonic-gate #define	DBG_INIT_PEND		2	/* calling pending init */
840Sstevel@tonic-gate #define	DBG_INIT_DYN		3	/* dynamically triggered init */
850Sstevel@tonic-gate #define	DBG_INIT_DONE		4	/* init completed */
860Sstevel@tonic-gate 
870Sstevel@tonic-gate #define	DBG_DLSYM_DEF		0
880Sstevel@tonic-gate #define	DBG_DLSYM_NEXT		1
890Sstevel@tonic-gate #define	DBG_DLSYM_DEFAULT	2
900Sstevel@tonic-gate #define	DBG_DLSYM_SELF		3
910Sstevel@tonic-gate #define	DBG_DLSYM_PROBE		4
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #define	DBG_DLCLOSE_NULL	0
940Sstevel@tonic-gate #define	DBG_DLCLOSE_IGNORE	1
950Sstevel@tonic-gate #define	DBG_DLCLOSE_RESCAN	2
960Sstevel@tonic-gate 
970Sstevel@tonic-gate #define	DBG_WAIT_INIT		1
980Sstevel@tonic-gate #define	DBG_WAIT_FINI		2
990Sstevel@tonic-gate #define	DBG_WAIT_SYMBOL		3
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate #define	DBG_SYM_REDUCE_GLOBAL	1	/* reporting global symbols to local */
1020Sstevel@tonic-gate #define	DBG_SYM_REDUCE_RETAIN	2	/* reporting non reduced local syms */
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate #define	DBG_DEP_CREATE		1	/* Group handle operations */
1050Sstevel@tonic-gate #define	DBG_DEP_ADD		2
1060Sstevel@tonic-gate #define	DBG_DEP_DELETE		3
1070Sstevel@tonic-gate #define	DBG_DEP_REMOVE		4
1080Sstevel@tonic-gate #define	DBG_DEP_REMAIN		5
1090Sstevel@tonic-gate #define	DBG_DEP_ORPHAN		6
1100Sstevel@tonic-gate #define	DBG_DEP_REINST		7
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate #define	DBG_BINFO_FOUND		0x0001	/* information regarding binding */
1130Sstevel@tonic-gate #define	DBG_BINFO_DIRECT	0x0002	/* bound directly */
1140Sstevel@tonic-gate #define	DBG_BINFO_COPYREF	0x0004	/* bound to copy relocated reference */
1150Sstevel@tonic-gate #define	DBG_BINFO_FILTEE	0x0008	/* bound to filtee */
1160Sstevel@tonic-gate #define	DBG_BINFO_INTERPOSE	0x0010	/* bound to an identified interposer */
1170Sstevel@tonic-gate #define	DBG_BINFO_PLTADDR	0x0020	/* bound to executables undefined plt */
1180Sstevel@tonic-gate #define	DBG_BINFO_MSK		0xffff
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate #define	DBG_CAP_INITIAL		0
1210Sstevel@tonic-gate #define	DBG_CAP_IGNORE		1
1220Sstevel@tonic-gate #define	DBG_CAP_OLD		2
1230Sstevel@tonic-gate #define	DBG_CAP_NEW		3
1240Sstevel@tonic-gate #define	DBG_CAP_RESOLVED	4
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate #define	DBG_REL_START		1
1270Sstevel@tonic-gate #define	DBG_REL_FINISH		2
1280Sstevel@tonic-gate #define	DBG_REL_NONE		3
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate /*
1310Sstevel@tonic-gate  * Define our setup entry point.
1320Sstevel@tonic-gate  */
1330Sstevel@tonic-gate extern	uint_t		Dbg_setup(const char *);
1340Sstevel@tonic-gate extern	void		Dbg_set(uint_t);
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate /*
1370Sstevel@tonic-gate  * Define a user macro to invoke debugging.  The `dbg_mask' variable acts as a
1380Sstevel@tonic-gate  * suitable flag, and can be set to collect the return value from Dbg_setup().
1390Sstevel@tonic-gate  */
1400Sstevel@tonic-gate extern	uint_t		dbg_mask;
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate #define	DBG_CALL(func)	if (dbg_mask) func
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate /*
1450Sstevel@tonic-gate  * Most debugging tokens are interpreted within liblddbg, and thus any flags
1460Sstevel@tonic-gate  * within dbg_mask are only meaningful to this library.  The following flags
1470Sstevel@tonic-gate  * may be set by the Dbg_setup() by can be interpreted by the caller.
1480Sstevel@tonic-gate  */
1490Sstevel@tonic-gate #define	DBG_G_SNAME	0x10000000	/* prepend simple name */
1500Sstevel@tonic-gate #define	DBG_G_FNAME	0x20000000	/* prepend full name */
1510Sstevel@tonic-gate #define	DBG_G_CLASS	0x40000000	/* prepend ELF class */
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate /*
1540Sstevel@tonic-gate  * Print routine, this must be supplied by the application.
1550Sstevel@tonic-gate  */
1560Sstevel@tonic-gate /*PRINTFLIKE1*/
1570Sstevel@tonic-gate extern	void		dbg_print(const char *, ...);
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate /*
1610Sstevel@tonic-gate  * External interface routines.  These are linker specific.
1620Sstevel@tonic-gate  */
1630Sstevel@tonic-gate #ifdef _ELF64
1640Sstevel@tonic-gate #define	Dbg_cap_hw_1		Dbg_cap_hw_164
1650Sstevel@tonic-gate #define	Dbg_cap_mapfile		Dbg_cap_mapfile64
1660Sstevel@tonic-gate #define	Dbg_cap_sec_entry	Dbg_cap_sec_entry64
1670Sstevel@tonic-gate #define	Dbg_file_analyze	Dbg_file_analyze64
1680Sstevel@tonic-gate #define	Dbg_file_aout		Dbg_file_aout64
1690Sstevel@tonic-gate #define	Dbg_file_archive	Dbg_file_archive64
1700Sstevel@tonic-gate #define	Dbg_file_bind_entry	Dbg_file_bind_entry64
171280Srie #define	Dbg_file_bindings	Dbg_file_bindings64
1720Sstevel@tonic-gate #define	Dbg_file_config_dis	Dbg_file_config_dis64
1730Sstevel@tonic-gate #define	Dbg_file_config_obj	Dbg_file_config_obj64
1740Sstevel@tonic-gate #define	Dbg_file_delete		Dbg_file_delete64
1750Sstevel@tonic-gate #define	Dbg_file_dlclose	Dbg_file_dlclose64
1760Sstevel@tonic-gate #define	Dbg_file_dldump		Dbg_file_dldump64
1770Sstevel@tonic-gate #define	Dbg_file_dlopen		Dbg_file_dlopen64
1780Sstevel@tonic-gate #define	Dbg_file_elf		Dbg_file_elf64
1790Sstevel@tonic-gate #define	Dbg_file_filtee		Dbg_file_filtee64
1800Sstevel@tonic-gate #define	Dbg_file_filter		Dbg_file_filter64
1810Sstevel@tonic-gate #define	Dbg_file_fixname	Dbg_file_fixname64
1820Sstevel@tonic-gate #define	Dbg_file_generic	Dbg_file_generic64
1830Sstevel@tonic-gate #define	Dbg_file_hdl_action	Dbg_file_hdl_action64
1840Sstevel@tonic-gate #define	Dbg_file_hdl_collect	Dbg_file_hdl_collect64
1850Sstevel@tonic-gate #define	Dbg_file_hdl_title	Dbg_file_hdl_title64
1860Sstevel@tonic-gate #define	Dbg_file_ldso		Dbg_file_ldso64
1870Sstevel@tonic-gate #define	Dbg_file_lazyload	Dbg_file_lazyload64
1880Sstevel@tonic-gate #define	Dbg_file_needed		Dbg_file_needed64
1890Sstevel@tonic-gate #define	Dbg_file_nl		Dbg_file_nl64
1900Sstevel@tonic-gate #define	Dbg_file_output		Dbg_file_output64
1910Sstevel@tonic-gate #define	Dbg_file_preload	Dbg_file_preload64
1920Sstevel@tonic-gate #define	Dbg_file_prot		Dbg_file_prot64
1930Sstevel@tonic-gate #define	Dbg_file_reuse		Dbg_file_reuse64
1940Sstevel@tonic-gate #define	Dbg_file_skip		Dbg_file_skip64
1950Sstevel@tonic-gate #define	Dbg_got_display		Dbg_got_display64
1960Sstevel@tonic-gate #define	Dbg_map_atsign		Dbg_map_atsign64
1970Sstevel@tonic-gate #define	Dbg_map_cap		Dbg_map_cap64
1980Sstevel@tonic-gate #define	Dbg_map_dash		Dbg_map_dash64
1990Sstevel@tonic-gate #define	Dbg_map_ent		Dbg_map_ent64
2000Sstevel@tonic-gate #define	Dbg_map_equal		Dbg_map_equal64
2010Sstevel@tonic-gate #define	Dbg_map_parse		Dbg_map_parse64
2020Sstevel@tonic-gate #define	Dbg_map_pipe		Dbg_map_pipe64
2030Sstevel@tonic-gate #define	Dbg_map_seg		Dbg_map_seg64
2040Sstevel@tonic-gate #define	Dbg_map_size_new	Dbg_map_size_new64
2050Sstevel@tonic-gate #define	Dbg_map_size_old	Dbg_map_size_old64
2060Sstevel@tonic-gate #define	Dbg_map_sort_fini	Dbg_map_sort_fini64
2070Sstevel@tonic-gate #define	Dbg_map_sort_orig	Dbg_map_sort_orig64
2080Sstevel@tonic-gate #define	Dbg_map_symbol		Dbg_map_symbol64
2090Sstevel@tonic-gate #define	Dbg_map_version		Dbg_map_version64
2100Sstevel@tonic-gate #define	Dbg_move_mventry	Dbg_move_mventry64
2110Sstevel@tonic-gate #define	Dbg_move_mventry2	Dbg_move_mventry264
2120Sstevel@tonic-gate #define	Dbg_move_outsctadj	Dbg_move_outsctadj64
2130Sstevel@tonic-gate #define	Dbg_reloc_discard	Dbg_reloc_discard64
2140Sstevel@tonic-gate #define	Dbg_reloc_error		Dbg_reloc_error64
2150Sstevel@tonic-gate #define	Dbg_reloc_generate	Dbg_reloc_generate64
2160Sstevel@tonic-gate #define	Dbg_reloc_in		Dbg_reloc_in64
2170Sstevel@tonic-gate #define	Dbg_reloc_out		Dbg_reloc_out64
2180Sstevel@tonic-gate #define	Dbg_reloc_proc		Dbg_reloc_proc64
2190Sstevel@tonic-gate #define	Dbg_reloc_ars_entry	Dbg_reloc_ars_entry64
2200Sstevel@tonic-gate #define	Dbg_reloc_ors_entry	Dbg_reloc_ors_entry64
2210Sstevel@tonic-gate #define	Dbg_reloc_doact		Dbg_reloc_doact64
2220Sstevel@tonic-gate #define	Dbg_reloc_dooutrel	Dbg_reloc_dooutrel64
2230Sstevel@tonic-gate #define	Dbg_reloc_reg_apply	Dbg_reloc_reg_apply64
2240Sstevel@tonic-gate #define	Dbg_reloc_transition	Dbg_reloc_transition64
2250Sstevel@tonic-gate #define	Dbg_sec_added		Dbg_sec_added64
2260Sstevel@tonic-gate #define	Dbg_sec_created		Dbg_sec_created64
2270Sstevel@tonic-gate #define	Dbg_sec_discarded	Dbg_sec_discarded64
2280Sstevel@tonic-gate #define	Dbg_sec_group		Dbg_sec_group64
2290Sstevel@tonic-gate #define	Dbg_sec_in		Dbg_sec_in64
2300Sstevel@tonic-gate #define	Dbg_sec_order_list	Dbg_sec_order_list64
2310Sstevel@tonic-gate #define	Dbg_sec_order_error	Dbg_sec_order_error64
2320Sstevel@tonic-gate #define	Dbg_sec_strtab		Dbg_sec_strtab64
2330Sstevel@tonic-gate #define	Dbg_seg_entry		Dbg_seg_entry64
2340Sstevel@tonic-gate #define	Dbg_seg_list		Dbg_seg_list64
2350Sstevel@tonic-gate #define	Dbg_seg_os		Dbg_seg_os64
2360Sstevel@tonic-gate #define	Dbg_seg_title		Dbg_seg_title64
2370Sstevel@tonic-gate #define	Dbg_statistics_ar	Dbg_statistics_ar64
2380Sstevel@tonic-gate #define	Dbg_statistics_ld	Dbg_statistics_ld64
2390Sstevel@tonic-gate #define	Dbg_syminfo_entry	Dbg_syminfo_entry64
2400Sstevel@tonic-gate #define	Dbg_syminfo_entry_title	Dbg_syminfo_entry_title64
2410Sstevel@tonic-gate #define	Dbg_syminfo_title	Dbg_syminfo_title64
2420Sstevel@tonic-gate #define	Dbg_syms_ar_checking	Dbg_syms_ar_checking64
2430Sstevel@tonic-gate #define	Dbg_syms_ar_entry	Dbg_syms_ar_entry64
2440Sstevel@tonic-gate #define	Dbg_syms_ar_resolve	Dbg_syms_ar_resolve64
2450Sstevel@tonic-gate #define	Dbg_syms_created	Dbg_syms_created64
2460Sstevel@tonic-gate #define	Dbg_syms_discarded	Dbg_syms_discarded64
2470Sstevel@tonic-gate #define	Dbg_syms_entered	Dbg_syms_entered64
2480Sstevel@tonic-gate #define	Dbg_syms_entry		Dbg_syms_entry64
2490Sstevel@tonic-gate #define	Dbg_syms_global		Dbg_syms_global64
2500Sstevel@tonic-gate #define	Dbg_syms_ignore		Dbg_syms_ignore64
2510Sstevel@tonic-gate #define	Dbg_syms_new		Dbg_syms_new64
2520Sstevel@tonic-gate #define	Dbg_syms_nl		Dbg_syms_nl64
2530Sstevel@tonic-gate #define	Dbg_syms_old		Dbg_syms_old64
2540Sstevel@tonic-gate #define	Dbg_syms_process	Dbg_syms_process64
2550Sstevel@tonic-gate #define	Dbg_syms_reduce		Dbg_syms_reduce64
2560Sstevel@tonic-gate #define	Dbg_syms_reloc		Dbg_syms_reloc64
2570Sstevel@tonic-gate #define	Dbg_syms_resolved	Dbg_syms_resolved64
2580Sstevel@tonic-gate #define	Dbg_syms_resolving1	Dbg_syms_resolving164
2590Sstevel@tonic-gate #define	Dbg_syms_resolving2	Dbg_syms_resolving264
2600Sstevel@tonic-gate #define	Dbg_syms_sec_entry	Dbg_syms_sec_entry64
2610Sstevel@tonic-gate #define	Dbg_syms_sec_title	Dbg_syms_sec_title64
2620Sstevel@tonic-gate #define	Dbg_syms_spec_title	Dbg_syms_spec_title64
2630Sstevel@tonic-gate #define	Dbg_syms_up_title	Dbg_syms_up_title64
2640Sstevel@tonic-gate #define	Dbg_syms_updated	Dbg_syms_updated64
2650Sstevel@tonic-gate #define	Dbg_syms_dlsym		Dbg_syms_dlsym64
2660Sstevel@tonic-gate #define	Dbg_syms_lookup_aout	Dbg_syms_lookup_aout64
2670Sstevel@tonic-gate #define	Dbg_syms_lookup		Dbg_syms_lookup64
2680Sstevel@tonic-gate #define	Dbg_tls_modactivity	Dbg_tls_modactivity64
2690Sstevel@tonic-gate #define	Dbg_tls_static_block	Dbg_tls_static_block64
2700Sstevel@tonic-gate #define	Dbg_unused_sec		Dbg_unused_sec64
2710Sstevel@tonic-gate #define	Dbg_audit_interface	Dbg_audit_interface64
2720Sstevel@tonic-gate #define	Dbg_audit_lib		Dbg_audit_lib64
2730Sstevel@tonic-gate #define	Dbg_audit_object	Dbg_audit_object64
2740Sstevel@tonic-gate #define	Dbg_audit_symval	Dbg_audit_symval64
2750Sstevel@tonic-gate #define	Dbg_audit_version	Dbg_audit_version64
2760Sstevel@tonic-gate #define	Dbg_ver_avail_entry	Dbg_ver_avail_entry64
2770Sstevel@tonic-gate #define	Dbg_ver_desc_entry	Dbg_ver_desc_entry64
2780Sstevel@tonic-gate #endif	/* _ELF64 */
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate extern	void		Dbg_args_files(int, char *);
2810Sstevel@tonic-gate extern	void		Dbg_args_flags(int, int);
2820Sstevel@tonic-gate extern	void		Dbg_bind_global(const char *, caddr_t, caddr_t, Xword,
2830Sstevel@tonic-gate 			    Pltbindtype, const char *, caddr_t, caddr_t,
2840Sstevel@tonic-gate 			    const char *, uint_t);
2850Sstevel@tonic-gate extern	void		Dbg_bind_plt_summary(Half, Word, Word, Word,
2860Sstevel@tonic-gate 			    Word, Word, Word);
2870Sstevel@tonic-gate extern	void		Dbg_bind_profile(uint_t, uint_t);
2880Sstevel@tonic-gate extern	void		Dbg_bind_weak(const char *, caddr_t, caddr_t,
2890Sstevel@tonic-gate 			    const char *);
2900Sstevel@tonic-gate extern	void		Dbg_cap_hw_candidate(const char *);
2910Sstevel@tonic-gate extern	void		Dbg_cap_hw_filter(const char *, const char *);
2920Sstevel@tonic-gate extern	void		Dbg_cap_hw_1(Xword, Half);
2930Sstevel@tonic-gate extern	void		Dbg_cap_mapfile(Xword, Xword, Half);
2940Sstevel@tonic-gate extern	void		Dbg_cap_sec_entry(uint_t, Xword, Xword, Half);
2950Sstevel@tonic-gate extern	void		Dbg_cap_sec_title(const char *);
2960Sstevel@tonic-gate extern	void		Dbg_ent_print(Half, List * len, Boolean);
2970Sstevel@tonic-gate extern	void		Dbg_file_analyze(Rt_map *);
2980Sstevel@tonic-gate extern	void		Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t);
2990Sstevel@tonic-gate extern	void		Dbg_file_archive(const char *, int);
3000Sstevel@tonic-gate extern	void		Dbg_file_ar_rescan(void);
3010Sstevel@tonic-gate extern	void		Dbg_file_bind_entry(Bnd_desc *);
302280Srie extern	void		Dbg_file_bindings(Rt_map *, int, Word);
3030Sstevel@tonic-gate extern	void		Dbg_file_cntl(Lm_list *, Aliste, Aliste);
3040Sstevel@tonic-gate extern	void		Dbg_file_config_dis(const char *, int);
3050Sstevel@tonic-gate extern	void		Dbg_file_config_obj(const char *, const char *,
3060Sstevel@tonic-gate 			    const char *);
3070Sstevel@tonic-gate extern	void		Dbg_file_delete(const char *);
3080Sstevel@tonic-gate extern	void		Dbg_file_dlclose(const char *, int);
3090Sstevel@tonic-gate extern	void		Dbg_file_dldump(const char *, const char *, int);
3100Sstevel@tonic-gate extern	void		Dbg_file_dlopen(const char *, const char *, int);
3110Sstevel@tonic-gate extern	void		Dbg_file_del_rescan(void);
3120Sstevel@tonic-gate extern	void		Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t,
3130Sstevel@tonic-gate 			    ulong_t, Lmid_t, Aliste);
3140Sstevel@tonic-gate extern	void		Dbg_file_filtee(const char *, const char *, int);
3150Sstevel@tonic-gate extern	void		Dbg_file_filter(const char *, const char *, int);
3160Sstevel@tonic-gate extern	void		Dbg_file_fixname(const char *, const char *);
3170Sstevel@tonic-gate extern	void		Dbg_file_generic(Ifl_desc *);
3180Sstevel@tonic-gate extern	void		Dbg_file_hdl_action(Grp_hdl *, Rt_map *, int);
3190Sstevel@tonic-gate extern	void		Dbg_file_hdl_collect(Grp_hdl *, const char *);
3200Sstevel@tonic-gate extern	void		Dbg_file_hdl_title(int);
3210Sstevel@tonic-gate extern	void		Dbg_file_lazyload(const char *, const char *,
3220Sstevel@tonic-gate 			    const char *);
3236Srie extern	void		Dbg_file_ldso(const char *, ulong_t, ulong_t, char **,
3246Srie 			    auxv_t *);
3250Sstevel@tonic-gate extern	void		Dbg_file_mode_promote(const char *, int);
3260Sstevel@tonic-gate extern	void		Dbg_file_needed(const char *, const char *);
3270Sstevel@tonic-gate extern	void		Dbg_file_nl(void);
3280Sstevel@tonic-gate extern	void		Dbg_file_output(Ofl_desc *);
3290Sstevel@tonic-gate extern	void		Dbg_file_preload(const char *);
3300Sstevel@tonic-gate extern	void		Dbg_file_prot(const char *, int);
3310Sstevel@tonic-gate extern	void		Dbg_file_reuse(const char *, const char *);
3320Sstevel@tonic-gate extern	void		Dbg_file_rejected(Rej_desc *);
3330Sstevel@tonic-gate extern	void		Dbg_file_skip(const char *, const char *);
3340Sstevel@tonic-gate extern	void		Dbg_got_display(Gottable *, Ofl_desc *);
3350Sstevel@tonic-gate extern	void		Dbg_libs_audit(const char *, const char *);
3360Sstevel@tonic-gate extern	void		Dbg_libs_ignore(const char *);
3370Sstevel@tonic-gate extern	void		Dbg_libs_init(List *, List *);
3380Sstevel@tonic-gate extern	void		Dbg_libs_l(const char *, const char *);
3390Sstevel@tonic-gate extern	void		Dbg_libs_path(const char *, Half, const char *);
3400Sstevel@tonic-gate extern	void		Dbg_libs_req(const char *, const char *, const char *);
3410Sstevel@tonic-gate extern	void		Dbg_libs_update(List *, List *);
3420Sstevel@tonic-gate extern	void		Dbg_libs_yp(const char *);
3430Sstevel@tonic-gate extern	void		Dbg_libs_ylu(const char *, const char *, int);
3440Sstevel@tonic-gate extern	void		Dbg_libs_find(const char *);
3450Sstevel@tonic-gate extern	void		Dbg_libs_found(const char *, int);
3460Sstevel@tonic-gate extern	void		Dbg_map_atsign(Boolean);
3470Sstevel@tonic-gate extern	void		Dbg_map_dash(const char *, Sdf_desc *);
3480Sstevel@tonic-gate extern	void		Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *);
3490Sstevel@tonic-gate extern	void		Dbg_map_equal(Boolean);
3500Sstevel@tonic-gate extern	void		Dbg_map_parse(const char *);
3510Sstevel@tonic-gate extern	void		Dbg_map_pipe(Sg_desc *, const char *, const Word);
3520Sstevel@tonic-gate extern	void		Dbg_map_seg(Half, int, Sg_desc *);
3530Sstevel@tonic-gate extern	void		Dbg_map_size_new(const char *);
3540Sstevel@tonic-gate extern	void		Dbg_map_size_old(Ehdr *, Sym_desc *);
3550Sstevel@tonic-gate extern	void		Dbg_map_sort_fini(Sg_desc *);
3560Sstevel@tonic-gate extern	void		Dbg_map_sort_orig(Sg_desc *);
3570Sstevel@tonic-gate extern	void		Dbg_map_symbol(Ehdr *, Sym_desc *);
3580Sstevel@tonic-gate extern	void		Dbg_map_version(const char *, const char *, int);
3590Sstevel@tonic-gate extern 	void		Dbg_move_adjexpandreloc(ulong_t, const char *);
3600Sstevel@tonic-gate extern 	void		Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *);
3610Sstevel@tonic-gate extern	void		Dbg_move_data(const char *);
3620Sstevel@tonic-gate extern 	void		Dbg_move_expanding(Move *, Addr);
3630Sstevel@tonic-gate extern 	void		Dbg_move_input1(const char *);
3640Sstevel@tonic-gate extern 	void		Dbg_move_mventry(int, Move *, Sym_desc *);
3650Sstevel@tonic-gate extern 	void		Dbg_move_mventry2(Move *, Word, char *);
3660Sstevel@tonic-gate extern 	void		Dbg_move_outmove(const uchar_t *);
3670Sstevel@tonic-gate extern 	void		Dbg_move_outsctadj(Sym_desc *);
3680Sstevel@tonic-gate extern 	void		Dbg_move_parexpn(const char *, const char *);
3690Sstevel@tonic-gate #if	defined(_ELF64)
3700Sstevel@tonic-gate extern	void		Dbg_pltpad_bindto64(const char *, const char *, Addr);
3710Sstevel@tonic-gate extern	void		Dbg_pltpad_boundto64(const char *, Addr, const char *,
3720Sstevel@tonic-gate 			    const char *);
3730Sstevel@tonic-gate #endif
3740Sstevel@tonic-gate extern	void		Dbg_reloc_apply(unsigned long long, unsigned long long);
3750Sstevel@tonic-gate extern	void		Dbg_reloc_discard(Half, Rel_desc *);
3760Sstevel@tonic-gate extern	void		Dbg_reloc_error(Half, Word, void *, const char *,
3770Sstevel@tonic-gate 			    const char *);
3780Sstevel@tonic-gate extern	void		Dbg_reloc_generate(Os_desc *, Word);
3790Sstevel@tonic-gate extern	void		Dbg_reloc_reg_apply(unsigned long long,
3800Sstevel@tonic-gate 			    unsigned long long);
3810Sstevel@tonic-gate extern	void		Dbg_reloc_in(Half, Word, void *, const char *,
3820Sstevel@tonic-gate 			    const char *);
3830Sstevel@tonic-gate extern	void		Dbg_reloc_out(Half, Word, void *, const char *,
3840Sstevel@tonic-gate 			    const char *);
3850Sstevel@tonic-gate extern	void		Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *);
3860Sstevel@tonic-gate extern	void		Dbg_reloc_ars_entry(Half, Rel_desc *);
3870Sstevel@tonic-gate extern	void		Dbg_reloc_ors_entry(Half, Rel_desc *);
3880Sstevel@tonic-gate extern	void		Dbg_reloc_doactiverel(void);
3890Sstevel@tonic-gate extern	void		Dbg_reloc_doact(Half, Word, Xword, Xword, const char *,
3900Sstevel@tonic-gate 			    Os_desc *);
3910Sstevel@tonic-gate extern	void		Dbg_reloc_dooutrel(GElf_Word);
3920Sstevel@tonic-gate extern	void		Dbg_reloc_copy(const char *, const char *,
3930Sstevel@tonic-gate 			    const char *, int);
3940Sstevel@tonic-gate extern	void		Dbg_reloc_run(const char *, uint_t, int, int);
3950Sstevel@tonic-gate extern	void		Dbg_reloc_transition(Half, Word, Word, Xword,
3960Sstevel@tonic-gate 			    const char *);
3970Sstevel@tonic-gate extern	void		Dbg_sec_added(Os_desc *, Sg_desc *);
3980Sstevel@tonic-gate extern	void		Dbg_sec_created(Os_desc *, Sg_desc *);
3990Sstevel@tonic-gate extern	void		Dbg_sec_discarded(Is_desc *, Is_desc *);
40033Srie extern	void		Dbg_sec_group(Is_desc *, Group_desc *);
4010Sstevel@tonic-gate extern	void		Dbg_sec_in(Is_desc *);
4020Sstevel@tonic-gate extern	void		Dbg_sec_order_list(Ofl_desc *, int);
4030Sstevel@tonic-gate extern	void		Dbg_sec_order_error(Ifl_desc *, Word, int);
4040Sstevel@tonic-gate extern	void		Dbg_sec_strtab(Os_desc *, Str_tbl *);
4050Sstevel@tonic-gate extern	void		Dbg_seg_entry(Half, int, Sg_desc *);
4060Sstevel@tonic-gate extern	void		Dbg_seg_list(Half, List *);
4070Sstevel@tonic-gate extern	void		Dbg_seg_os(Ofl_desc *, Os_desc *, int);
4080Sstevel@tonic-gate extern	void		Dbg_seg_title(void);
4090Sstevel@tonic-gate extern	void		Dbg_support_action(const char *, const char *,
4100Sstevel@tonic-gate 			    Support_ndx, const char *);
4110Sstevel@tonic-gate extern	void		Dbg_support_load(const char *, const char *);
4120Sstevel@tonic-gate extern	void		Dbg_support_req(const char *, int);
4130Sstevel@tonic-gate extern	void		Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *);
4140Sstevel@tonic-gate extern	void		Dbg_syms_ar_entry(Xword, Elf_Arsym *);
4150Sstevel@tonic-gate extern	void		Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *,
4160Sstevel@tonic-gate 			    int);
4170Sstevel@tonic-gate extern	void		Dbg_syms_ar_title(const char *, int);
4180Sstevel@tonic-gate extern	void		Dbg_syms_created(const char *);
4190Sstevel@tonic-gate extern	void		Dbg_syms_discarded(Sym_desc *, Is_desc *);
4200Sstevel@tonic-gate extern	void		Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *);
4210Sstevel@tonic-gate extern	void		Dbg_syms_entry(Xword, Sym_desc *);
4220Sstevel@tonic-gate extern	void		Dbg_syms_global(Xword, const char *);
4230Sstevel@tonic-gate extern	void		Dbg_syms_ignore(Ehdr *, Sym_desc *);
4240Sstevel@tonic-gate extern	void		Dbg_syms_lazy_rescan(const char *);
4250Sstevel@tonic-gate extern	void		Dbg_syms_new(Ehdr *, Sym *, Sym_desc *);
4260Sstevel@tonic-gate extern	void		Dbg_syms_nl(void);
4270Sstevel@tonic-gate extern	void		Dbg_syms_old(Ehdr *, Sym_desc *);
4280Sstevel@tonic-gate extern	void		Dbg_syms_process(Ifl_desc *);
4290Sstevel@tonic-gate extern	void		Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int,
4300Sstevel@tonic-gate 			    const char *);
4310Sstevel@tonic-gate extern	void		Dbg_syms_reloc(Ehdr *, Sym_desc *);
4320Sstevel@tonic-gate extern	void		Dbg_syms_resolved(Ehdr *, Sym_desc *);
4330Sstevel@tonic-gate extern	void		Dbg_syms_resolving1(Xword, const char *, int, int);
4340Sstevel@tonic-gate extern	void		Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *,
4350Sstevel@tonic-gate 			    Ifl_desc *);
4360Sstevel@tonic-gate extern	void		Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *);
4370Sstevel@tonic-gate extern	void		Dbg_syms_sec_title(void);
4380Sstevel@tonic-gate extern	void		Dbg_syms_spec_title(void);
4390Sstevel@tonic-gate extern	void		Dbg_syms_up_title(Ehdr *);
4400Sstevel@tonic-gate extern	void		Dbg_syms_updated(Ehdr *, Sym_desc *, const char *);
4410Sstevel@tonic-gate extern	void		Dbg_syms_dlsym(const char *, const char *, const char *,
4420Sstevel@tonic-gate 			    int);
4430Sstevel@tonic-gate extern	void		Dbg_syms_lookup_aout(const char *);
4440Sstevel@tonic-gate extern	void		Dbg_syms_lookup(const char *, const char *,
4450Sstevel@tonic-gate 			    const char *);
4460Sstevel@tonic-gate extern	void		Dbg_tls_modactivity(void *, uint_t);
4470Sstevel@tonic-gate extern	void		Dbg_tls_static_block(void *, ulong_t);
4480Sstevel@tonic-gate extern	void		Dbg_audit_interface(const char *, const char *);
4490Sstevel@tonic-gate extern	void		Dbg_audit_lib(const char *);
4500Sstevel@tonic-gate extern	void		Dbg_audit_object(const char *, const char *);
4510Sstevel@tonic-gate extern	void		Dbg_audit_symval(const char *, const char *,
4520Sstevel@tonic-gate 			    const char *, Addr, Addr);
4530Sstevel@tonic-gate extern	void		Dbg_audit_version(const char *, ulong_t);
4540Sstevel@tonic-gate extern	void		Dbg_statistics_ar(Ofl_desc *);
4550Sstevel@tonic-gate extern	void		Dbg_statistics_ld(Ofl_desc *);
4560Sstevel@tonic-gate extern	void		Dbg_syminfo_entry(int, Syminfo *, Sym *,
4570Sstevel@tonic-gate 			    const char *, Dyn *);
4580Sstevel@tonic-gate extern	void		Dbg_syminfo_title(void);
459*1109Srie extern	void		Dbg_unused_file(const char *, int, int);
4600Sstevel@tonic-gate extern	void		Dbg_unused_rtldinfo(const char *, const char *);
4610Sstevel@tonic-gate extern	void		Dbg_unused_sec(Is_desc *);
4620Sstevel@tonic-gate extern	void		Dbg_unused_unref(const char *, const char *);
4630Sstevel@tonic-gate extern	void		Dbg_util_broadcast(const char *);
4640Sstevel@tonic-gate extern	void		Dbg_util_call_array(const char *, void *,
4650Sstevel@tonic-gate 			    uint_t, uint_t);
4660Sstevel@tonic-gate extern	void		Dbg_util_call_fini(const char *);
4670Sstevel@tonic-gate extern	void		Dbg_util_call_init(const char *, int);
4680Sstevel@tonic-gate extern	void		Dbg_util_call_main(const char *);
469280Srie extern	void		Dbg_util_collect(const char *, int, int);
4700Sstevel@tonic-gate extern	void		Dbg_util_dbnotify(rd_event_e, r_state_e);
471280Srie extern	void		Dbg_util_edge_in(Rt_map *, uint_t, Rt_map *, int, int);
472280Srie extern	void		Dbg_util_edge_out(const char *, int, const char *);
4730Sstevel@tonic-gate extern	void		Dbg_util_intoolate(const char *);
4740Sstevel@tonic-gate extern	void		Dbg_util_nl(void);
4750Sstevel@tonic-gate extern	void		Dbg_util_no_init(const char *);
476280Srie extern	void		Dbg_util_scc_entry(uint_t, const char *);
477280Srie extern	void		Dbg_util_scc_title(int);
4780Sstevel@tonic-gate extern	void		Dbg_util_str(const char *);
4790Sstevel@tonic-gate extern	void		Dbg_util_wait(int, const char *, const char *);
4800Sstevel@tonic-gate extern	void		Dbg_ver_avail_entry(Ver_index *, const char *);
4810Sstevel@tonic-gate extern	void		Dbg_ver_avail_title(const char *);
4820Sstevel@tonic-gate extern	void		Dbg_ver_desc_entry(Ver_desc *);
4830Sstevel@tonic-gate extern	void		Dbg_ver_def_title(const char *);
4840Sstevel@tonic-gate extern	void		Dbg_ver_need_title(const char *);
4850Sstevel@tonic-gate extern	void		Dbg_ver_need_entry(Half, const char *, const char *);
4860Sstevel@tonic-gate extern	void		Dbg_ver_nointerface(const char *);
4870Sstevel@tonic-gate extern	void		Dbg_ver_symbol(const char *);
4880Sstevel@tonic-gate 
4890Sstevel@tonic-gate /*
4900Sstevel@tonic-gate  * External interface routines. These are not linker specific and provide
4910Sstevel@tonic-gate  * generic routines for interpreting elf structures.
4920Sstevel@tonic-gate  */
4930Sstevel@tonic-gate #ifdef _ELF64
4940Sstevel@tonic-gate #define	Elf_phdr_entry		Gelf_phdr_entry
4950Sstevel@tonic-gate #define	Elf_shdr_entry		Gelf_shdr_entry
4960Sstevel@tonic-gate #define	Elf_sym_table_entry	Gelf_sym_table_entry
4970Sstevel@tonic-gate #else	/* elf32 */
4980Sstevel@tonic-gate extern	void		Elf_phdr_entry(Half, Elf32_Phdr *);
4990Sstevel@tonic-gate extern	void		Elf_shdr_entry(Half, Elf32_Shdr *);
5000Sstevel@tonic-gate extern	void		Elf_sym_table_entry(const char *, Elf32_Ehdr *,
5010Sstevel@tonic-gate 			    Elf32_Sym *, Elf32_Word, const char *,
5020Sstevel@tonic-gate 			    const char *);
5030Sstevel@tonic-gate #endif /* _ELF64 */
5040Sstevel@tonic-gate 
5050Sstevel@tonic-gate /*
5060Sstevel@tonic-gate  * These are used by both the Elf32 and Elf64 sides.
5070Sstevel@tonic-gate  */
5080Sstevel@tonic-gate extern	const char	*Gelf_sym_dem(const char *);
5090Sstevel@tonic-gate 
5100Sstevel@tonic-gate extern	void		Gelf_cap_print(GElf_Cap *, int, Half);
5110Sstevel@tonic-gate extern	void		Gelf_cap_title(void);
5120Sstevel@tonic-gate extern	void		Gelf_phdr_entry(Half, GElf_Phdr *);
5130Sstevel@tonic-gate extern	void		Gelf_shdr_entry(Half, GElf_Shdr *);
5140Sstevel@tonic-gate extern	void		Gelf_sym_table_entry(const char *, GElf_Ehdr *,
5150Sstevel@tonic-gate 			    GElf_Sym *, GElf_Word, const char *, const char *);
5160Sstevel@tonic-gate extern	void		Gelf_elf_data_title(void);
5170Sstevel@tonic-gate extern	void		Gelf_syminfo_entry(int, GElf_Syminfo *, const char *,
5180Sstevel@tonic-gate 			    const char *);
5190Sstevel@tonic-gate extern	void		Gelf_sym_table_title(GElf_Ehdr *, const char *,
5200Sstevel@tonic-gate 			    const char *);
5210Sstevel@tonic-gate extern	void		Gelf_ver_def_title(void);
5220Sstevel@tonic-gate extern	void		Gelf_ver_need_title(void);
5230Sstevel@tonic-gate extern	void		Gelf_ver_line_1(const char *, const char *,
5240Sstevel@tonic-gate 			    const char *, const char *);
5250Sstevel@tonic-gate extern	void		Gelf_ver_line_2(const char *, const char *);
5260Sstevel@tonic-gate extern	void		Gelf_ver_line_3(const char *, const char *,
5270Sstevel@tonic-gate 			    const char *);
5280Sstevel@tonic-gate 
5290Sstevel@tonic-gate extern	void		Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half);
5300Sstevel@tonic-gate extern	void		Gelf_dyn_title(void);
5310Sstevel@tonic-gate extern	void		Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *);
5320Sstevel@tonic-gate extern	void		Gelf_got_title(uchar_t);
5330Sstevel@tonic-gate extern	void		Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr,
5340Sstevel@tonic-gate 			    GElf_Xword, GElf_Word, void *, const char *);
5350Sstevel@tonic-gate extern	void		Gelf_reloc_entry(const char *, GElf_Half, GElf_Word,
5360Sstevel@tonic-gate 			    GElf_Rela *, const char *, const char *);
5370Sstevel@tonic-gate extern	void		Gelf_syminfo_title(void);
5380Sstevel@tonic-gate 
5390Sstevel@tonic-gate #ifdef	__cplusplus
5400Sstevel@tonic-gate }
5410Sstevel@tonic-gate #endif
5420Sstevel@tonic-gate 
5430Sstevel@tonic-gate #endif /* _DEBUG_H */
544