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.
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.
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]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
33 * Report change in input enable status caused by evaluating
34 * $if/$elif control directives.
37 Dbg_map_pass(Lm_list
*lml
, Boolean enable
, const char *file
,
38 Lineno lineno
, const char *directive
)
42 if (DBG_NOTCLASS(DBG_C_MAP
))
45 fmt
= enable
? MSG_INTL(MSG_MAP_PASS
) : MSG_INTL(MSG_MAP_NOPASS
);
46 dbg_print(lml
, fmt
, file
, EC_LINENO(lineno
), directive
);
50 * Report entry/removal of boolean identifier from conditional expression
54 Dbg_map_cexp_id(Lm_list
*lml
, Boolean add
, const char *file
,
55 Lineno lineno
, const char *id
)
59 if (DBG_NOTCLASS(DBG_C_MAP
))
62 fmt
= add
? MSG_INTL(MSG_MAP_ID_ADD
) : MSG_INTL(MSG_MAP_ID_CLEAR
);
63 dbg_print(lml
, fmt
, file
, EC_LINENO(lineno
), id
);
67 Dbg_map_version(Lm_list
*lml
, const char *version
, const char *name
, int scope
)
69 const char *str
, *scp
;
71 if (DBG_NOTCLASS(DBG_C_MAP
| DBG_C_SYMBOLS
))
74 str
= MSG_INTL(MSG_MAP_SYM_SCOPE
);
76 scp
= MSG_ORIG(MSG_SYM_GLOBAL
);
78 scp
= MSG_ORIG(MSG_SYM_LOCAL
);
81 dbg_print(lml
, MSG_INTL(MSG_MAP_SYM_VER_1
), str
, version
,
82 Dbg_demangle_name(name
), scp
);
84 dbg_print(lml
, MSG_INTL(MSG_MAP_SYM_VER_2
), str
,
85 Dbg_demangle_name(name
), scp
);
89 Dbg_map_size_new(Lm_list
*lml
, const char *symname
, const char *segname
,
92 if (DBG_NOTCLASS(DBG_C_MAP
))
95 Dbg_util_nl(lml
, DBG_NL_STD
);
96 dbg_print(lml
, MSG_INTL(MSG_MAP_SYM_SIZE
), EC_LINENO(lineno
), segname
,
97 Dbg_demangle_name(symname
), MSG_INTL(MSG_STR_ADDING
));
101 Dbg_map_size_old(Ofl_desc
*ofl
, Sym_desc
*sdp
, const char *segname
,
104 Conv_inv_buf_t inv_buf
;
105 Lm_list
*lml
= ofl
->ofl_lml
;
107 if (DBG_NOTCLASS(DBG_C_MAP
))
110 Dbg_util_nl(lml
, DBG_NL_STD
);
111 dbg_print(lml
, MSG_INTL(MSG_MAP_SYM_SIZE
), EC_LINENO(lineno
), segname
,
112 sdp
->sd_name
, MSG_INTL(MSG_STR_UP_1
));
117 Elf_syms_table_entry(lml
, ELF_DBG_LD
, MSG_INTL(MSG_STR_UP_2
),
118 ofl
->ofl_dehdr
->e_ident
[EI_OSABI
], ofl
->ofl_dehdr
->e_machine
,
119 sdp
->sd_sym
, sdp
->sd_aux
? sdp
->sd_aux
->sa_overndx
: 0, 0, NULL
,
120 conv_def_tag(sdp
->sd_ref
, &inv_buf
));
124 Dbg_map_symbol(Ofl_desc
*ofl
, Sym_desc
*sdp
)
126 Conv_inv_buf_t inv_buf
;
127 Lm_list
*lml
= ofl
->ofl_lml
;
129 if (DBG_NOTCLASS(DBG_C_MAP
| DBG_C_SYMBOLS
))
134 Elf_syms_table_entry(lml
, ELF_DBG_LD
, MSG_INTL(MSG_STR_ENTERED
),
135 ofl
->ofl_dehdr
->e_ident
[EI_OSABI
], ofl
->ofl_dehdr
->e_machine
,
136 sdp
->sd_sym
, sdp
->sd_aux
? sdp
->sd_aux
->sa_overndx
: 0, 0, NULL
,
137 conv_def_tag(sdp
->sd_ref
, &inv_buf
));
141 * Object version dependency. In the v1 syntax, this is the 'dash' operator.
142 * In the v2 syntax, the DEPEND_VERSIONS directive.
145 Dbg_map_dv(Lm_list
*lml
, const char *obj_name
, Lineno lineno
)
147 if (DBG_NOTCLASS(DBG_C_MAP
))
150 dbg_print(lml
, MSG_INTL(MSG_MAP_DV
), EC_LINENO(lineno
), obj_name
);
154 * Add a version to an object dependency
157 Dbg_map_dv_entry(Lm_list
*lml
, Lineno lineno
, int require
, const char *version
)
161 if (DBG_NOTCLASS(DBG_C_MAP
))
164 attr
= require
? MSG_INTL(MSG_STR_REQUIRE
) : MSG_INTL(MSG_STR_ALLOW
);
165 dbg_print(lml
, MSG_INTL(MSG_MAP_DV_ENTRY
), attr
, version
,
170 Dbg_map_sort_title(Lm_list
*lml
, Boolean orig
)
172 if (DBG_NOTCLASS(DBG_C_MAP
))
178 Dbg_util_nl(lml
, DBG_NL_STD
);
179 dbg_print(lml
, MSG_INTL(MSG_MAP_SORT_TITLE
));
180 dbg_print(lml
, MSG_INTL(MSG_MAP_SORT_TITLE_O
));
182 dbg_print(lml
, MSG_INTL(MSG_MAP_SORT_TITLE_S
));
187 Dbg_map_sort_seg(Lm_list
*lml
, uchar_t osabi
, Half mach
, Sg_desc
*sgp
)
189 const char *type_str
;
190 Conv_inv_buf_t inv_buf
;
192 if (DBG_NOTCLASS(DBG_C_MAP
))
197 type_str
= conv_phdr_type(osabi
, mach
, sgp
->sg_phdr
.p_type
,
201 if (sgp
->sg_flags
& FLG_SG_P_VADDR
) {
202 dbg_print(lml
, MSG_ORIG(MSG_MAP_SORT_SEG_V
),
203 type_str
, sgp
->sg_name
,
204 EC_ADDR(sgp
->sg_phdr
.p_vaddr
));
205 } else if (sgp
->sg_flags
& FLG_SG_ORDERED
) {
207 * All FLG_SG_ORDERED have adjacent sg_id values
208 * that start at SGID_TEXT. Subtract out the base
209 * in order to present the order values based at 0.
211 dbg_print(lml
, MSG_ORIG(MSG_MAP_SORT_SEG_O
),
212 type_str
, sgp
->sg_name
,
213 EC_WORD(sgp
->sg_id
- SGID_TEXT
));
215 dbg_print(lml
, MSG_ORIG(MSG_MAP_SORT_SEG_NAME
),
216 type_str
, sgp
->sg_name
);
219 dbg_print(lml
, MSG_ORIG(MSG_MAP_SORT_SEG
), type_str
);
224 Dbg_map_parse(Lm_list
*lml
, const char *file
, int version
)
226 Conv_inv_buf_t inv_buf
;
228 if (DBG_NOTCLASS(DBG_C_MAP
))
231 Dbg_util_nl(lml
, DBG_NL_STD
);
232 dbg_print(lml
, MSG_INTL(MSG_MAP_MAPFILE
), file
, EC_WORD(version
),
233 conv_mapfile_version(version
, 0, &inv_buf
));
237 Dbg_map_ent(Lm_list
*lml
, Ent_desc
*enp
, Ofl_desc
*ofl
, Lineno lineno
)
239 if (DBG_NOTCLASS(DBG_C_MAP
))
242 Dbg_util_nl(lml
, DBG_NL_STD
);
243 dbg_print(lml
, MSG_INTL(MSG_MAP_EC
), EC_LINENO(lineno
));
244 Dbg_ent_entry(lml
, ofl
->ofl_dehdr
->e_ident
[EI_OSABI
],
245 ofl
->ofl_dehdr
->e_machine
, enp
);
249 Dbg_map_ent_ord_title(Lm_list
*lml
, const char *segname
)
251 if (DBG_NOTCLASS(DBG_C_MAP
))
254 Dbg_util_nl(lml
, DBG_NL_STD
);
255 dbg_print(lml
, MSG_INTL(MSG_MAP_ENT_ORD_TITLE
), segname
);
259 Dbg_map_seg_os_order(Lm_list
*lml
, Sg_desc
*sgp
, const char *sec_name
,
260 Word ndx
, Lineno lineno
)
262 if (DBG_NOTCLASS(DBG_C_MAP
))
265 dbg_print(lml
, MSG_INTL(MSG_MAP_OS_ORDER
), EC_LINENO(lineno
),
266 sgp
->sg_name
, sec_name
, EC_WORD(ndx
));
270 Dbg_map_seg(Ofl_desc
*ofl
, dbg_state_t dbg_state
, int ndx
, Sg_desc
*sgp
,
273 Lm_list
*lml
= ofl
->ofl_lml
;
275 if (DBG_NOTCLASS(DBG_C_MAP
))
278 Dbg_util_nl(lml
, DBG_NL_STD
);
279 dbg_print(lml
, MSG_INTL(MSG_MAP_SEG
), EC_LINENO(lineno
),
280 Dbg_state_str(dbg_state
));
281 Dbg_seg_desc_entry(ofl
->ofl_lml
, ofl
->ofl_dehdr
->e_ident
[EI_OSABI
],
282 ofl
->ofl_dehdr
->e_machine
, ndx
, sgp
, FALSE
);
283 Dbg_util_nl(lml
, DBG_NL_STD
);
287 Dbg_map_seg_order(Ofl_desc
*ofl
, uchar_t osabi
, Half mach
,
288 dbg_state_t dbg_state
, Lineno lineno
)
290 Lm_list
*lml
= ofl
->ofl_lml
;
293 Conv_inv_buf_t inv_buf
;
294 const char *type_str
;
296 if (DBG_NOTCLASS(DBG_C_MAP
))
299 Dbg_util_nl(lml
, DBG_NL_STD
);
300 dbg_print(lml
, MSG_INTL(MSG_MAP_SEG_ORDER
), EC_LINENO(lineno
),
301 EC_XWORD(aplist_nitems(ofl
->ofl_segs_order
)),
302 Dbg_state_str(dbg_state
));
303 for (APLIST_TRAVERSE(ofl
->ofl_segs_order
, idx
, sgp
)) {
304 type_str
= conv_phdr_type(osabi
, mach
, sgp
->sg_phdr
.p_type
,
306 dbg_print(lml
, MSG_ORIG(MSG_MAP_SORT_SEG_NAME
), type_str
,
309 Dbg_util_nl(lml
, DBG_NL_STD
);
313 Dbg_map_post_title(Lm_list
*lml
)
315 if (DBG_NOTCLASS(DBG_C_MAP
))
318 Dbg_util_nl(lml
, DBG_NL_STD
);
319 dbg_print(lml
, MSG_INTL(MSG_MAP_POST_TITLE
));
323 Dbg_map_hdr_noalloc(Lm_list
*lml
, Lineno lineno
)
325 if (DBG_NOTCLASS(DBG_C_MAP
))
328 Dbg_util_nl(lml
, DBG_NL_STD
);
329 dbg_print(lml
, MSG_INTL(MSG_MAP_HDR_NOALLOC
), EC_LINENO(lineno
));