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 * Print out a single `segment descriptor' entry.
36 Dbg_seg_desc_entry(Lm_list
*lml
, uchar_t osabi
, Half mach
, int ndx
,
37 Sg_desc
*sgp
, Boolean space_nl
)
39 Conv_seg_flags_buf_t seg_flags_buf
;
44 Dbg_util_nl(lml
, DBG_NL_STD
);
45 dbg_print(lml
, MSG_ORIG(MSG_SEG_DESC
), ndx
);
47 dbg_print(lml
, MSG_ORIG(MSG_SEG_NAME
), sgp
->sg_name
);
49 dbg_print(lml
, MSG_ORIG(MSG_SEG_FLAGS
),
50 conv_seg_flags(sgp
->sg_flags
, &seg_flags_buf
));
52 Elf_phdr(lml
, osabi
, mach
, &sgp
->sg_phdr
);
54 if (sgp
->sg_flags
& FLG_SG_P_ALIGN
)
55 dbg_print(lml
, MSG_ORIG(MSG_SEG_ALIGN
),
56 EC_ADDR(sgp
->sg_align
));
58 if (sgp
->sg_flags
& FLG_SG_LENGTH
)
59 dbg_print(lml
, MSG_ORIG(MSG_SEG_LENGTH
),
60 EC_ADDR(sgp
->sg_length
));
62 if (sgp
->sg_flags
& FLG_SG_ROUND
)
63 dbg_print(lml
, MSG_ORIG(MSG_SEG_ROUND
),
64 EC_ADDR(sgp
->sg_round
));
66 if (aplist_nitems(sgp
->sg_sizesym
) > 0) {
67 dbg_print(lml
, MSG_ORIG(MSG_SEG_SIZESYM_TITLE
));
68 for (APLIST_TRAVERSE(sgp
->sg_sizesym
, idx
, sdp
))
70 dbg_print(lml
, MSG_ORIG(MSG_SEG_SIZESYM
),
71 Dbg_demangle_name(sdp
->sd_name
));
73 if (aplist_nitems(sgp
->sg_is_order
) > 0) {
77 dbg_print(lml
, MSG_ORIG(MSG_SEG_IS_ORDER_TITLE
));
78 for (APLIST_TRAVERSE(sgp
->sg_is_order
, idx
, enp
))
79 dbg_print(lml
, MSG_ORIG(MSG_SEG_LIST_ITEM
),
82 if (alist_nitems(sgp
->sg_os_order
) > 0) {
86 dbg_print(lml
, MSG_ORIG(MSG_SEG_OS_ORDER_TITLE
));
87 for (ALIST_TRAVERSE(sgp
->sg_os_order
, idx
, scop
))
88 dbg_print(lml
, MSG_ORIG(MSG_SEG_LIST_ITEM
),
92 Dbg_util_nl(lml
, DBG_NL_STD
);
96 Dbg_seg_title(Lm_list
*lml
)
98 if (DBG_NOTCLASS(DBG_C_SEGMENTS
))
101 Dbg_util_nl(lml
, DBG_NL_STD
);
102 dbg_print(lml
, MSG_INTL(MSG_SEG_DESC_INUSE
));
106 Dbg_seg_entry(Ofl_desc
*ofl
, int ndx
, Sg_desc
*sgp
)
108 if (DBG_NOTCLASS(DBG_C_SEGMENTS
))
111 Dbg_seg_desc_entry(ofl
->ofl_lml
, ofl
->ofl_dehdr
->e_ident
[EI_OSABI
],
112 ofl
->ofl_dehdr
->e_machine
, ndx
, sgp
, TRUE
);
116 * Print out the available segment descriptors.
119 Dbg_seg_list(Lm_list
*lml
, uchar_t osabi
, Half mach
, APlist
*apl
)
125 if (DBG_NOTCLASS(DBG_C_SEGMENTS
))
128 Dbg_util_nl(lml
, DBG_NL_STD
);
129 dbg_print(lml
, MSG_INTL(MSG_SEG_DESC_AVAIL
));
130 for (APLIST_TRAVERSE(apl
, idx
, sgp
))
131 Dbg_seg_desc_entry(lml
, osabi
, mach
, ndx
++, sgp
, TRUE
);
135 * Print the output section information. This includes the section header
136 * information and the output elf buffer information. If the detail flag is
137 * set, traverse the input sections displaying all the input buffers that
138 * have been concatenated to form this output buffer.
141 Dbg_seg_os(Ofl_desc
*ofl
, Os_desc
*osp
, int ndx
)
143 Conv_inv_buf_t inv_buf
;
144 Lm_list
*lml
= ofl
->ofl_lml
;
149 const char *empty
= MSG_ORIG(MSG_STR_EMPTY
);
152 if (DBG_NOTCLASS(DBG_C_SEGMENTS
))
155 dbg_print(lml
, MSG_ORIG(MSG_SEC_NAME
), ndx
, osp
->os_name
);
156 Elf_shdr(lml
, ofl
->ofl_dehdr
->e_ident
[EI_OSABI
],
157 ofl
->ofl_dehdr
->e_machine
, osp
->os_shdr
);
158 dbg_print(lml
, MSG_INTL(MSG_EDATA_TITLE
));
161 data
= osp
->os_outdata
;
162 dbg_print(lml
, MSG_INTL(MSG_EDATA_ENTRY
), MSG_INTL(MSG_STR_OUT
),
163 EC_ADDR(shdr
->sh_addr
), conv_elfdata_type(data
->d_type
, &inv_buf
),
164 EC_XWORD(data
->d_size
), EC_OFF(data
->d_off
),
165 EC_XWORD(data
->d_align
), empty
, empty
, empty
);
170 OS_ISDESCS_TRAVERSE(os_isdescs_idx
, osp
, idx
, isp
) {
171 dbg_isec_name_buf_t buf
;
173 const char *file
, *str
;
176 data
= isp
->is_indata
;
178 if (isp
->is_flags
& FLG_IS_DISCARD
) {
179 str
= MSG_INTL(MSG_EDATA_IGNSCN
);
183 addr
= (Addr
)(shdr
->sh_addr
+ data
->d_off
);
186 if (isp
->is_file
&& isp
->is_file
->ifl_name
)
187 file
= isp
->is_file
->ifl_name
;
191 dbg_print(lml
, MSG_INTL(MSG_EDATA_ENTRY
), MSG_INTL(MSG_STR_IN
),
192 EC_ADDR(addr
), conv_elfdata_type(data
->d_type
, &inv_buf
),
193 EC_XWORD(data
->d_size
), EC_OFF(data
->d_off
),
194 EC_XWORD(data
->d_align
), file
,
195 dbg_fmt_isec_name(isp
, buf
, &alloc_mem
), str
);
196 if (alloc_mem
!= NULL
)