xref: /illumos-gate/usr/src/cmd/sgs/liblddbg/common/move.c (revision c3ea2840)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include	"msg.h"
28 #include	"_debug.h"
29 #include	"libld.h"
30 
31 void
32 Dbg_move_data(Rt_map *lmp)
33 {
34 	Lm_list	*lml = LIST(lmp);
35 
36 	if (DBG_NOTCLASS(DBG_C_MOVE))
37 		return;
38 	if (DBG_NOTDETAIL())
39 		return;
40 
41 	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
42 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
43 }
44 
45 void
46 Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
47 {
48 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
49 		return;
50 	if (DBG_NOTDETAIL())
51 		return;
52 
53 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
54 	    EC_XWORD(offset));
55 }
56 
57 void
58 Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2,
59     const char *name)
60 {
61 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
62 		return;
63 	if (DBG_NOTDETAIL())
64 		return;
65 
66 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name),
67 	    EC_XWORD(offset1), EC_XWORD(offset2));
68 }
69 
70 void
71 Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
72 {
73 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
74 		return;
75 	if (DBG_NOTDETAIL())
76 		return;
77 
78 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
79 	    Dbg_demangle_name(sdp->sd_name));
80 }
81 
82 void
83 Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
84 {
85 	if (DBG_NOTCLASS(DBG_C_MOVE))
86 		return;
87 	if (DBG_NOTDETAIL())
88 		return;
89 
90 	Dbg_util_nl(lml, DBG_NL_STD);
91 	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
92 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
93 }
94 
95 void
96 Dbg_move_outmove(Lm_list *lml, const char *name)
97 {
98 	if (DBG_NOTCLASS(DBG_C_MOVE))
99 		return;
100 	if (DBG_NOTDETAIL())
101 		return;
102 
103 	Dbg_util_nl(lml, DBG_NL_STD);
104 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
105 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
106 }
107 
108 void
109 Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
110 {
111 	if (DBG_NOTCLASS(DBG_C_MOVE))
112 		return;
113 	if (DBG_NOTDETAIL())
114 		return;
115 
116 	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
117 	    EC_LWORD(mv->m_value));
118 }
119 
120 void
121 Dbg_move_input(Lm_list *lml, const char *name)
122 {
123 	if (DBG_NOTCLASS(DBG_C_MOVE))
124 		return;
125 	if (DBG_NOTDETAIL())
126 		return;
127 
128 	Dbg_util_nl(lml, DBG_NL_STD);
129 	dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name);
130 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
131 }
132 
133 void
134 Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
135 {
136 	const char *str;
137 
138 	if (DBG_NOTCLASS(DBG_C_MOVE))
139 		return;
140 	if (DBG_NOTDETAIL())
141 		return;
142 
143 	if (which)
144 		str = MSG_INTL(MSG_MOVE_ENTRYIN);
145 	else
146 		str = MSG_INTL(MSG_MOVE_ENTRYOUT);
147 
148 	dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
149 	    mv->m_repeat, mv->m_stride, s->sd_name);
150 }
151 
152 void
153 Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
154 {
155 	const char *sname;
156 
157 	if (DBG_NOTCLASS(DBG_C_MOVE))
158 		return;
159 	if (DBG_NOTDETAIL())
160 		return;
161 
162 	if (st_name)
163 		sname = name;
164 	else
165 		sname = MSG_INTL(MSG_STR_UNKNOWN);
166 
167 	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRYIN), EC_XWORD(mv->m_poffset),
168 	    EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname);
169 }
170 
171 void
172 Dbg_move_bad(Lm_list *lml, ulong_t num, const char *name, Addr addr)
173 {
174 	if (DBG_NOTCLASS(DBG_C_MOVE))
175 		return;
176 	if (DBG_NOTDETAIL())
177 		return;
178 
179 	dbg_print(lml, MSG_INTL(MSG_MOVE_BAD), EC_XWORD(num), name,
180 	    EC_ADDR(addr));
181 }
182