xref: /titanic_41/usr/src/cmd/sgs/liblddbg/common/_debug.h (revision 257873cfc1dd3337766407f80397db60a56f2f5a)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DEBUG_DOT_H
28 #define	_DEBUG_DOT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <debug.h>
33 #include <conv.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Debugging is enabled by various tokens (see debug.c) that result in an
41  * internal bit mask (d_class) being initialized.  Each debugging function is
42  * appropriate for one or more of the classes specified by the bit mask.  Each
43  * debugging function validates whether it is appropriate for the present
44  * classes before printing anything.
45  */
46 #define	DBG_NOTCLASS(c)	!(dbg_desc->d_class & (c))
47 
48 #define	DBG_C_ARGS	0x00000001
49 #define	DBG_C_BASIC	0x00000002
50 #define	DBG_C_BINDINGS	0x00000004
51 #define	DBG_C_ENTRY	0x00000008
52 #define	DBG_C_FILES	0x00000010
53 #define	DBG_C_HELP	0x00000020
54 #define	DBG_C_LIBS	0x00000040
55 #define	DBG_C_MAP	0x00000080
56 #define	DBG_C_RELOC	0x00000100
57 #define	DBG_C_SECTIONS	0x00000200
58 #define	DBG_C_SEGMENTS	0x00000400
59 #define	DBG_C_SYMBOLS	0x00000800
60 #define	DBG_C_SUPPORT	0x00001000
61 #define	DBG_C_VERSIONS	0x00002000
62 #define	DBG_C_AUDITING	0x00004000
63 #define	DBG_C_GOT	0x00008000
64 #define	DBG_C_MOVE	0x00010000
65 #define	DBG_C_DEMANGLE	0x00020000
66 #define	DBG_C_TLS	0x00040000
67 #define	DBG_C_STRTAB	0x00080000
68 #define	DBG_C_STATS	0x00100000
69 #define	DBG_C_UNUSED	0x00200000
70 #define	DBG_C_CAP	0x00400000
71 #define	DBG_C_INIT	0x00800000
72 
73 #define	DBG_C_ALL	0xffffffff
74 
75 typedef struct {
76 	const char	*o_name;	/* command line argument name */
77 	uint_t		o_class;	/* associated class for this name */
78 	uint_t		o_extra;	/* associated extra for this name */
79 } DBG_options;
80 
81 #define	AL_CNT_DEBUG	4
82 
83 /*
84  * Some Dbg_*() format strings differ depending on whether they are used for
85  * 32-bit or 64-bit values.
86  */
87 #if	defined(_ELF64)
88 
89 #define	MSG_EDATA_TITLE		MSG_EDATA_TITLE_64
90 #define	MSG_EDATA_ENTRY		MSG_EDATA_ENTRY_64
91 
92 #else
93 
94 #define	MSG_EDATA_TITLE		MSG_EDATA_TITLE_32
95 #define	MSG_EDATA_ENTRY		MSG_EDATA_ENTRY_32
96 
97 #endif
98 
99 /*
100  * Some Elf_*() format strings differ depending on whether they are used for
101  * 32-bit or 64-bit values.
102  */
103 #if	defined(_ELF64)
104 
105 #define	MSG_GOT_TITLE		MSG_GOT_TITLE_64
106 #define	MSG_GOT_ENTRY_RE	MSG_GOT_ENTRY_RE_64
107 #define	MSG_GOT_ENTRY_NR	MSG_GOT_ENTRY_NR_64
108 #define	MSG_GOT_COLUMNS1	MSG_GOT_COLUMNS1_64
109 #define	MSG_GOT_COLUMNS2	MSG_GOT_COLUMNS2_64
110 #define	MSG_GOT_FORMAT1		MSG_GOT_FORMAT1_64
111 #define	MSG_GOT_FORMAT2		MSG_GOT_FORMAT2_64
112 
113 #define	MSG_PHD_VADDR		MSG_PHD_VADDR_64
114 #define	MSG_PHD_PADDR		MSG_PHD_PADDR_64
115 #define	MSG_PHD_FILESZ		MSG_PHD_FILESZ_64
116 #define	MSG_PHD_OFFSET		MSG_PHD_OFFSET_64
117 
118 #define	MSG_REL_EFSA_TITLE	MSG_REL_EFSA_TITLE_64
119 #define	MSG_REL_EFLA_TITLE	MSG_REL_EFLA_TITLE_64
120 #define	MSG_REL_EFSN_TITLE	MSG_REL_EFSN_TITLE_64
121 #define	MSG_REL_EFLN_TITLE	MSG_REL_EFLN_TITLE_64
122 #define	MSG_REL_EFSA_ENTRY	MSG_REL_EFSA_ENTRY_64
123 #define	MSG_REL_EFLA_ENTRY	MSG_REL_EFLA_ENTRY_64
124 #define	MSG_REL_EFSN_ENTRY	MSG_REL_EFSN_ENTRY_64
125 #define	MSG_REL_EFLN_ENTRY	MSG_REL_EFLN_ENTRY_64
126 #define	MSG_REL_RT_APLREG	MSG_REL_RT_APLREG_64
127 #define	MSG_REL_RT_APLVAL	MSG_REL_RT_APLVAL_64
128 #define	MSG_REL_RTA_TITLE	MSG_REL_RTA_TITLE_64
129 #define	MSG_REL_RTN_TITLE	MSG_REL_RTN_TITLE_64
130 #define	MSG_REL_RTV_TITLE	MSG_REL_RTV_TITLE_64
131 #define	MSG_REL_RTA_ENTRY	MSG_REL_RTA_ENTRY_64
132 #define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_64
133 #define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_64
134 #define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_64
135 #define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_64
136 #define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_64
137 #define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_64
138 #define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_64
139 #define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_64
140 #define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_64
141 #define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_64
142 #define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_64
143 
144 #define	MSG_SHD_ADDR		MSG_SHD_ADDR_64
145 #define	MSG_SHD_SIZE		MSG_SHD_SIZE_64
146 #define	MSG_SHD_OFFSET		MSG_SHD_OFFSET_64
147 #define	MSG_SHD_OFFSET_ENT	MSG_SHD_OFFSET_ENT_64
148 #define	MSG_SHD_ALIGN		MSG_SHD_ALIGN_64
149 #define	MSG_SHD_LINK		MSG_SHD_LINK_64
150 
151 #define	MSG_SYM_EFS_ENTRY	MSG_SYM_EFS_ENTRY_64
152 #define	MSG_SYM_EFL_ENTRY	MSG_SYM_EFL_ENTRY_64
153 #define	MSG_SYM_EFS_TITLE	MSG_SYM_EFS_TITLE_64
154 #define	MSG_SYM_EFL_TITLE	MSG_SYM_EFL_TITLE_64
155 #define	MSG_SYM_LDS_TITLE	MSG_SYM_LDS_TITLE_64
156 #define	MSG_SYM_LDL_TITLE	MSG_SYM_LDL_TITLE_64
157 
158 #else
159 
160 #define	MSG_GOT_TITLE		MSG_GOT_TITLE_32
161 #define	MSG_GOT_ENTRY_RE	MSG_GOT_ENTRY_RE_32
162 #define	MSG_GOT_ENTRY_NR	MSG_GOT_ENTRY_NR_32
163 #define	MSG_GOT_COLUMNS1	MSG_GOT_COLUMNS1_32
164 #define	MSG_GOT_COLUMNS2	MSG_GOT_COLUMNS2_32
165 #define	MSG_GOT_FORMAT1		MSG_GOT_FORMAT1_32
166 #define	MSG_GOT_FORMAT2		MSG_GOT_FORMAT2_32
167 
168 #define	MSG_PHD_VADDR		MSG_PHD_VADDR_32
169 #define	MSG_PHD_PADDR		MSG_PHD_PADDR_32
170 #define	MSG_PHD_FILESZ		MSG_PHD_FILESZ_32
171 #define	MSG_PHD_OFFSET		MSG_PHD_OFFSET_32
172 
173 #define	MSG_REL_EFSA_TITLE	MSG_REL_EFSA_TITLE_32
174 #define	MSG_REL_EFLA_TITLE	MSG_REL_EFLA_TITLE_32
175 #define	MSG_REL_EFSN_TITLE	MSG_REL_EFSN_TITLE_32
176 #define	MSG_REL_EFLN_TITLE	MSG_REL_EFLN_TITLE_32
177 #define	MSG_REL_EFSA_ENTRY	MSG_REL_EFSA_ENTRY_32
178 #define	MSG_REL_EFLA_ENTRY	MSG_REL_EFLA_ENTRY_32
179 #define	MSG_REL_EFSN_ENTRY	MSG_REL_EFSN_ENTRY_32
180 #define	MSG_REL_EFLN_ENTRY	MSG_REL_EFLN_ENTRY_32
181 #define	MSG_REL_RT_APLREG	MSG_REL_RT_APLREG_32
182 #define	MSG_REL_RT_APLVAL	MSG_REL_RT_APLVAL_32
183 #define	MSG_REL_RTA_TITLE	MSG_REL_RTA_TITLE_32
184 #define	MSG_REL_RTN_TITLE	MSG_REL_RTN_TITLE_32
185 #define	MSG_REL_RTV_TITLE	MSG_REL_RTV_TITLE_32
186 #define	MSG_REL_RTA_ENTRY	MSG_REL_RTA_ENTRY_32
187 #define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_32
188 #define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_32
189 #define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_32
190 #define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_32
191 #define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_32
192 #define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_32
193 #define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_32
194 #define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_32
195 #define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_32
196 #define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_32
197 #define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_32
198 
199 #define	MSG_SHD_ADDR		MSG_SHD_ADDR_32
200 #define	MSG_SHD_SIZE		MSG_SHD_SIZE_32
201 #define	MSG_SHD_OFFSET		MSG_SHD_OFFSET_32
202 #define	MSG_SHD_OFFSET_ENT	MSG_SHD_OFFSET_ENT_32
203 #define	MSG_SHD_ALIGN		MSG_SHD_ALIGN_32
204 #define	MSG_SHD_LINK		MSG_SHD_LINK_32
205 
206 #define	MSG_SYM_EFS_ENTRY	MSG_SYM_EFS_ENTRY_32
207 #define	MSG_SYM_EFL_ENTRY	MSG_SYM_EFL_ENTRY_32
208 #define	MSG_SYM_EFS_TITLE	MSG_SYM_EFS_TITLE_32
209 #define	MSG_SYM_EFL_TITLE	MSG_SYM_EFL_TITLE_32
210 #define	MSG_SYM_LDS_TITLE	MSG_SYM_LDS_TITLE_32
211 #define	MSG_SYM_LDL_TITLE	MSG_SYM_LDL_TITLE_32
212 
213 #endif
214 
215 #define	INDEX_STR_SIZE		10
216 
217 #ifdef	__cplusplus
218 }
219 #endif
220 
221 #endif	/* _DEBUG_DOT_H */
222