xref: /onnv-gate/usr/src/cmd/sgs/liblddbg/common/files.c (revision 12877:69001e4756ae)
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
51618Srie  * Common Development and Distribution License (the "License").
61618Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21685Srie 
220Sstevel@tonic-gate /*
2312254SAli.Bahrami@Oracle.COM  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
266Srie #include	<sys/auxv.h>
270Sstevel@tonic-gate #include	<string.h>
280Sstevel@tonic-gate #include	<unistd.h>
290Sstevel@tonic-gate #include	<fcntl.h>
300Sstevel@tonic-gate #include	<limits.h>
310Sstevel@tonic-gate #include	<stdio.h>
321618Srie #include	<libld.h>
331618Srie #include	<rtld.h>
341618Srie #include	<conv.h>
350Sstevel@tonic-gate #include	"msg.h"
360Sstevel@tonic-gate #include	"_debug.h"
370Sstevel@tonic-gate 
380Sstevel@tonic-gate void
Dbg_file_analyze(Rt_map * lmp)391618Srie Dbg_file_analyze(Rt_map *lmp)
400Sstevel@tonic-gate {
414734Sab196087 	Conv_dl_mode_buf_t	dl_mode_buf;
424734Sab196087 	Lm_list			*lml = LIST(lmp);
431618Srie 
441618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
450Sstevel@tonic-gate 		return;
460Sstevel@tonic-gate 
471618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
481618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp),
494734Sab196087 	    conv_dl_mode(MODE(lmp), 1, &dl_mode_buf));
500Sstevel@tonic-gate }
510Sstevel@tonic-gate 
520Sstevel@tonic-gate void
Dbg_file_mmapobj(Lm_list * lml,const char * name,mmapobj_result_t * ompp,uint_t onum)538598SRod.Evans@Sun.COM Dbg_file_mmapobj(Lm_list *lml, const char *name, mmapobj_result_t *ompp,
548598SRod.Evans@Sun.COM     uint_t onum)
558598SRod.Evans@Sun.COM {
568598SRod.Evans@Sun.COM 	mmapobj_result_t	*mpp;
578598SRod.Evans@Sun.COM 	uint_t			mnum;
588598SRod.Evans@Sun.COM 
598598SRod.Evans@Sun.COM 	if (DBG_NOTCLASS(DBG_C_FILES))
608598SRod.Evans@Sun.COM 		return;
618598SRod.Evans@Sun.COM 	if (DBG_NOTDETAIL())
628598SRod.Evans@Sun.COM 		return;
638598SRod.Evans@Sun.COM 
648598SRod.Evans@Sun.COM 	Dbg_util_nl(lml, DBG_NL_STD);
658598SRod.Evans@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ), name, onum);
668598SRod.Evans@Sun.COM 
678598SRod.Evans@Sun.COM 	for (mnum = 0, mpp = ompp; mnum < onum; mnum++, mpp++) {
688598SRod.Evans@Sun.COM 		const char	*str;
698598SRod.Evans@Sun.COM 		uint_t		type = MR_GET_TYPE(mpp->mr_flags);
708598SRod.Evans@Sun.COM 
718598SRod.Evans@Sun.COM 		if (type == MR_PADDING)
728598SRod.Evans@Sun.COM 			str = MSG_ORIG(MSG_MR_PADDING);
738598SRod.Evans@Sun.COM 		else if (type == MR_HDR_ELF)
748598SRod.Evans@Sun.COM 			str = MSG_ORIG(MSG_MR_HDR_ELF);
758598SRod.Evans@Sun.COM 		else if (type == MR_HDR_AOUT)
768598SRod.Evans@Sun.COM 			str = MSG_ORIG(MSG_MR_HDR_AOUT);
778598SRod.Evans@Sun.COM 		else
788598SRod.Evans@Sun.COM 			str = MSG_ORIG(MSG_STR_EMPTY);
798598SRod.Evans@Sun.COM 
808598SRod.Evans@Sun.COM 		dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ_1), mnum,
818598SRod.Evans@Sun.COM 		    EC_NATPTR(mpp->mr_addr), EC_OFF(mpp->mr_fsize), str);
828598SRod.Evans@Sun.COM 		dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ_2),
838598SRod.Evans@Sun.COM 		    EC_OFF(mpp->mr_offset), EC_OFF(mpp->mr_msize));
848598SRod.Evans@Sun.COM 	}
858598SRod.Evans@Sun.COM 	Dbg_util_nl(lml, DBG_NL_STD);
868598SRod.Evans@Sun.COM }
878598SRod.Evans@Sun.COM 
888598SRod.Evans@Sun.COM void
Dbg_file_aout(Lm_list * lml,const char * name,Addr addr,size_t size,const char * lmid,Aliste lmco)898598SRod.Evans@Sun.COM Dbg_file_aout(Lm_list *lml, const char *name, Addr addr, size_t size,
908598SRod.Evans@Sun.COM     const char *lmid, Aliste lmco)
910Sstevel@tonic-gate {
921618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
930Sstevel@tonic-gate 		return;
940Sstevel@tonic-gate 
951618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_AOUT), name);
968598SRod.Evans@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(addr), EC_OFF(size));
971618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
980Sstevel@tonic-gate }
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate void
Dbg_file_elf(Lm_list * lml,const char * name,Addr addr,size_t size,const char * lmid,Aliste lmco)1018598SRod.Evans@Sun.COM Dbg_file_elf(Lm_list *lml, const char *name, Addr addr, size_t size,
1028598SRod.Evans@Sun.COM     const char *lmid, Aliste lmco)
1030Sstevel@tonic-gate {
1040Sstevel@tonic-gate 	const char	*str;
1050Sstevel@tonic-gate 
1061618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1070Sstevel@tonic-gate 		return;
1080Sstevel@tonic-gate 
1098598SRod.Evans@Sun.COM 	if (addr == 0)
1100Sstevel@tonic-gate 		str = MSG_INTL(MSG_STR_TEMPORARY);
1110Sstevel@tonic-gate 	else
1120Sstevel@tonic-gate 		str = MSG_ORIG(MSG_STR_EMPTY);
1130Sstevel@tonic-gate 
1141618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ELF), name, str);
1158598SRod.Evans@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(addr), EC_OFF(size));
1161618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
1170Sstevel@tonic-gate }
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate void
Dbg_file_ldso(Rt_map * lmp,char ** envp,auxv_t * auxv,const char * lmid,Aliste lmco)1201618Srie Dbg_file_ldso(Rt_map *lmp, char **envp, auxv_t *auxv, const char *lmid,
1211618Srie     Aliste lmco)
1220Sstevel@tonic-gate {
1231618Srie 	Lm_list	*lml = LIST(lmp);
1241618Srie 
1251618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1260Sstevel@tonic-gate 		return;
1270Sstevel@tonic-gate 
1281618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1291618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_LDSO), PATHNAME(lmp));
1308598SRod.Evans@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(ADDR(lmp)),
1318598SRod.Evans@Sun.COM 	    EC_OFF(MSIZE(lmp)));
1321618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_EA), EC_NATPTR(envp),
1331618Srie 	    EC_NATPTR(auxv));
1341618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
1351618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1361618Srie }
1371618Srie 
1381618Srie 
1391618Srie void
Dbg_file_prot(Rt_map * lmp,int prot)1401618Srie Dbg_file_prot(Rt_map *lmp, int prot)
1411618Srie {
1421618Srie 	Lm_list	*lml = LIST(lmp);
1431618Srie 
1441618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1451618Srie 		return;
1461618Srie 
1471618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1481618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PROT), NAME(lmp), (prot ? '+' : '-'));
1490Sstevel@tonic-gate }
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate void
Dbg_file_delete(Rt_map * lmp)1521618Srie Dbg_file_delete(Rt_map *lmp)
1530Sstevel@tonic-gate {
1541618Srie 	Lm_list	*lml = LIST(lmp);
1551618Srie 
1561618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1570Sstevel@tonic-gate 		return;
1580Sstevel@tonic-gate 
1591618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1601618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DELETE), NAME(lmp));
1610Sstevel@tonic-gate }
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate static int	hdl_title = 0;
1640Sstevel@tonic-gate static Msg	hdl_str = 0;
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate void
Dbg_file_hdl_title(int type)1670Sstevel@tonic-gate Dbg_file_hdl_title(int type)
1680Sstevel@tonic-gate {
1695067Srie 	static const Msg titles[] = {
1705067Srie 		MSG_FIL_HDL_CREATE,	/* MSG_INTL(MSG_FIL_HDL_CREATE) */
1715067Srie 		MSG_FIL_HDL_ADD,	/* MSG_INTL(MSG_FIL_HDL_ADD) */
1725067Srie 		MSG_FIL_HDL_DELETE,	/* MSG_INTL(MSG_FIL_HDL_DELETE) */
1735067Srie 		MSG_FIL_HDL_ORPHAN,	/* MSG_INTL(MSG_FIL_HDL_ORPHAN) */
1745067Srie 		MSG_FIL_HDL_REINST,	/* MSG_INTL(MSG_FIL_HDL_REINST) */
1755067Srie 	};
1765067Srie 
1771618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1780Sstevel@tonic-gate 		return;
1790Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1800Sstevel@tonic-gate 		return;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate 	/*
1835067Srie 	 * Establish a binding title for later use in Dbg_file_hdl_action.
1840Sstevel@tonic-gate 	 */
1855067Srie 	if (type <= DBG_HDL_REINST) {
1865067Srie 		hdl_str = titles[type];
1875067Srie 		hdl_title = 1;
1885067Srie 	} else {
1894734Sab196087 		hdl_str = 0;
1905067Srie 		hdl_title = 0;
1913731Srie 	}
1920Sstevel@tonic-gate }
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate void
Dbg_file_hdl_collect(Grp_hdl * ghp,const char * name)1951618Srie Dbg_file_hdl_collect(Grp_hdl *ghp, const char *name)
1960Sstevel@tonic-gate {
1974734Sab196087 	Conv_grphdl_flags_buf_t	grphdl_flags_buf;
1981618Srie 	Lm_list		*lml = ghp->gh_ownlml;
1991618Srie 	const char	*str;
2000Sstevel@tonic-gate 
2011618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2020Sstevel@tonic-gate 		return;
2030Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
2040Sstevel@tonic-gate 		return;
2050Sstevel@tonic-gate 
2061618Srie 	if (ghp->gh_ownlmp)
2071618Srie 		str = NAME(ghp->gh_ownlmp);
2080Sstevel@tonic-gate 	else
2090Sstevel@tonic-gate 		str = MSG_INTL(MSG_STR_ORPHAN);
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate 	if (hdl_title) {
2120Sstevel@tonic-gate 		hdl_title = 0;
2131618Srie 		Dbg_util_nl(lml, DBG_NL_STD);
2140Sstevel@tonic-gate 	}
2150Sstevel@tonic-gate 	if (name)
2161618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_RETAIN), str, name);
2170Sstevel@tonic-gate 	else
2181618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_COLLECT), str,
2194734Sab196087 		    conv_grphdl_flags(ghp->gh_flags, &grphdl_flags_buf));
2200Sstevel@tonic-gate }
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate void
Dbg_file_hdl_action(Grp_hdl * ghp,Rt_map * lmp,int type,uint_t flags)2233731Srie Dbg_file_hdl_action(Grp_hdl *ghp, Rt_map *lmp, int type, uint_t flags)
2240Sstevel@tonic-gate {
2254734Sab196087 	Conv_grpdesc_flags_buf_t grpdesc_flags_buf;
2263731Srie 	const char	*mode, *group;
2273731Srie 	Lm_list		*lml = LIST(lmp);
2283731Srie 	Msg		str;
2290Sstevel@tonic-gate 
2305067Srie 	static const Msg fmt[] = {
2315067Srie 		MSG_FIL_DEP_ADD,	/* MSG_INTL(MSG_FIL_DEP_ADD) */
2325067Srie 		MSG_FIL_DEP_UPDATE,	/* MSG_INTL(MSG_FIL_DEP_UPDATE) */
2335067Srie 		MSG_FIL_DEP_DELETE,	/* MSG_INTL(MSG_FIL_DEP_DELETE) */
2345067Srie 		MSG_FIL_DEP_REMOVE,	/* MSG_INTL(MSG_FIL_DEP_REMOVE) */
2355067Srie 		MSG_FIL_DEP_REMAIN,	/* MSG_INTL(MSG_FIL_DEP_REMAIN) */
2365067Srie 		MSG_FIL_DEP_ORPHAN,	/* MSG_INTL(MSG_FIL_DEP_ORPHAN) */
2375067Srie 		MSG_FIL_DEP_REINST,	/* MSG_INTL(MSG_FIL_DEP_REINST) */
2385067Srie 	};
2391618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2400Sstevel@tonic-gate 		return;
2410Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
2420Sstevel@tonic-gate 		return;
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate 	if (hdl_title) {
2451618Srie 		Dbg_util_nl(lml, DBG_NL_STD);
2460Sstevel@tonic-gate 		if (hdl_str) {
2479577SRod.Evans@Sun.COM 			Conv_grphdl_flags_buf_t grphdl_flags_buf;
2480Sstevel@tonic-gate 			const char	*name;
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate 			/*
2510Sstevel@tonic-gate 			 * Protect ourselves in case this handle has no
2520Sstevel@tonic-gate 			 * originating owner.
2530Sstevel@tonic-gate 			 */
2541618Srie 			if (ghp->gh_ownlmp)
2551618Srie 				name = NAME(ghp->gh_ownlmp);
2560Sstevel@tonic-gate 			else
2570Sstevel@tonic-gate 				name = MSG_INTL(MSG_STR_UNKNOWN);
2580Sstevel@tonic-gate 
2599577SRod.Evans@Sun.COM 			dbg_print(lml, MSG_INTL(hdl_str), name,
2609577SRod.Evans@Sun.COM 			    conv_grphdl_flags(ghp->gh_flags, &grphdl_flags_buf),
2619577SRod.Evans@Sun.COM 			    EC_NATPTR(ghp));
2620Sstevel@tonic-gate 		}
2630Sstevel@tonic-gate 		hdl_title = 0;
2640Sstevel@tonic-gate 	}
2650Sstevel@tonic-gate 
2664734Sab196087 	/*
2675067Srie 	 * Establish a binding descriptor format string.
2684734Sab196087 	 */
2695067Srie 	if (type > DBG_DEP_REINST)
2704734Sab196087 		return;
2710Sstevel@tonic-gate 
2725067Srie 	str = fmt[type];
2735067Srie 
2745067Srie 	if (((type == DBG_DEP_ADD) || (type == DBG_DEP_UPDATE)) && flags)
2754734Sab196087 		group = conv_grpdesc_flags(flags, &grpdesc_flags_buf);
2763731Srie 	else
2773731Srie 		group = MSG_ORIG(MSG_STR_EMPTY);
2780Sstevel@tonic-gate 
2793731Srie 	if ((MODE(lmp) & (RTLD_GLOBAL | RTLD_NODELETE)) ==
2803731Srie 	    (RTLD_GLOBAL | RTLD_NODELETE))
2813731Srie 		mode = MSG_ORIG(MSG_MODE_GLOBNODEL);
2823731Srie 	else if (MODE(lmp) & RTLD_GLOBAL)
2833731Srie 		mode = MSG_ORIG(MSG_MODE_GLOB);
2843731Srie 	else if (MODE(lmp) & RTLD_NODELETE)
2853731Srie 		mode = MSG_ORIG(MSG_MODE_NODEL);
2863731Srie 	else
2873731Srie 		mode = MSG_ORIG(MSG_STR_EMPTY);
2883731Srie 
2893731Srie 	dbg_print(lml, MSG_INTL(str), NAME(lmp), mode, group);
2900Sstevel@tonic-gate }
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate void
Dbg_file_bind_entry(Lm_list * lml,Bnd_desc * bdp)2931618Srie Dbg_file_bind_entry(Lm_list *lml, Bnd_desc *bdp)
2940Sstevel@tonic-gate {
2954734Sab196087 	Conv_bnd_type_buf_t bnd_type_buf;
2964734Sab196087 
2971618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2980Sstevel@tonic-gate 		return;
2990Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
3000Sstevel@tonic-gate 		return;
3010Sstevel@tonic-gate 
3020Sstevel@tonic-gate 	/*
3030Sstevel@tonic-gate 	 * Print the dependency together with the modes of the binding.
3040Sstevel@tonic-gate 	 */
3051618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3061618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller));
3071618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend),
3084734Sab196087 	    conv_bnd_type(bdp->b_flags, &bnd_type_buf));
309280Srie }
310280Srie 
311280Srie void
Dbg_file_bindings(Rt_map * lmp,int flag)3121618Srie Dbg_file_bindings(Rt_map *lmp, int flag)
313280Srie {
3144734Sab196087 	Conv_bnd_obj_buf_t	bnd_obj_buf;
3154734Sab196087 	Conv_bnd_type_buf_t	bnd_type_buf;
316280Srie 	const char	*str;
317280Srie 	Rt_map		*tlmp;
3181618Srie 	Lm_list		*lml = LIST(lmp);
319280Srie 	int		next = 0;
320280Srie 
3211618Srie 	if (DBG_NOTCLASS(DBG_C_INIT))
322280Srie 		return;
323280Srie 	if (DBG_NOTDETAIL())
324280Srie 		return;
325280Srie 
326280Srie 	if (flag & RT_SORT_REV)
327280Srie 		str = MSG_ORIG(MSG_SCN_INIT);
328280Srie 	else
329280Srie 		str = MSG_ORIG(MSG_SCN_FINI);
330280Srie 
3311618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3321618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DEP_TITLE), str,
3334734Sab196087 	    conv_bnd_obj(lml->lm_flags, &bnd_obj_buf));
334280Srie 
335280Srie 	/* LINTED */
336280Srie 	for (tlmp = lmp; tlmp; tlmp = (Rt_map *)NEXT(tlmp)) {
3375892Sab196087 		Bnd_desc	*bdp;
3385892Sab196087 		Aliste		idx;
339280Srie 
340280Srie 		/*
341280Srie 		 * For .init processing, only collect objects that have been
342280Srie 		 * relocated and haven't already been collected.
343280Srie 		 * For .fini processing, only collect objects that have had
344280Srie 		 * their .init collected, and haven't already been .fini
345280Srie 		 * collected.
346280Srie 		 */
347280Srie 		if (flag & RT_SORT_REV) {
348280Srie 			if ((FLAGS(tlmp) & (FLG_RT_RELOCED |
349280Srie 			    FLG_RT_INITCLCT)) != FLG_RT_RELOCED)
350280Srie 				continue;
351280Srie 
352280Srie 		} else {
353280Srie 			if ((flag & RT_SORT_DELETE) &&
354280Srie 			    ((FLAGS(tlmp) & FLG_RT_DELETE) == 0))
355280Srie 				continue;
356280Srie 			if (((FLAGS(tlmp) &
357280Srie 			    (FLG_RT_INITCLCT | FLG_RT_FINICLCT)) ==
358280Srie 			    FLG_RT_INITCLCT) == 0)
359280Srie 				continue;
360280Srie 		}
361280Srie 
362280Srie 		if (next++)
3631618Srie 			Dbg_util_nl(lml, DBG_NL_STD);
364280Srie 
3655892Sab196087 		if (DEPENDS(tlmp) == NULL)
3661618Srie 			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp));
367280Srie 		else {
3681618Srie 			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp));
369280Srie 
3705892Sab196087 			for (APLIST_TRAVERSE(DEPENDS(tlmp), idx, bdp)) {
3711618Srie 				dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE),
3725892Sab196087 				    NAME(bdp->b_depend),
3735892Sab196087 				    conv_bnd_type(bdp->b_flags,
3744734Sab196087 				    &bnd_type_buf));
375280Srie 			}
376280Srie 		}
377280Srie 	}
3781618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3790Sstevel@tonic-gate }
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate void
Dbg_file_bindings_done(Lm_list * lml)38211690SAli.Bahrami@Sun.COM Dbg_file_bindings_done(Lm_list *lml)
38311690SAli.Bahrami@Sun.COM {
38411690SAli.Bahrami@Sun.COM 	if (DBG_NOTCLASS(DBG_C_INIT))
38511690SAli.Bahrami@Sun.COM 		return;
38611690SAli.Bahrami@Sun.COM 	if (DBG_NOTDETAIL())
38711690SAli.Bahrami@Sun.COM 		return;
38811690SAli.Bahrami@Sun.COM 
38911690SAli.Bahrami@Sun.COM 	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
39011690SAli.Bahrami@Sun.COM }
39111690SAli.Bahrami@Sun.COM 
39211690SAli.Bahrami@Sun.COM void
Dbg_file_lazyload(Rt_map * clmp,const char * fname,const char * sname)3931618Srie Dbg_file_lazyload(Rt_map *clmp, const char *fname, const char *sname)
3940Sstevel@tonic-gate {
3951618Srie 	Lm_list	*lml = LIST(clmp);
3961618Srie 
3971618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
3980Sstevel@tonic-gate 		return;
3990Sstevel@tonic-gate 
4001618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4011618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_LAZYLOAD), fname, NAME(clmp),
4021618Srie 	    Dbg_demangle_name(sname));
4030Sstevel@tonic-gate }
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate void
Dbg_file_preload(Lm_list * lml,const char * name)4061618Srie Dbg_file_preload(Lm_list *lml, const char *name)
4070Sstevel@tonic-gate {
4081618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4090Sstevel@tonic-gate 		return;
4100Sstevel@tonic-gate 
4111618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4121618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PRELOAD), name);
4130Sstevel@tonic-gate }
4140Sstevel@tonic-gate 
4150Sstevel@tonic-gate void
Dbg_file_needed(Rt_map * lmp,const char * name)4161618Srie Dbg_file_needed(Rt_map *lmp, const char *name)
4170Sstevel@tonic-gate {
4181618Srie 	Lm_list	*lml = LIST(lmp);
4191618Srie 
4201618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4210Sstevel@tonic-gate 		return;
4220Sstevel@tonic-gate 
4231618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4241618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_NEEDED), name, NAME(lmp));
4250Sstevel@tonic-gate }
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate void
Dbg_file_filter(Lm_list * lml,const char * filter,const char * filtee,int config)4281618Srie Dbg_file_filter(Lm_list *lml, const char *filter, const char *filtee,
4291618Srie     int config)
4300Sstevel@tonic-gate {
4311618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4320Sstevel@tonic-gate 		return;
4330Sstevel@tonic-gate 
4341618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4350Sstevel@tonic-gate 	if (config)
4361618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_1), filter, filtee);
4370Sstevel@tonic-gate 	else
4381618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_2), filter, filtee);
4390Sstevel@tonic-gate }
4400Sstevel@tonic-gate 
4410Sstevel@tonic-gate void
Dbg_file_filtee(Lm_list * lml,const char * filter,const char * filtee,int audit)4421618Srie Dbg_file_filtee(Lm_list *lml, const char *filter, const char *filtee, int audit)
4430Sstevel@tonic-gate {
444*12877SRod.Evans@Sun.COM 	if (DBG_NOTCLASS(DBG_C_FILES))
445*12877SRod.Evans@Sun.COM 		return;
4460Sstevel@tonic-gate 
447*12877SRod.Evans@Sun.COM 	Dbg_util_nl(lml, DBG_NL_STD);
448*12877SRod.Evans@Sun.COM 
449*12877SRod.Evans@Sun.COM 	if (audit)
4501618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_3), filtee);
451*12877SRod.Evans@Sun.COM 	else if (filter)
452*12877SRod.Evans@Sun.COM 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_1), filtee, filter);
453*12877SRod.Evans@Sun.COM 	else
454*12877SRod.Evans@Sun.COM 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_2), filtee);
4550Sstevel@tonic-gate }
4560Sstevel@tonic-gate 
4570Sstevel@tonic-gate void
Dbg_file_fixname(Lm_list * lml,const char * oname,const char * nname)4581618Srie Dbg_file_fixname(Lm_list *lml, const char *oname, const char *nname)
4590Sstevel@tonic-gate {
4601618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4610Sstevel@tonic-gate 		return;
4620Sstevel@tonic-gate 
4631618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4641618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_FIXNAME), oname, nname);
4650Sstevel@tonic-gate }
4660Sstevel@tonic-gate 
4670Sstevel@tonic-gate void
Dbg_file_output(Ofl_desc * ofl)4680Sstevel@tonic-gate Dbg_file_output(Ofl_desc *ofl)
4690Sstevel@tonic-gate {
4700Sstevel@tonic-gate 	const char	*prefix = MSG_ORIG(MSG_PTH_OBJECT);
4710Sstevel@tonic-gate 	char		*oname, *nname, *ofile;
4720Sstevel@tonic-gate 	int		fd;
4730Sstevel@tonic-gate 
4741618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4750Sstevel@tonic-gate 		return;
4760Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
4770Sstevel@tonic-gate 		return;
4780Sstevel@tonic-gate 
4790Sstevel@tonic-gate 	/*
4800Sstevel@tonic-gate 	 * Obtain the present input object filename for concatenation to the
4810Sstevel@tonic-gate 	 * prefix name.
4820Sstevel@tonic-gate 	 */
4830Sstevel@tonic-gate 	oname = (char *)ofl->ofl_name;
4840Sstevel@tonic-gate 	if ((ofile = strrchr(oname, '/')) == NULL)
4850Sstevel@tonic-gate 		ofile = oname;
4860Sstevel@tonic-gate 	else
4870Sstevel@tonic-gate 		ofile++;
4880Sstevel@tonic-gate 
4890Sstevel@tonic-gate 	/*
4900Sstevel@tonic-gate 	 * Concatenate the prefix with the object filename, open the file and
4910Sstevel@tonic-gate 	 * write out the present Elf memory image.  As this is debugging we
4920Sstevel@tonic-gate 	 * ignore all errors.
4930Sstevel@tonic-gate 	 */
4941618Srie 	if ((nname = malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) {
4950Sstevel@tonic-gate 		(void) strcpy(nname, prefix);
4960Sstevel@tonic-gate 		(void) strcat(nname, ofile);
4970Sstevel@tonic-gate 		if ((fd = open(nname, O_RDWR | O_CREAT | O_TRUNC,
4980Sstevel@tonic-gate 		    0666)) != -1) {
4991618Srie 			(void) write(fd, ofl->ofl_nehdr, ofl->ofl_size);
5001618Srie 			(void) close(fd);
5010Sstevel@tonic-gate 		}
5020Sstevel@tonic-gate 		free(nname);
5030Sstevel@tonic-gate 	}
5040Sstevel@tonic-gate }
5050Sstevel@tonic-gate 
5060Sstevel@tonic-gate void
Dbg_file_config_dis(Lm_list * lml,const char * config,int features)5071618Srie Dbg_file_config_dis(Lm_list *lml, const char *config, int features)
5080Sstevel@tonic-gate {
5094734Sab196087 	Conv_config_feat_buf_t	config_feat_buf;
5104734Sab196087 	const char		*str;
5110Sstevel@tonic-gate 
51211827SRod.Evans@Sun.COM 	if (features == 0)
51311827SRod.Evans@Sun.COM 		return;
51411827SRod.Evans@Sun.COM 
5151976Sab196087 	switch (features & ~CONF_FEATMSK) {
5161976Sab196087 	case DBG_CONF_IGNORE:
5170Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_1);
5181976Sab196087 		break;
5191976Sab196087 	case DBG_CONF_VERSION:
5200Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_2);
5211976Sab196087 		break;
5221976Sab196087 	case DBG_CONF_PRCFAIL:
5230Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_3);
5241976Sab196087 		break;
5251976Sab196087 	case DBG_CONF_CORRUPT:
5260Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_4);
5271976Sab196087 		break;
5281976Sab196087 	case DBG_CONF_ABIMISMATCH:
5291976Sab196087 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_5);
5301976Sab196087 		break;
5311976Sab196087 	default:
5324734Sab196087 		str = conv_config_feat(features, &config_feat_buf);
5331976Sab196087 		break;
5341976Sab196087 	}
5350Sstevel@tonic-gate 
5361618Srie 	Dbg_util_nl(lml, DBG_NL_FRC);
5371618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG_ERR), config, str);
5381618Srie 	Dbg_util_nl(lml, DBG_NL_FRC);
5390Sstevel@tonic-gate }
5400Sstevel@tonic-gate 
5410Sstevel@tonic-gate void
Dbg_file_config_obj(Lm_list * lml,const char * dir,const char * file,const char * config)5421618Srie Dbg_file_config_obj(Lm_list *lml, const char *dir, const char *file,
5431618Srie     const char *config)
5440Sstevel@tonic-gate {
5450Sstevel@tonic-gate 	char	*name, _name[PATH_MAX];
5460Sstevel@tonic-gate 
5471618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5480Sstevel@tonic-gate 		return;
5490Sstevel@tonic-gate 
5500Sstevel@tonic-gate 	if (file) {
5510Sstevel@tonic-gate 		(void) snprintf(_name, PATH_MAX, MSG_ORIG(MSG_FMT_PATH),
5520Sstevel@tonic-gate 		    dir, file);
5530Sstevel@tonic-gate 		name = _name;
5540Sstevel@tonic-gate 	} else
5550Sstevel@tonic-gate 		name = (char *)dir;
5560Sstevel@tonic-gate 
5571618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG), name, config);
5581618Srie }
5591618Srie 
5601618Srie void
Dbg_file_del_rescan(Lm_list * lml)5611618Srie Dbg_file_del_rescan(Lm_list *lml)
5621618Srie {
5631618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5641618Srie 		return;
5651618Srie 
5661618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5671618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DEL_RESCAN));
5681618Srie }
5691618Srie 
5701618Srie void
Dbg_file_mode_promote(Rt_map * lmp,int mode)5711618Srie Dbg_file_mode_promote(Rt_map *lmp, int mode)
5721618Srie {
5734734Sab196087 	Conv_dl_mode_buf_t	dl_mode_buf;
5744734Sab196087 	Lm_list			*lml = LIST(lmp);
5751618Srie 
5761618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5771618Srie 		return;
5781618Srie 
5791618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5801618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PROMOTE), NAME(lmp),
5814734Sab196087 	    conv_dl_mode(mode, 0, &dl_mode_buf));
5821618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5830Sstevel@tonic-gate }
5840Sstevel@tonic-gate 
5851618Srie void
Dbg_file_deferred(Lm_list * lml,const char * oname,const char * nname)58612449SRod.Evans@Sun.COM Dbg_file_deferred(Lm_list *lml, const char *oname, const char *nname)
58712449SRod.Evans@Sun.COM {
58812449SRod.Evans@Sun.COM 	if (DBG_NOTCLASS(DBG_C_FILES))
58912449SRod.Evans@Sun.COM 		return;
59012449SRod.Evans@Sun.COM 
59112449SRod.Evans@Sun.COM 	Dbg_util_nl(lml, DBG_NL_STD);
59212449SRod.Evans@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_DEFERRED), oname, nname);
59312449SRod.Evans@Sun.COM }
59412449SRod.Evans@Sun.COM 
59512449SRod.Evans@Sun.COM void
Dbg_file_cntl(Lm_list * lml,Aliste flmco,Aliste tlmco)5961618Srie Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco)
5971618Srie {
5981618Srie 	Lm_cntl	*lmc;
5991618Srie 	Aliste	off;
6001618Srie 
6011618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6021618Srie 		return;
6031618Srie 	if (DBG_NOTDETAIL())
6041618Srie 		return;
6051618Srie 
6061618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6071618Srie 	dbg_print(lml, MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco),
6081618Srie 	    EC_XWORD(tlmco));
6091618Srie 
6105892Sab196087 	for (ALIST_TRAVERSE_BY_OFFSET(lml->lm_lists, off, lmc)) {
6111618Srie 		Rt_map	*lmp;
6121618Srie 
6131618Srie 		/* LINTED */
6141618Srie 		for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp))
6151618Srie 			dbg_print(lml, MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off),
6161618Srie 			    NAME(lmp));
6171618Srie 	}
6181618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6191618Srie }
6201618Srie 
6217983SAli.Bahrami@Sun.COM /*
6227983SAli.Bahrami@Sun.COM  * Report archive rescan operation.
6237983SAli.Bahrami@Sun.COM  *	argv_start_ndx, argv_end_ndx - Index range of command line arguments
6247983SAli.Bahrami@Sun.COM  *		from which archives are to be reprocessed.
6257983SAli.Bahrami@Sun.COM  */
6261618Srie void
Dbg_file_ar_rescan(Lm_list * lml,int argv_start_ndx,int argv_end_ndx)6277983SAli.Bahrami@Sun.COM Dbg_file_ar_rescan(Lm_list *lml, int argv_start_ndx, int argv_end_ndx)
6281618Srie {
6291618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6301618Srie 		return;
6310Sstevel@tonic-gate 
6321618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6337983SAli.Bahrami@Sun.COM 	dbg_print(lml, MSG_INTL(MSG_FIL_AR_RESCAN),
6347983SAli.Bahrami@Sun.COM 	    argv_start_ndx, argv_end_ndx);
6351618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6361618Srie }
6371618Srie 
6381618Srie void
Dbg_file_ar(Lm_list * lml,const char * name,Boolean again)63912254SAli.Bahrami@Oracle.COM Dbg_file_ar(Lm_list *lml, const char *name, Boolean again)
6401618Srie {
6411618Srie 	const char	*str;
6421618Srie 
6431618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6441618Srie 		return;
6451618Srie 
6461618Srie 	if (again)
6471618Srie 		str = MSG_INTL(MSG_STR_AGAIN);
6481618Srie 	else
6491618Srie 		str = MSG_ORIG(MSG_STR_EMPTY);
6501618Srie 
6511618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6521618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ARCHIVE), name, str);
6531618Srie }
6541618Srie 
6551618Srie void
Dbg_file_generic(Lm_list * lml,Ifl_desc * ifl)6561618Srie Dbg_file_generic(Lm_list *lml, Ifl_desc *ifl)
6571618Srie {
6584734Sab196087 	Conv_inv_buf_t inv_buf;
6594734Sab196087 
6601618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6611618Srie 		return;
6621618Srie 
6631618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6641618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name,
6659273SAli.Bahrami@Sun.COM 	    conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
6669273SAli.Bahrami@Sun.COM 	    ifl->ifl_ehdr->e_type, 0, &inv_buf));
6671618Srie }
6681618Srie 
6691618Srie static const Msg
6700Sstevel@tonic-gate reject[] = {
6710Sstevel@tonic-gate 	MSG_STR_EMPTY,
6720Sstevel@tonic-gate 	MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
6730Sstevel@tonic-gate 	MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
6740Sstevel@tonic-gate 	MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
6750Sstevel@tonic-gate 	MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
6760Sstevel@tonic-gate 	MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
6770Sstevel@tonic-gate 	MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
6780Sstevel@tonic-gate 	MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
6790Sstevel@tonic-gate 	MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
6800Sstevel@tonic-gate 	MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
6810Sstevel@tonic-gate 	MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
6820Sstevel@tonic-gate 	MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
68311827SRod.Evans@Sun.COM 	MSG_REJ_UNKCAP,		/* MSG_INTL(MSG_REJ_UNKCAP) */
6840Sstevel@tonic-gate 	MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
68511827SRod.Evans@Sun.COM 	MSG_REJ_SFCAP_1,	/* MSG_INTL(MSG_REJ_SFCAP_1) */
68611827SRod.Evans@Sun.COM 	MSG_REJ_MACHCAP,	/* MSG_INTL(MSG_REJ_MACHCAP) */
68711827SRod.Evans@Sun.COM 	MSG_REJ_PLATCAP,	/* MSG_INTL(MSG_REJ_PLATCAP) */
68811827SRod.Evans@Sun.COM 	MSG_REJ_HWCAP_2		/* MSG_INTL(MSG_REJ_HWCAP_2) */
6890Sstevel@tonic-gate };
6900Sstevel@tonic-gate 
6910Sstevel@tonic-gate void
Dbg_file_rejected(Lm_list * lml,Rej_desc * rej,Half mach)6926206Sab196087 Dbg_file_rejected(Lm_list *lml, Rej_desc *rej, Half mach)
6930Sstevel@tonic-gate {
6944734Sab196087 	Conv_reject_desc_buf_t rej_buf;
6954734Sab196087 
6961618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6970Sstevel@tonic-gate 		return;
6980Sstevel@tonic-gate 
6991618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7001618Srie 	dbg_print(lml, MSG_INTL(reject[rej->rej_type]), rej->rej_name ?
7014734Sab196087 	    rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN),
7026206Sab196087 	    conv_reject_desc(rej, &rej_buf, mach));
7031618Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7040Sstevel@tonic-gate }
7050Sstevel@tonic-gate 
7060Sstevel@tonic-gate void
Dbg_file_reuse(Lm_list * lml,const char * nname,const char * oname)7071618Srie Dbg_file_reuse(Lm_list *lml, const char *nname, const char *oname)
7080Sstevel@tonic-gate {
7091618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
7100Sstevel@tonic-gate 		return;
7110Sstevel@tonic-gate 
71212254SAli.Bahrami@Oracle.COM 	Dbg_util_nl(lml, DBG_NL_STD);
7131618Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_REUSE), nname, oname);
7140Sstevel@tonic-gate }
7150Sstevel@tonic-gate 
7160Sstevel@tonic-gate void
Dbg_file_skip(Lm_list * lml,const char * oname,const char * nname)7171618Srie Dbg_file_skip(Lm_list *lml, const char *oname, const char *nname)
7180Sstevel@tonic-gate {
7191618Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
7200Sstevel@tonic-gate 		return;
7210Sstevel@tonic-gate 
7221618Srie 	if (oname && strcmp(nname, oname))
7231618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_1), nname, oname);
7241618Srie 	else
7251618Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_2), nname);
7260Sstevel@tonic-gate }
7272978Srie 
7282978Srie void
Dbg_file_modified(Lm_list * lml,const char * obj,const char * oname,const char * nname,int ofd,int nfd,Elf * oelf,Elf * nelf)7292978Srie Dbg_file_modified(Lm_list *lml, const char *obj, const char *oname,
7302978Srie     const char *nname, int ofd, int nfd, Elf *oelf, Elf *nelf)
7312978Srie {
7322978Srie 	const char	*str;
7332978Srie 
7342978Srie 	if (DBG_NOTCLASS(DBG_C_FILES | DBG_C_SUPPORT))
7352978Srie 		return;
7362978Srie 	if (DBG_NOTDETAIL())
7372978Srie 		return;
7382978Srie 
7392978Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7402978Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_MODIFIED), oname, obj);
7412978Srie 
7422978Srie 	if (nname != oname)
7432978Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_NAMECHANGE), nname);
7442978Srie 	if (nfd != ofd) {
7452978Srie 		if (nfd == -1)
7462978Srie 			str = MSG_INTL(MSG_FIL_IGNORE);
7472978Srie 		else
7482978Srie 			str = MSG_ORIG(MSG_STR_EMPTY);
7492978Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FDCHANGE), ofd, nfd, str);
7502978Srie 	}
7512978Srie 	if (nelf != oelf) {
7522978Srie 		if (nelf == 0)
7532978Srie 			str = MSG_INTL(MSG_FIL_IGNORE);
7542978Srie 		else
7552978Srie 			str = MSG_ORIG(MSG_STR_EMPTY);
7562978Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_ELFCHANGE), EC_NATPTR(oelf),
7572978Srie 		    EC_NATPTR(nelf), str);
7582978Srie 	}
7592978Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7602978Srie }
7613731Srie 
7623731Srie void
Dbg_file_cleanup(Lm_list * lml,const char * name,Aliste lmco)7633731Srie Dbg_file_cleanup(Lm_list *lml, const char *name, Aliste lmco)
7643731Srie {
7653731Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
7663731Srie 		return;
7673731Srie 
7683731Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7693731Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CLEANUP), name, EC_XWORD(lmco));
7703731Srie }
771