Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ctf_api.h
+++ new/usr/src/uts/common/sys/ctf_api.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26 /*
27 - * Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
28 28 */
29 29
30 30 /*
31 31 * This header file defines the interfaces available from the CTF debugger
32 32 * library, libctf, and an equivalent kernel module. This API can be used by
33 33 * a debugger to operate on data in the Compact ANSI-C Type Format (CTF).
34 34 * This is NOT a public interface, although it may eventually become one in
35 35 * the fullness of time after we gain more experience with the interfaces.
36 36 *
37 37 * In the meantime, be aware that any program linked with this API in this
38 38 * release of Solaris is almost guaranteed to break in the next release.
39 39 *
40 40 * In short, do not user this header file or the CTF routines for any purpose.
41 41 */
42 42
43 43 #ifndef _CTF_API_H
44 44 #define _CTF_API_H
45 45
46 46 #include <sys/types.h>
47 47 #include <sys/param.h>
48 48 #include <sys/elf.h>
49 49 #include <sys/ctf.h>
50 50
51 51 #ifdef __cplusplus
52 52 extern "C" {
53 53 #endif
54 54
55 55 /*
56 56 * Clients can open one or more CTF containers and obtain a pointer to an
57 57 * opaque ctf_file_t. Types are identified by an opaque ctf_id_t token.
58 58 * These opaque definitions allow libctf to evolve without breaking clients.
59 59 */
60 60 typedef struct ctf_file ctf_file_t;
61 61 typedef long ctf_id_t;
62 62
63 63 /*
64 64 * If the debugger needs to provide the CTF library with a set of raw buffers
65 65 * for use as the CTF data, symbol table, and string table, it can do so by
66 66 * filling in ctf_sect_t structures and passing them to ctf_bufopen():
67 67 */
68 68 typedef struct ctf_sect {
69 69 const char *cts_name; /* section name (if any) */
70 70 ulong_t cts_type; /* section type (ELF SHT_... value) */
71 71 ulong_t cts_flags; /* section flags (ELF SHF_... value) */
72 72 const void *cts_data; /* pointer to section data */
73 73 size_t cts_size; /* size of data in bytes */
74 74 size_t cts_entsize; /* size of each section entry (symtab only) */
75 75 off64_t cts_offset; /* file offset of this section (if any) */
76 76 } ctf_sect_t;
77 77
78 78 /*
79 79 * Encoding information for integers, floating-point values, and certain other
80 80 * intrinsics can be obtained by calling ctf_type_encoding(), below. The flags
81 81 * field will contain values appropriate for the type defined in <sys/ctf.h>.
82 82 */
83 83 typedef struct ctf_encoding {
84 84 uint_t cte_format; /* data format (CTF_INT_* or CTF_FP_* flags) */
85 85 uint_t cte_offset; /* offset of value in bits */
86 86 uint_t cte_bits; /* size of storage in bits */
87 87 } ctf_encoding_t;
88 88
89 89 typedef struct ctf_membinfo {
90 90 ctf_id_t ctm_type; /* type of struct or union member */
91 91 ulong_t ctm_offset; /* offset of member in bits */
92 92 } ctf_membinfo_t;
93 93
94 94 typedef struct ctf_arinfo {
95 95 ctf_id_t ctr_contents; /* type of array contents */
96 96 ctf_id_t ctr_index; /* type of array index */
97 97 uint_t ctr_nelems; /* number of elements */
98 98 } ctf_arinfo_t;
99 99
100 100 typedef struct ctf_funcinfo {
101 101 ctf_id_t ctc_return; /* function return type */
102 102 uint_t ctc_argc; /* number of typed arguments to function */
103 103 uint_t ctc_flags; /* function attributes (see below) */
104 104 } ctf_funcinfo_t;
105 105
106 106 typedef struct ctf_lblinfo {
107 107 ctf_id_t ctb_typeidx; /* last type associated with the label */
108 108 } ctf_lblinfo_t;
109 109
110 110 #define CTF_FUNC_VARARG 0x1 /* function arguments end with varargs */
111 111
112 112 /*
113 113 * Functions that return integer status or a ctf_id_t use the following value
114 114 * to indicate failure. ctf_errno() can be used to obtain an error code.
115 115 */
116 116 #define CTF_ERR (-1L)
117 117
118 118 /*
119 119 * The CTF data model is inferred to be the caller's data model or the data
120 120 * model of the given object, unless ctf_setmodel() is explicitly called.
121 121 */
122 122 #define CTF_MODEL_ILP32 1 /* object data model is ILP32 */
123 123 #define CTF_MODEL_LP64 2 /* object data model is LP64 */
124 124 #ifdef _LP64
125 125 #define CTF_MODEL_NATIVE CTF_MODEL_LP64
126 126 #else
127 127 #define CTF_MODEL_NATIVE CTF_MODEL_ILP32
128 128 #endif
129 129
130 130 /*
131 131 * Dynamic CTF containers can be created using ctf_create(). The ctf_add_*
132 132 * routines can be used to add new definitions to the dynamic container.
133 133 * New types are labeled as root or non-root to determine whether they are
134 134 * visible at the top-level program scope when subsequently doing a lookup.
135 135 */
136 136 #define CTF_ADD_NONROOT 0 /* type only visible in nested scope */
137 137 #define CTF_ADD_ROOT 1 /* type visible at top-level scope */
138 138
139 139 /*
140 140 * These typedefs are used to define the signature for callback functions
141 141 * that can be used with the iteration and visit functions below:
142 142 */
143 143 typedef int ctf_visit_f(const char *, ctf_id_t, ulong_t, int, void *);
↓ open down ↓ |
106 lines elided |
↑ open up ↑ |
144 144 typedef int ctf_member_f(const char *, ctf_id_t, ulong_t, void *);
145 145 typedef int ctf_enum_f(const char *, int, void *);
146 146 typedef int ctf_type_f(ctf_id_t, void *);
147 147 typedef int ctf_label_f(const char *, const ctf_lblinfo_t *, void *);
148 148
149 149 extern ctf_file_t *ctf_bufopen(const ctf_sect_t *, const ctf_sect_t *,
150 150 const ctf_sect_t *, int *);
151 151 extern ctf_file_t *ctf_fdopen(int, int *);
152 152 extern ctf_file_t *ctf_open(const char *, int *);
153 153 extern ctf_file_t *ctf_create(int *);
154 +extern ctf_file_t *ctf_dup(ctf_file_t *);
154 155 extern void ctf_close(ctf_file_t *);
155 156
156 157 extern ctf_file_t *ctf_parent_file(ctf_file_t *);
157 158 extern const char *ctf_parent_name(ctf_file_t *);
158 159
159 160 extern int ctf_import(ctf_file_t *, ctf_file_t *);
160 161 extern int ctf_setmodel(ctf_file_t *, int);
161 162 extern int ctf_getmodel(ctf_file_t *);
162 163
163 164 extern void ctf_setspecific(ctf_file_t *, void *);
164 165 extern void *ctf_getspecific(ctf_file_t *);
165 166
166 167 extern int ctf_errno(ctf_file_t *);
167 168 extern const char *ctf_errmsg(int);
168 169 extern int ctf_version(int);
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
169 170
170 171 extern int ctf_func_info(ctf_file_t *, ulong_t, ctf_funcinfo_t *);
171 172 extern int ctf_func_args(ctf_file_t *, ulong_t, uint_t, ctf_id_t *);
172 173
173 174 extern ctf_id_t ctf_lookup_by_name(ctf_file_t *, const char *);
174 175 extern ctf_id_t ctf_lookup_by_symbol(ctf_file_t *, ulong_t);
175 176
176 177 extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
177 178 extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
178 179 extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
180 +extern char *ctf_type_qname(ctf_file_t *, ctf_id_t, char *, size_t,
181 + const char *);
179 182 extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
180 183 extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
181 184 extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
182 185 extern ctf_id_t ctf_type_reference(ctf_file_t *, ctf_id_t);
183 186 extern ctf_id_t ctf_type_pointer(ctf_file_t *, ctf_id_t);
184 187 extern int ctf_type_encoding(ctf_file_t *, ctf_id_t, ctf_encoding_t *);
185 188 extern int ctf_type_visit(ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
186 189 extern int ctf_type_cmp(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
187 190 extern int ctf_type_compat(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
188 191
189 192 extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
190 193 ctf_membinfo_t *);
191 194 extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
192 195
193 196 extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
194 197 extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
195 198
196 199 extern const char *ctf_label_topmost(ctf_file_t *);
197 200 extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
198 201
199 202 extern int ctf_member_iter(ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
200 203 extern int ctf_enum_iter(ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
201 204 extern int ctf_type_iter(ctf_file_t *, ctf_type_f *, void *);
202 205 extern int ctf_label_iter(ctf_file_t *, ctf_label_f *, void *);
203 206
204 207 extern ctf_id_t ctf_add_array(ctf_file_t *, uint_t, const ctf_arinfo_t *);
205 208 extern ctf_id_t ctf_add_const(ctf_file_t *, uint_t, ctf_id_t);
206 209 extern ctf_id_t ctf_add_enum(ctf_file_t *, uint_t, const char *);
207 210 extern ctf_id_t ctf_add_float(ctf_file_t *, uint_t,
208 211 const char *, const ctf_encoding_t *);
209 212 extern ctf_id_t ctf_add_forward(ctf_file_t *, uint_t, const char *, uint_t);
210 213 extern ctf_id_t ctf_add_function(ctf_file_t *, uint_t,
211 214 const ctf_funcinfo_t *, const ctf_id_t *);
212 215 extern ctf_id_t ctf_add_integer(ctf_file_t *, uint_t,
213 216 const char *, const ctf_encoding_t *);
214 217 extern ctf_id_t ctf_add_pointer(ctf_file_t *, uint_t, ctf_id_t);
215 218 extern ctf_id_t ctf_add_type(ctf_file_t *, ctf_file_t *, ctf_id_t);
216 219 extern ctf_id_t ctf_add_typedef(ctf_file_t *, uint_t, const char *, ctf_id_t);
217 220 extern ctf_id_t ctf_add_restrict(ctf_file_t *, uint_t, ctf_id_t);
218 221 extern ctf_id_t ctf_add_struct(ctf_file_t *, uint_t, const char *);
219 222 extern ctf_id_t ctf_add_union(ctf_file_t *, uint_t, const char *);
220 223 extern ctf_id_t ctf_add_volatile(ctf_file_t *, uint_t, ctf_id_t);
221 224
222 225 extern int ctf_add_enumerator(ctf_file_t *, ctf_id_t, const char *, int);
223 226 extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
224 227
225 228 extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
226 229
227 230 extern int ctf_delete_type(ctf_file_t *, ctf_id_t);
228 231
229 232 extern int ctf_update(ctf_file_t *);
230 233 extern int ctf_discard(ctf_file_t *);
231 234 extern int ctf_write(ctf_file_t *, int);
232 235
233 236 #ifdef _KERNEL
234 237
235 238 struct module;
236 239 extern ctf_file_t *ctf_modopen(struct module *, int *);
237 240
238 241 #endif
239 242
240 243 #ifdef __cplusplus
241 244 }
242 245 #endif
243 246
244 247 #endif /* _CTF_API_H */
↓ open down ↓ |
56 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX