xref: /illumos-gate/usr/src/cmd/sgs/liblddbg/common/move.c (revision 5aefb655)
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
5*5aefb655Srie  * Common Development and Distribution License (the "License").
6*5aefb655Srie  * 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  */
21*5aefb655Srie 
227c478bd9Sstevel@tonic-gate /*
23*5aefb655Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #include	"msg.h"
297c478bd9Sstevel@tonic-gate #include	"_debug.h"
307c478bd9Sstevel@tonic-gate #include	"libld.h"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate void
33*5aefb655Srie Dbg_move_data(Rt_map *lmp)
347c478bd9Sstevel@tonic-gate {
35*5aefb655Srie 	Lm_list	*lml = LIST(lmp);
36*5aefb655Srie 
37*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
387c478bd9Sstevel@tonic-gate 		return;
397c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
407c478bd9Sstevel@tonic-gate 		return;
417c478bd9Sstevel@tonic-gate 
42*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
43*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
44*5aefb655Srie }
45*5aefb655Srie 
46*5aefb655Srie void
47*5aefb655Srie Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
48*5aefb655Srie {
49*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
50*5aefb655Srie 		return;
51*5aefb655Srie 	if (DBG_NOTDETAIL())
52*5aefb655Srie 		return;
53*5aefb655Srie 
54*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
557c478bd9Sstevel@tonic-gate 	    EC_XWORD(offset));
567c478bd9Sstevel@tonic-gate }
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate void
59*5aefb655Srie Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2,
60*5aefb655Srie     const char *name)
617c478bd9Sstevel@tonic-gate {
62*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
637c478bd9Sstevel@tonic-gate 		return;
647c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
657c478bd9Sstevel@tonic-gate 		return;
667c478bd9Sstevel@tonic-gate 
67*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name),
687c478bd9Sstevel@tonic-gate 	    EC_XWORD(offset1), EC_XWORD(offset2));
697c478bd9Sstevel@tonic-gate }
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate void
72*5aefb655Srie Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
737c478bd9Sstevel@tonic-gate {
74*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
757c478bd9Sstevel@tonic-gate 		return;
767c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
777c478bd9Sstevel@tonic-gate 		return;
787c478bd9Sstevel@tonic-gate 
79*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
80*5aefb655Srie 	    Dbg_demangle_name(sdp->sd_name));
817c478bd9Sstevel@tonic-gate }
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate void
84*5aefb655Srie Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
857c478bd9Sstevel@tonic-gate {
86*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
877c478bd9Sstevel@tonic-gate 		return;
887c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
897c478bd9Sstevel@tonic-gate 		return;
907c478bd9Sstevel@tonic-gate 
91*5aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
92*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
93*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
947c478bd9Sstevel@tonic-gate }
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate void
97*5aefb655Srie Dbg_move_outmove(Lm_list *lml, const char *name)
987c478bd9Sstevel@tonic-gate {
99*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1007c478bd9Sstevel@tonic-gate 		return;
1017c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1027c478bd9Sstevel@tonic-gate 		return;
1037c478bd9Sstevel@tonic-gate 
104*5aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
105*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
106*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
107*5aefb655Srie }
108*5aefb655Srie 
109*5aefb655Srie void
110*5aefb655Srie Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
111*5aefb655Srie {
112*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
113*5aefb655Srie 		return;
114*5aefb655Srie 	if (DBG_NOTDETAIL())
115*5aefb655Srie 		return;
116*5aefb655Srie 
117*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
1187c478bd9Sstevel@tonic-gate 	    EC_LWORD(mv->m_value));
1197c478bd9Sstevel@tonic-gate }
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate void
122*5aefb655Srie Dbg_move_input(Lm_list *lml, const char *name)
1237c478bd9Sstevel@tonic-gate {
124*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1257c478bd9Sstevel@tonic-gate 		return;
1267c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1277c478bd9Sstevel@tonic-gate 		return;
1287c478bd9Sstevel@tonic-gate 
129*5aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
130*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name);
131*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
1327c478bd9Sstevel@tonic-gate }
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate void
135*5aefb655Srie Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
1367c478bd9Sstevel@tonic-gate {
1377c478bd9Sstevel@tonic-gate 	const char *str;
1387c478bd9Sstevel@tonic-gate 
139*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1407c478bd9Sstevel@tonic-gate 		return;
1417c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1427c478bd9Sstevel@tonic-gate 		return;
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate 	if (which)
145*5aefb655Srie 		str = MSG_INTL(MSG_MOVE_ENTRY1IN);
1467c478bd9Sstevel@tonic-gate 	else
147*5aefb655Srie 		str = MSG_INTL(MSG_MOVE_ENTRY1OUT);
1487c478bd9Sstevel@tonic-gate 
149*5aefb655Srie 	dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
1507c478bd9Sstevel@tonic-gate 	    mv->m_repeat, mv->m_stride, s->sd_name);
1517c478bd9Sstevel@tonic-gate }
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate void
154*5aefb655Srie Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
1557c478bd9Sstevel@tonic-gate {
1567c478bd9Sstevel@tonic-gate 	const char *sname;
1577c478bd9Sstevel@tonic-gate 
158*5aefb655Srie 	if (DBG_NOTCLASS(DBG_C_MOVE))
1597c478bd9Sstevel@tonic-gate 		return;
1607c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1617c478bd9Sstevel@tonic-gate 		return;
162*5aefb655Srie 
163*5aefb655Srie 	if (st_name)
164*5aefb655Srie 		sname = name;
165*5aefb655Srie 	else
166*5aefb655Srie 		sname = MSG_INTL(MSG_STR_UNKNOWN);
167*5aefb655Srie 
168*5aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRY2), EC_XWORD(mv->m_poffset),
169*5aefb655Srie 	    EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname);
1707c478bd9Sstevel@tonic-gate }
171