xref: /illumos-gate/usr/src/cmd/sgs/liblddbg/common/move.c (revision 57ef7aa9)
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
55aefb655Srie  * Common Development and Distribution License (the "License").
65aefb655Srie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
215aefb655Srie 
227c478bd9Sstevel@tonic-gate /*
2356deab07SRod Evans  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #include	"msg.h"
287c478bd9Sstevel@tonic-gate #include	"_debug.h"
297c478bd9Sstevel@tonic-gate #include	"libld.h"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate void
Dbg_move_data(Rt_map * lmp)325aefb655Srie Dbg_move_data(Rt_map *lmp)
337c478bd9Sstevel@tonic-gate {
345aefb655Srie 	Lm_list	*lml = LIST(lmp);
355aefb655Srie 
365aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
377c478bd9Sstevel@tonic-gate 		return;
387c478bd9Sstevel@tonic-gate 
395aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
405aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
415aefb655Srie }
425aefb655Srie 
435aefb655Srie void
Dbg_move_adjexpandreloc(Lm_list * lml,Xword offset,const char * name)445aefb655Srie Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
455aefb655Srie {
465aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
475aefb655Srie 		return;
485aefb655Srie 	if (DBG_NOTDETAIL())
495aefb655Srie 		return;
505aefb655Srie 
515aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
527c478bd9Sstevel@tonic-gate 	    EC_XWORD(offset));
537c478bd9Sstevel@tonic-gate }
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate void
Dbg_move_adjmovereloc(Lm_list * lml,Xword offset1,Xword offset2,const char * name)565aefb655Srie Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2,
575aefb655Srie     const char *name)
587c478bd9Sstevel@tonic-gate {
595aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
607c478bd9Sstevel@tonic-gate 		return;
617c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
627c478bd9Sstevel@tonic-gate 		return;
637c478bd9Sstevel@tonic-gate 
645aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name),
657c478bd9Sstevel@tonic-gate 	    EC_XWORD(offset1), EC_XWORD(offset2));
667c478bd9Sstevel@tonic-gate }
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate void
Dbg_move_outsctadj(Lm_list * lml,Sym_desc * sdp)695aefb655Srie Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
707c478bd9Sstevel@tonic-gate {
715aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
727c478bd9Sstevel@tonic-gate 		return;
737c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
747c478bd9Sstevel@tonic-gate 		return;
757c478bd9Sstevel@tonic-gate 
765aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
775aefb655Srie 	    Dbg_demangle_name(sdp->sd_name));
787c478bd9Sstevel@tonic-gate }
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate void
Dbg_move_parexpn(Lm_list * lml,const char * name,const char * reason)815aefb655Srie Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
827c478bd9Sstevel@tonic-gate {
835aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
847c478bd9Sstevel@tonic-gate 		return;
857c478bd9Sstevel@tonic-gate 
865aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
875aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
885aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate void
Dbg_move_outmove(Lm_list * lml,const char * name)925aefb655Srie Dbg_move_outmove(Lm_list *lml, const char *name)
937c478bd9Sstevel@tonic-gate {
945aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
957c478bd9Sstevel@tonic-gate 		return;
967c478bd9Sstevel@tonic-gate 
975aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
985aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
995aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
1005aefb655Srie }
1015aefb655Srie 
1025aefb655Srie void
Dbg_move_expand(Lm_list * lml,Move * mv,Addr addr)1035aefb655Srie Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
1045aefb655Srie {
1055aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1065aefb655Srie 		return;
1075aefb655Srie 
1085aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
1097c478bd9Sstevel@tonic-gate 	    EC_LWORD(mv->m_value));
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate void
Dbg_move_input(Lm_list * lml,const char * name)1135aefb655Srie Dbg_move_input(Lm_list *lml, const char *name)
1147c478bd9Sstevel@tonic-gate {
1155aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1167c478bd9Sstevel@tonic-gate 		return;
1177c478bd9Sstevel@tonic-gate 
1185aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1195aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name);
1205aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate void
Dbg_move_entry1(Lm_list * lml,int which,Move * mv,Sym_desc * s)1245aefb655Srie Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
1257c478bd9Sstevel@tonic-gate {
1267c478bd9Sstevel@tonic-gate 	const char *str;
1277c478bd9Sstevel@tonic-gate 
1285aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1297c478bd9Sstevel@tonic-gate 		return;
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate 	if (which)
132d326b23bSrie 		str = MSG_INTL(MSG_MOVE_ENTRYIN);
1337c478bd9Sstevel@tonic-gate 	else
134d326b23bSrie 		str = MSG_INTL(MSG_MOVE_ENTRYOUT);
1357c478bd9Sstevel@tonic-gate 
136*57ef7aa9SRod Evans 	dbg_print(lml, str, EC_XWORD(mv->m_poffset), ELF_M_SIZE(mv->m_info),
137*57ef7aa9SRod Evans 	    mv->m_repeat, mv->m_stride, EC_LWORD(mv->m_value), s->sd_name);
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate void
Dbg_move_entry2(Lm_list * lml,Move * mv,Word st_name,const char * name)1415aefb655Srie Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
1427c478bd9Sstevel@tonic-gate {
1437c478bd9Sstevel@tonic-gate 	const char *sname;
1447c478bd9Sstevel@tonic-gate 
1455aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1467c478bd9Sstevel@tonic-gate 		return;
1475aefb655Srie 
1485aefb655Srie 	if (st_name)
1495aefb655Srie 		sname = name;
1505aefb655Srie 	else
1515aefb655Srie 		sname = MSG_INTL(MSG_STR_UNKNOWN);
1525aefb655Srie 
153d326b23bSrie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRYIN), EC_XWORD(mv->m_poffset),
154*57ef7aa9SRod Evans 	    ELF_M_SIZE(mv->m_info), mv->m_repeat, mv->m_stride,
155*57ef7aa9SRod Evans 	    EC_LWORD(mv->m_value), sname);
1567c478bd9Sstevel@tonic-gate }
15756deab07SRod Evans 
15856deab07SRod Evans void
Dbg_move_bad(Lm_list * lml,ulong_t num,const char * name,Addr addr)15956deab07SRod Evans Dbg_move_bad(Lm_list *lml, ulong_t num, const char *name, Addr addr)
16056deab07SRod Evans {
16156deab07SRod Evans 	if (DBG_NOTCLASS(DBG_C_MOVE))
16256deab07SRod Evans 		return;
16356deab07SRod Evans 
16456deab07SRod Evans 	dbg_print(lml, MSG_INTL(MSG_MOVE_BAD), EC_XWORD(num), name,
16556deab07SRod Evans 	    EC_ADDR(addr));
16656deab07SRod Evans }
167