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