xref: /titanic_44/usr/src/cmd/sgs/liblddbg/common/cap.c (revision 9df12a23948bd40cbe37ce88d84e272c3894e675)
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	<debug.h>
29 #include	<libld.h>
30 #include	<conv.h>
31 #include	"msg.h"
32 #include	"_debug.h"
33 
34 void
35 Dbg_cap_hw_candidate(Lm_list *lml, const char *name)
36 {
37 	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES))
38 		return;
39 
40 	dbg_print(lml, MSG_INTL(MSG_CAP_HW_CANDIDATE), name);
41 }
42 
43 void
44 Dbg_cap_hw_filter(Lm_list *lml, const char *dir, Rt_map *flmp)
45 {
46 	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES))
47 		return;
48 
49 	Dbg_util_nl(lml, DBG_NL_STD);
50 	if (flmp)
51 		dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_1), dir, NAME(flmp));
52 	else
53 		dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_2), dir);
54 }
55 
56 void
57 Dbg_cap_val_hw1(Lm_list *lml, Xword val, Half mach)
58 {
59 	Dbg_util_nl(lml, DBG_NL_FRC);
60 	dbg_print(lml, MSG_INTL(MSG_CAP_VAL_HW1), conv_cap_val_hw1(val, mach));
61 	Dbg_util_nl(lml, DBG_NL_FRC);
62 }
63 
64 static const Msg captype[] = {
65 	MSG_STR_INITIAL,		/* MSG_INTL(MSG_STR_INITIAL) */
66 	MSG_STR_IGNORE,			/* MSG_INTL(MSG_STR_IGNORE) */
67 	MSG_STR_OLD,			/* MSG_INTL(MSG_STR_OLD) */
68 	MSG_STR_NEW,			/* MSG_INTL(MSG_STR_NEW) */
69 	MSG_STR_RESOLVED		/* MSG_INTL(MSG_STR_RESOLVED) */
70 };
71 
72 void
73 Dbg_cap_mapfile(Lm_list *lml, Xword tag, Xword val, Half mach)
74 {
75 	if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_CAP))
76 		return;
77 
78 	dbg_print(lml, MSG_INTL(MSG_MAP_CAP));
79 	Dbg_cap_sec_entry(lml, DBG_CAP_INITIAL, tag, val, mach);
80 }
81 
82 void
83 Dbg_cap_sec_entry(Lm_list *lml, uint_t type, Xword tag, Xword val, Half mach)
84 {
85 	if (DBG_NOTCLASS(DBG_C_CAP))
86 		return;
87 
88 	dbg_print(lml, MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]),
89 	    conv_cap_tag(tag), conv_cap_val(tag, val, mach));
90 }
91 
92 void
93 Dbg_cap_sec_title(Ofl_desc *ofl)
94 {
95 	Lm_list	*lml = ofl->ofl_lml;
96 
97 	if (DBG_NOTCLASS(DBG_C_CAP))
98 		return;
99 
100 	Dbg_util_nl(lml, DBG_NL_STD);
101 	dbg_print(lml, MSG_INTL(MSG_CAP_SEC_TITLE), ofl->ofl_name);
102 }
103 
104 void
105 Elf_cap_title(Lm_list *lml)
106 {
107 	dbg_print(lml, MSG_INTL(MSG_CAP_ELF_TITLE));
108 }
109 
110 void
111 Elf_cap_entry(Lm_list *lml, Cap *cap, int ndx, Half mach)
112 {
113 	char	index[INDEX_STR_SIZE];
114 
115 	(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx);
116 	dbg_print(lml, MSG_INTL(MSG_CAP_ELF_ENTRY), index,
117 	    conv_cap_tag(cap->c_tag),
118 	    conv_cap_val(cap->c_tag, cap->c_un.c_val, mach));
119 }
120