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/lib/libdtrace/common/dt_dis.c
+++ new/usr/src/lib/libdtrace/common/dt_dis.c
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
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22
23 23 /*
24 24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 25 * Use is subject to license terms.
26 26 */
27 27
28 28 /*
29 - * Copyright (c) 2012 by Delphix. All rights reserved.
29 + * Copyright (c) 2013 by Delphix. All rights reserved.
30 + * Copyright (c) 2013 Joyent, Inc. All rights reserved.
30 31 */
31 32
32 33 #include <strings.h>
33 34 #include <stdio.h>
34 35
35 36 #include <dt_impl.h>
36 37 #include <dt_ident.h>
37 38
38 39 /*ARGSUSED*/
39 40 static void
40 41 dt_dis_log(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
41 42 {
42 43 (void) fprintf(fp, "%-4s %%r%u, %%r%u, %%r%u", name,
43 44 DIF_INSTR_R1(in), DIF_INSTR_R2(in), DIF_INSTR_RD(in));
44 45 }
45 46
46 47 /*ARGSUSED*/
47 48 static void
48 49 dt_dis_branch(const dtrace_difo_t *dp, const char *name,
49 50 dif_instr_t in, FILE *fp)
50 51 {
51 52 (void) fprintf(fp, "%-4s %u", name, DIF_INSTR_LABEL(in));
52 53 }
53 54
54 55 /*ARGSUSED*/
55 56 static void
56 57 dt_dis_load(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
57 58 {
58 59 (void) fprintf(fp, "%-4s [%%r%u], %%r%u", name,
59 60 DIF_INSTR_R1(in), DIF_INSTR_RD(in));
60 61 }
61 62
62 63 /*ARGSUSED*/
63 64 static void
64 65 dt_dis_store(const dtrace_difo_t *dp, const char *name,
65 66 dif_instr_t in, FILE *fp)
66 67 {
67 68 (void) fprintf(fp, "%-4s %%r%u, [%%r%u]", name,
68 69 DIF_INSTR_R1(in), DIF_INSTR_RD(in));
69 70 }
70 71
71 72 /*ARGSUSED*/
72 73 static void
73 74 dt_dis_str(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
74 75 {
75 76 (void) fprintf(fp, "%s", name);
76 77 }
77 78
78 79 /*ARGSUSED*/
79 80 static void
80 81 dt_dis_r1rd(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
81 82 {
82 83 (void) fprintf(fp, "%-4s %%r%u, %%r%u", name,
83 84 DIF_INSTR_R1(in), DIF_INSTR_RD(in));
84 85 }
85 86
86 87 /*ARGSUSED*/
87 88 static void
88 89 dt_dis_cmp(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
89 90 {
90 91 (void) fprintf(fp, "%-4s %%r%u, %%r%u", name,
91 92 DIF_INSTR_R1(in), DIF_INSTR_R2(in));
92 93 }
93 94
94 95 /*ARGSUSED*/
95 96 static void
96 97 dt_dis_tst(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
97 98 {
98 99 (void) fprintf(fp, "%-4s %%r%u", name, DIF_INSTR_R1(in));
99 100 }
100 101
101 102 static const char *
102 103 dt_dis_varname(const dtrace_difo_t *dp, uint_t id, uint_t scope)
103 104 {
104 105 const dtrace_difv_t *dvp = dp->dtdo_vartab;
105 106 uint_t i;
106 107
107 108 for (i = 0; i < dp->dtdo_varlen; i++, dvp++) {
108 109 if (dvp->dtdv_id == id && dvp->dtdv_scope == scope) {
109 110 if (dvp->dtdv_name < dp->dtdo_strlen)
110 111 return (dp->dtdo_strtab + dvp->dtdv_name);
111 112 break;
112 113 }
113 114 }
114 115
115 116 return (NULL);
116 117 }
117 118
118 119 static uint_t
119 120 dt_dis_scope(const char *name)
120 121 {
121 122 switch (name[2]) {
122 123 case 'l': return (DIFV_SCOPE_LOCAL);
123 124 case 't': return (DIFV_SCOPE_THREAD);
124 125 case 'g': return (DIFV_SCOPE_GLOBAL);
125 126 default: return (-1u);
126 127 }
127 128 }
128 129
129 130 static void
130 131 dt_dis_lda(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
131 132 {
132 133 uint_t var = DIF_INSTR_R1(in);
133 134 const char *vname;
134 135
135 136 (void) fprintf(fp, "%-4s DT_VAR(%u), %%r%u, %%r%u", name,
136 137 var, DIF_INSTR_R2(in), DIF_INSTR_RD(in));
137 138
138 139 if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
139 140 (void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
140 141 }
141 142
142 143 static void
143 144 dt_dis_ldv(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
144 145 {
145 146 uint_t var = DIF_INSTR_VAR(in);
146 147 const char *vname;
147 148
148 149 (void) fprintf(fp, "%-4s DT_VAR(%u), %%r%u",
149 150 name, var, DIF_INSTR_RD(in));
150 151
151 152 if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
152 153 (void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
153 154 }
154 155
155 156 static void
156 157 dt_dis_stv(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
157 158 {
158 159 uint_t var = DIF_INSTR_VAR(in);
159 160 const char *vname;
160 161
161 162 (void) fprintf(fp, "%-4s %%r%u, DT_VAR(%u)",
162 163 name, DIF_INSTR_RS(in), var);
163 164
164 165 if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
165 166 (void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
166 167 }
167 168
168 169 static void
169 170 dt_dis_setx(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
170 171 {
171 172 uint_t intptr = DIF_INSTR_INTEGER(in);
172 173
173 174 (void) fprintf(fp, "%-4s DT_INTEGER[%u], %%r%u", name,
174 175 intptr, DIF_INSTR_RD(in));
175 176
176 177 if (intptr < dp->dtdo_intlen) {
177 178 (void) fprintf(fp, "\t\t! 0x%llx",
178 179 (u_longlong_t)dp->dtdo_inttab[intptr]);
179 180 }
180 181 }
181 182
182 183 static void
183 184 dt_dis_sets(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
184 185 {
185 186 uint_t strptr = DIF_INSTR_STRING(in);
186 187
187 188 (void) fprintf(fp, "%-4s DT_STRING[%u], %%r%u", name,
188 189 strptr, DIF_INSTR_RD(in));
189 190
190 191 if (strptr < dp->dtdo_strlen)
191 192 (void) fprintf(fp, "\t\t! \"%s\"", dp->dtdo_strtab + strptr);
192 193 }
193 194
194 195 /*ARGSUSED*/
195 196 static void
196 197 dt_dis_ret(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
197 198 {
198 199 (void) fprintf(fp, "%-4s %%r%u", name, DIF_INSTR_RD(in));
199 200 }
200 201
201 202 /*ARGSUSED*/
202 203 static void
203 204 dt_dis_call(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
204 205 {
205 206 uint_t subr = DIF_INSTR_SUBR(in);
206 207
207 208 (void) fprintf(fp, "%-4s DIF_SUBR(%u), %%r%u\t\t! %s",
208 209 name, subr, DIF_INSTR_RD(in), dtrace_subrstr(NULL, subr));
209 210 }
210 211
211 212 /*ARGSUSED*/
212 213 static void
213 214 dt_dis_pushts(const dtrace_difo_t *dp,
214 215 const char *name, dif_instr_t in, FILE *fp)
215 216 {
216 217 static const char *const tnames[] = { "D type", "string" };
217 218 uint_t type = DIF_INSTR_TYPE(in);
218 219 const char *pad;
219 220
220 221 if (DIF_INSTR_OP(in) == DIF_OP_PUSHTV) {
221 222 (void) fprintf(fp, "%-4s DT_TYPE(%u), %%r%u",
222 223 name, type, DIF_INSTR_RS(in));
223 224 pad = "\t\t";
224 225 } else {
225 226 (void) fprintf(fp, "%-4s DT_TYPE(%u), %%r%u, %%r%u",
226 227 name, type, DIF_INSTR_R2(in), DIF_INSTR_RS(in));
227 228 pad = "\t";
228 229 }
229 230
230 231 if (type < sizeof (tnames) / sizeof (tnames[0])) {
231 232 (void) fprintf(fp, "%s! DT_TYPE(%u) = %s", pad,
232 233 type, tnames[type]);
233 234 }
234 235 }
235 236
236 237 static void
237 238 dt_dis_xlate(const dtrace_difo_t *dp,
238 239 const char *name, dif_instr_t in, FILE *fp)
239 240 {
240 241 uint_t xlr = DIF_INSTR_XLREF(in);
241 242
242 243 (void) fprintf(fp, "%-4s DT_XLREF[%u], %%r%u",
243 244 name, xlr, DIF_INSTR_RD(in));
244 245
245 246 if (xlr < dp->dtdo_xlmlen) {
246 247 (void) fprintf(fp, "\t\t! DT_XLREF[%u] = %u.%s", xlr,
247 248 (uint_t)dp->dtdo_xlmtab[xlr]->dn_membexpr->dn_xlator->dx_id,
248 249 dp->dtdo_xlmtab[xlr]->dn_membname);
249 250 }
250 251 }
251 252
252 253 static char *
253 254 dt_dis_typestr(const dtrace_diftype_t *t, char *buf, size_t len)
254 255 {
255 256 char kind[16], ckind[16];
256 257
257 258 switch (t->dtdt_kind) {
258 259 case DIF_TYPE_CTF:
259 260 (void) strcpy(kind, "D type");
260 261 break;
261 262 case DIF_TYPE_STRING:
262 263 (void) strcpy(kind, "string");
263 264 break;
264 265 default:
265 266 (void) snprintf(kind, sizeof (kind), "0x%x", t->dtdt_kind);
266 267 }
267 268
268 269 switch (t->dtdt_ckind) {
269 270 case CTF_K_UNKNOWN:
270 271 (void) strcpy(ckind, "unknown");
271 272 break;
272 273 case CTF_K_INTEGER:
273 274 (void) strcpy(ckind, "integer");
274 275 break;
275 276 case CTF_K_FLOAT:
276 277 (void) strcpy(ckind, "float");
277 278 break;
278 279 case CTF_K_POINTER:
279 280 (void) strcpy(ckind, "pointer");
280 281 break;
281 282 case CTF_K_ARRAY:
282 283 (void) strcpy(ckind, "array");
283 284 break;
284 285 case CTF_K_FUNCTION:
285 286 (void) strcpy(ckind, "function");
286 287 break;
287 288 case CTF_K_STRUCT:
288 289 (void) strcpy(ckind, "struct");
289 290 break;
290 291 case CTF_K_UNION:
291 292 (void) strcpy(ckind, "union");
292 293 break;
293 294 case CTF_K_ENUM:
294 295 (void) strcpy(ckind, "enum");
295 296 break;
296 297 case CTF_K_FORWARD:
297 298 (void) strcpy(ckind, "forward");
298 299 break;
299 300 case CTF_K_TYPEDEF:
300 301 (void) strcpy(ckind, "typedef");
301 302 break;
302 303 case CTF_K_VOLATILE:
303 304 (void) strcpy(ckind, "volatile");
304 305 break;
↓ open down ↓ |
265 lines elided |
↑ open up ↑ |
305 306 case CTF_K_CONST:
306 307 (void) strcpy(ckind, "const");
307 308 break;
308 309 case CTF_K_RESTRICT:
309 310 (void) strcpy(ckind, "restrict");
310 311 break;
311 312 default:
312 313 (void) snprintf(ckind, sizeof (ckind), "0x%x", t->dtdt_ckind);
313 314 }
314 315
315 - if (t->dtdt_flags & DIF_TF_BYREF) {
316 - (void) snprintf(buf, len, "%s (%s) by ref (size %lu)",
317 - kind, ckind, (ulong_t)t->dtdt_size);
316 + if (t->dtdt_flags & (DIF_TF_BYREF | DIF_TF_BYUREF)) {
317 + (void) snprintf(buf, len, "%s (%s) by %sref (size %lu)",
318 + kind, ckind, (t->dtdt_flags & DIF_TF_BYUREF) ? "user " : "",
319 + (ulong_t)t->dtdt_size);
318 320 } else {
319 321 (void) snprintf(buf, len, "%s (%s) (size %lu)",
320 322 kind, ckind, (ulong_t)t->dtdt_size);
321 323 }
322 324
323 325 return (buf);
324 326 }
325 327
326 328 static void
327 329 dt_dis_rtab(const char *rtag, const dtrace_difo_t *dp, FILE *fp,
328 330 const dof_relodesc_t *rp, uint32_t len)
329 331 {
330 332 (void) fprintf(fp, "\n%-4s %-8s %-8s %s\n",
331 333 rtag, "OFFSET", "DATA", "NAME");
332 334
333 335 for (; len != 0; len--, rp++) {
334 336 (void) fprintf(fp, "%-4u %-8llu %-8llu %s\n",
335 337 rp->dofr_type, (u_longlong_t)rp->dofr_offset,
336 338 (u_longlong_t)rp->dofr_data,
337 339 &dp->dtdo_strtab[rp->dofr_name]);
338 340 }
339 341 }
340 342
341 343 void
342 344 dt_dis(const dtrace_difo_t *dp, FILE *fp)
343 345 {
344 346 static const struct opent {
345 347 const char *op_name;
346 348 void (*op_func)(const dtrace_difo_t *, const char *,
347 349 dif_instr_t, FILE *);
348 350 } optab[] = {
349 351 { "(illegal opcode)", dt_dis_str },
350 352 { "or", dt_dis_log }, /* DIF_OP_OR */
351 353 { "xor", dt_dis_log }, /* DIF_OP_XOR */
352 354 { "and", dt_dis_log }, /* DIF_OP_AND */
353 355 { "sll", dt_dis_log }, /* DIF_OP_SLL */
354 356 { "srl", dt_dis_log }, /* DIF_OP_SRL */
355 357 { "sub", dt_dis_log }, /* DIF_OP_SUB */
356 358 { "add", dt_dis_log }, /* DIF_OP_ADD */
357 359 { "mul", dt_dis_log }, /* DIF_OP_MUL */
358 360 { "sdiv", dt_dis_log }, /* DIF_OP_SDIV */
359 361 { "udiv", dt_dis_log }, /* DIF_OP_UDIV */
360 362 { "srem", dt_dis_log }, /* DIF_OP_SREM */
361 363 { "urem", dt_dis_log }, /* DIF_OP_UREM */
362 364 { "not", dt_dis_r1rd }, /* DIF_OP_NOT */
363 365 { "mov", dt_dis_r1rd }, /* DIF_OP_MOV */
364 366 { "cmp", dt_dis_cmp }, /* DIF_OP_CMP */
365 367 { "tst", dt_dis_tst }, /* DIF_OP_TST */
366 368 { "ba", dt_dis_branch }, /* DIF_OP_BA */
367 369 { "be", dt_dis_branch }, /* DIF_OP_BE */
368 370 { "bne", dt_dis_branch }, /* DIF_OP_BNE */
369 371 { "bg", dt_dis_branch }, /* DIF_OP_BG */
370 372 { "bgu", dt_dis_branch }, /* DIF_OP_BGU */
371 373 { "bge", dt_dis_branch }, /* DIF_OP_BGE */
372 374 { "bgeu", dt_dis_branch }, /* DIF_OP_BGEU */
373 375 { "bl", dt_dis_branch }, /* DIF_OP_BL */
374 376 { "blu", dt_dis_branch }, /* DIF_OP_BLU */
375 377 { "ble", dt_dis_branch }, /* DIF_OP_BLE */
376 378 { "bleu", dt_dis_branch }, /* DIF_OP_BLEU */
377 379 { "ldsb", dt_dis_load }, /* DIF_OP_LDSB */
378 380 { "ldsh", dt_dis_load }, /* DIF_OP_LDSH */
379 381 { "ldsw", dt_dis_load }, /* DIF_OP_LDSW */
380 382 { "ldub", dt_dis_load }, /* DIF_OP_LDUB */
381 383 { "lduh", dt_dis_load }, /* DIF_OP_LDUH */
382 384 { "lduw", dt_dis_load }, /* DIF_OP_LDUW */
383 385 { "ldx", dt_dis_load }, /* DIF_OP_LDX */
384 386 { "ret", dt_dis_ret }, /* DIF_OP_RET */
385 387 { "nop", dt_dis_str }, /* DIF_OP_NOP */
386 388 { "setx", dt_dis_setx }, /* DIF_OP_SETX */
387 389 { "sets", dt_dis_sets }, /* DIF_OP_SETS */
388 390 { "scmp", dt_dis_cmp }, /* DIF_OP_SCMP */
389 391 { "ldga", dt_dis_lda }, /* DIF_OP_LDGA */
390 392 { "ldgs", dt_dis_ldv }, /* DIF_OP_LDGS */
391 393 { "stgs", dt_dis_stv }, /* DIF_OP_STGS */
392 394 { "ldta", dt_dis_lda }, /* DIF_OP_LDTA */
393 395 { "ldts", dt_dis_ldv }, /* DIF_OP_LDTS */
394 396 { "stts", dt_dis_stv }, /* DIF_OP_STTS */
395 397 { "sra", dt_dis_log }, /* DIF_OP_SRA */
396 398 { "call", dt_dis_call }, /* DIF_OP_CALL */
397 399 { "pushtr", dt_dis_pushts }, /* DIF_OP_PUSHTR */
398 400 { "pushtv", dt_dis_pushts }, /* DIF_OP_PUSHTV */
399 401 { "popts", dt_dis_str }, /* DIF_OP_POPTS */
400 402 { "flushts", dt_dis_str }, /* DIF_OP_FLUSHTS */
401 403 { "ldgaa", dt_dis_ldv }, /* DIF_OP_LDGAA */
402 404 { "ldtaa", dt_dis_ldv }, /* DIF_OP_LDTAA */
403 405 { "stgaa", dt_dis_stv }, /* DIF_OP_STGAA */
404 406 { "sttaa", dt_dis_stv }, /* DIF_OP_STTAA */
405 407 { "ldls", dt_dis_ldv }, /* DIF_OP_LDLS */
406 408 { "stls", dt_dis_stv }, /* DIF_OP_STLS */
407 409 { "allocs", dt_dis_r1rd }, /* DIF_OP_ALLOCS */
408 410 { "copys", dt_dis_log }, /* DIF_OP_COPYS */
409 411 { "stb", dt_dis_store }, /* DIF_OP_STB */
410 412 { "sth", dt_dis_store }, /* DIF_OP_STH */
411 413 { "stw", dt_dis_store }, /* DIF_OP_STW */
412 414 { "stx", dt_dis_store }, /* DIF_OP_STX */
413 415 { "uldsb", dt_dis_load }, /* DIF_OP_ULDSB */
414 416 { "uldsh", dt_dis_load }, /* DIF_OP_ULDSH */
415 417 { "uldsw", dt_dis_load }, /* DIF_OP_ULDSW */
416 418 { "uldub", dt_dis_load }, /* DIF_OP_ULDUB */
417 419 { "ulduh", dt_dis_load }, /* DIF_OP_ULDUH */
418 420 { "ulduw", dt_dis_load }, /* DIF_OP_ULDUW */
419 421 { "uldx", dt_dis_load }, /* DIF_OP_ULDX */
420 422 { "rldsb", dt_dis_load }, /* DIF_OP_RLDSB */
421 423 { "rldsh", dt_dis_load }, /* DIF_OP_RLDSH */
422 424 { "rldsw", dt_dis_load }, /* DIF_OP_RLDSW */
423 425 { "rldub", dt_dis_load }, /* DIF_OP_RLDUB */
424 426 { "rlduh", dt_dis_load }, /* DIF_OP_RLDUH */
425 427 { "rlduw", dt_dis_load }, /* DIF_OP_RLDUW */
426 428 { "rldx", dt_dis_load }, /* DIF_OP_RLDX */
427 429 { "xlate", dt_dis_xlate }, /* DIF_OP_XLATE */
428 430 { "xlarg", dt_dis_xlate }, /* DIF_OP_XLARG */
429 431 };
430 432
431 433 const struct opent *op;
432 434 ulong_t i = 0;
433 435 char type[DT_TYPE_NAMELEN];
434 436
435 437 (void) fprintf(fp, "\nDIFO 0x%p returns %s\n", (void *)dp,
436 438 dt_dis_typestr(&dp->dtdo_rtype, type, sizeof (type)));
437 439
438 440 (void) fprintf(fp, "%-3s %-8s %s\n",
439 441 "OFF", "OPCODE", "INSTRUCTION");
440 442
441 443 for (i = 0; i < dp->dtdo_len; i++) {
442 444 dif_instr_t instr = dp->dtdo_buf[i];
443 445 dif_instr_t opcode = DIF_INSTR_OP(instr);
444 446
445 447 if (opcode >= sizeof (optab) / sizeof (optab[0]))
446 448 opcode = 0; /* force invalid opcode message */
447 449
448 450 op = &optab[opcode];
449 451 (void) fprintf(fp, "%02lu: %08x ", i, instr);
450 452 op->op_func(dp, op->op_name, instr, fp);
451 453 (void) fprintf(fp, "\n");
452 454 }
453 455
454 456 if (dp->dtdo_varlen != 0) {
455 457 (void) fprintf(fp, "\n%-16s %-4s %-3s %-3s %-4s %s\n",
456 458 "NAME", "ID", "KND", "SCP", "FLAG", "TYPE");
457 459 }
458 460
459 461 for (i = 0; i < dp->dtdo_varlen; i++) {
460 462 dtrace_difv_t *v = &dp->dtdo_vartab[i];
461 463 char kind[4], scope[4], flags[16] = { 0 };
462 464
463 465 switch (v->dtdv_kind) {
464 466 case DIFV_KIND_ARRAY:
465 467 (void) strcpy(kind, "arr");
466 468 break;
467 469 case DIFV_KIND_SCALAR:
468 470 (void) strcpy(kind, "scl");
469 471 break;
470 472 default:
471 473 (void) snprintf(kind, sizeof (kind),
472 474 "%u", v->dtdv_kind);
473 475 }
474 476
475 477 switch (v->dtdv_scope) {
476 478 case DIFV_SCOPE_GLOBAL:
477 479 (void) strcpy(scope, "glb");
478 480 break;
479 481 case DIFV_SCOPE_THREAD:
480 482 (void) strcpy(scope, "tls");
481 483 break;
482 484 case DIFV_SCOPE_LOCAL:
483 485 (void) strcpy(scope, "loc");
484 486 break;
485 487 default:
486 488 (void) snprintf(scope, sizeof (scope),
487 489 "%u", v->dtdv_scope);
488 490 }
489 491
490 492 if (v->dtdv_flags & ~(DIFV_F_REF | DIFV_F_MOD)) {
491 493 (void) snprintf(flags, sizeof (flags), "/0x%x",
492 494 v->dtdv_flags & ~(DIFV_F_REF | DIFV_F_MOD));
493 495 }
494 496
495 497 if (v->dtdv_flags & DIFV_F_REF)
496 498 (void) strcat(flags, "/r");
497 499 if (v->dtdv_flags & DIFV_F_MOD)
498 500 (void) strcat(flags, "/w");
499 501
500 502 (void) fprintf(fp, "%-16s %-4x %-3s %-3s %-4s %s\n",
501 503 &dp->dtdo_strtab[v->dtdv_name],
502 504 v->dtdv_id, kind, scope, flags + 1,
503 505 dt_dis_typestr(&v->dtdv_type, type, sizeof (type)));
504 506 }
505 507
506 508 if (dp->dtdo_xlmlen != 0) {
507 509 (void) fprintf(fp, "\n%-4s %-3s %-12s %s\n",
508 510 "XLID", "ARG", "MEMBER", "TYPE");
509 511 }
510 512
511 513 for (i = 0; i < dp->dtdo_xlmlen; i++) {
512 514 dt_node_t *dnp = dp->dtdo_xlmtab[i];
513 515 dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
514 516 (void) fprintf(fp, "%-4u %-3d %-12s %s\n",
515 517 (uint_t)dxp->dx_id, dxp->dx_arg, dnp->dn_membname,
516 518 dt_node_type_name(dnp, type, sizeof (type)));
517 519 }
518 520
519 521 if (dp->dtdo_krelen != 0)
520 522 dt_dis_rtab("KREL", dp, fp, dp->dtdo_kreltab, dp->dtdo_krelen);
521 523
522 524 if (dp->dtdo_urelen != 0)
523 525 dt_dis_rtab("UREL", dp, fp, dp->dtdo_ureltab, dp->dtdo_urelen);
524 526 }
↓ open down ↓ |
197 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX