xref: /titanic_44/usr/src/cmd/sgs/liblddbg/common/move.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  *	Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	"msg.h"
29 #include	"_debug.h"
30 #include	"libld.h"
31 
32 /*
33  * Debug functions
34  */
35 
36 #if	!defined(_ELF64)
37 void
38 Dbg_move_adjexpandreloc(ulong_t offset, const char *name)
39 {
40 	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
41 		return;
42 	if (DBG_NOTDETAIL())
43 		return;
44 
45 	dbg_print(MSG_INTL(MSG_MV_ADJEXPAND1), _Dbg_sym_dem(name),
46 	    EC_XWORD(offset));
47 }
48 
49 void
50 Dbg_move_adjmovereloc(ulong_t offset1, ulong_t offset2, const char *name)
51 {
52 	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
53 		return;
54 	if (DBG_NOTDETAIL())
55 		return;
56 
57 	dbg_print(MSG_INTL(MSG_MV_ADJMOVE1), _Dbg_sym_dem(name),
58 	    EC_XWORD(offset1), EC_XWORD(offset2));
59 }
60 #endif	/* !defined(_ELF64) */
61 
62 void
63 Dbg_move_outsctadj(Sym_desc * sdp)
64 {
65 	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
66 		return;
67 	if (DBG_NOTDETAIL())
68 		return;
69 
70 	dbg_print(MSG_INTL(MSG_MV_OUTSCTADJ1), _Dbg_sym_dem(sdp->sd_name));
71 }
72 
73 #if	!defined(_ELF64)
74 void
75 Dbg_move_parexpn(const char *name, const char *reason)
76 {
77 	if (DBG_NOTCLASS(DBG_MOVE))
78 		return;
79 	if (DBG_NOTDETAIL())
80 		return;
81 
82 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
83 	dbg_print(MSG_INTL(MSG_MV_EXPAND0), name, reason);
84 	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
85 }
86 
87 void
88 Dbg_move_outmove(const unsigned char *name)
89 {
90 	if (DBG_NOTCLASS(DBG_MOVE))
91 		return;
92 	if (DBG_NOTDETAIL())
93 		return;
94 
95 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
96 	dbg_print(MSG_INTL(MSG_MV_OUTMOVE0), name);
97 	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
98 }
99 
100 void
101 Dbg_move_expanding(Move *mv, Addr addr)
102 {
103 	if (DBG_NOTCLASS(DBG_MOVE))
104 		return;
105 	if (DBG_NOTDETAIL())
106 		return;
107 
108 	dbg_print(MSG_INTL(MSG_MV_EXPAND1), EC_ADDR(addr),
109 	    EC_LWORD(mv->m_value));
110 }
111 
112 
113 void
114 Dbg_move_input1(const char *name)
115 {
116 	if (DBG_NOTCLASS(DBG_MOVE))
117 		return;
118 	if (DBG_NOTDETAIL())
119 		return;
120 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
121 	dbg_print(MSG_INTL(MSG_MOVE_INPUT1), name);
122 	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
123 }
124 
125 void
126 Dbg_move_data(const char *name)
127 {
128 	if (DBG_NOTCLASS(DBG_MOVE))
129 		return;
130 	if (DBG_NOTDETAIL())
131 		return;
132 
133 	dbg_print(MSG_INTL(MSG_MV_MOVEDATA), _Dbg_sym_dem(name));
134 	dbg_print(MSG_INTL(MSG_MOVE_TITLE2));
135 }
136 #endif	/* !defined(_ELF64) */
137 
138 void
139 Dbg_move_mventry(int which, Move *mv, Sym_desc *s)
140 {
141 	const char *str;
142 
143 	if (DBG_NOTCLASS(DBG_MOVE))
144 		return;
145 	if (DBG_NOTDETAIL())
146 		return;
147 
148 	if (which)
149 		str = MSG_INTL(MSG_MOVE_MVENTRY2);
150 	else
151 		str = MSG_INTL(MSG_MOVE_MVENTRY1);
152 
153 	dbg_print(str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
154 		mv->m_repeat, mv->m_stride, s->sd_name);
155 }
156 
157 void
158 Dbg_move_mventry2(Move *mv, Word st_name, char *name)
159 {
160 	const char *sname;
161 
162 	if (st_name)
163 		sname = (const char *)name;
164 	else
165 		sname = MSG_INTL(MSG_STR_UNKNOWN);
166 
167 	if (DBG_NOTCLASS(DBG_MOVE))
168 		return;
169 	if (DBG_NOTDETAIL())
170 		return;
171 	dbg_print(MSG_INTL(MSG_MOVE_MVENTRY1),
172 		EC_XWORD(mv->m_poffset),
173 		EC_LWORD(mv->m_value),
174 		mv->m_repeat,
175 		mv->m_stride,
176 		sname);
177 }
178