xref: /titanic_41/usr/src/cmd/sgs/liblddbg/common/move.c (revision 602ca9ea8f9ce0933f0944601cc5d230e91a950d)
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 2006 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 void
33 Dbg_move_data(Rt_map *lmp)
34 {
35 	Lm_list	*lml = LIST(lmp);
36 
37 	if (DBG_NOTCLASS(DBG_C_MOVE))
38 		return;
39 	if (DBG_NOTDETAIL())
40 		return;
41 
42 	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
43 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
44 }
45 
46 void
47 Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
48 {
49 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
50 		return;
51 	if (DBG_NOTDETAIL())
52 		return;
53 
54 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
55 	    EC_XWORD(offset));
56 }
57 
58 void
59 Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2,
60     const char *name)
61 {
62 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
63 		return;
64 	if (DBG_NOTDETAIL())
65 		return;
66 
67 	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name),
68 	    EC_XWORD(offset1), EC_XWORD(offset2));
69 }
70 
71 void
72 Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
73 {
74 	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
75 		return;
76 	if (DBG_NOTDETAIL())
77 		return;
78 
79 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
80 	    Dbg_demangle_name(sdp->sd_name));
81 }
82 
83 void
84 Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
85 {
86 	if (DBG_NOTCLASS(DBG_C_MOVE))
87 		return;
88 	if (DBG_NOTDETAIL())
89 		return;
90 
91 	Dbg_util_nl(lml, DBG_NL_STD);
92 	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
93 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
94 }
95 
96 void
97 Dbg_move_outmove(Lm_list *lml, const char *name)
98 {
99 	if (DBG_NOTCLASS(DBG_C_MOVE))
100 		return;
101 	if (DBG_NOTDETAIL())
102 		return;
103 
104 	Dbg_util_nl(lml, DBG_NL_STD);
105 	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
106 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
107 }
108 
109 void
110 Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
111 {
112 	if (DBG_NOTCLASS(DBG_C_MOVE))
113 		return;
114 	if (DBG_NOTDETAIL())
115 		return;
116 
117 	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
118 	    EC_LWORD(mv->m_value));
119 }
120 
121 void
122 Dbg_move_input(Lm_list *lml, const char *name)
123 {
124 	if (DBG_NOTCLASS(DBG_C_MOVE))
125 		return;
126 	if (DBG_NOTDETAIL())
127 		return;
128 
129 	Dbg_util_nl(lml, DBG_NL_STD);
130 	dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name);
131 	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
132 }
133 
134 void
135 Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
136 {
137 	const char *str;
138 
139 	if (DBG_NOTCLASS(DBG_C_MOVE))
140 		return;
141 	if (DBG_NOTDETAIL())
142 		return;
143 
144 	if (which)
145 		str = MSG_INTL(MSG_MOVE_ENTRYIN);
146 	else
147 		str = MSG_INTL(MSG_MOVE_ENTRYOUT);
148 
149 	dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
150 	    mv->m_repeat, mv->m_stride, s->sd_name);
151 }
152 
153 void
154 Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
155 {
156 	const char *sname;
157 
158 	if (DBG_NOTCLASS(DBG_C_MOVE))
159 		return;
160 	if (DBG_NOTDETAIL())
161 		return;
162 
163 	if (st_name)
164 		sname = name;
165 	else
166 		sname = MSG_INTL(MSG_STR_UNKNOWN);
167 
168 	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRYIN), EC_XWORD(mv->m_poffset),
169 	    EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname);
170 }
171