Print this page
5510 elfdump doesn't print the member header before pr_reg
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/elfdump/common/corenote.c
+++ new/usr/src/cmd/sgs/elfdump/common/corenote.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 (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26 /*
27 27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 29 */
30 30
31 31 #include <stdlib.h>
32 32 #include <stdio.h>
33 33 #include <string.h>
34 34 #include <sys/types.h>
35 35 #include <unistd.h>
36 36 #include <sys/corectl.h>
37 37 #include <msg.h>
38 38 #include <_elfdump.h>
39 39 #include <struct_layout.h>
40 40 #include <conv.h>
41 41
42 42
43 43 /*
44 44 * This module contains the code that displays data from the note
45 45 * sections found in Solaris core files. The format of these
46 46 * note sections are described in the core(4) manpage.
47 47 */
48 48
49 49
50 50
51 51
52 52 /*
53 53 * Much of the code in this file uses the "%*s" format to set
54 54 * the left margin indentation. This macro combines the indent
55 55 * integer argument and the NULL string that follows it.
56 56 */
57 57 #define INDENT state->ns_indent, MSG_ORIG(MSG_STR_EMPTY)
58 58
59 59 /*
60 60 * Indent unit, used for each nesting
61 61 */
62 62 #define INDENT_STEP 4
63 63
64 64 /*
65 65 * The PRINT_ macros are convenience wrappers on print_num(),
66 66 * print_subtype(), and print_strbuf(). They reduce code
67 67 * clutter by hiding the boilerplate arguments.
68 68 *
69 69 * Assumptions:
70 70 * - A variable named "layout" exists in the compilation
71 71 * environment, referencing the layout information for the
72 72 * current type.
73 73 * - The variable "state" references the current note state.
74 74 */
75 75 #define PRINT_DEC(_title, _field) \
76 76 print_num(state, _title, &layout->_field, SL_FMT_NUM_DEC)
77 77 #define PRINT_DEC_2UP(_title1, _field1, _title2, _field2) \
78 78 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_DEC, \
79 79 _title2, &layout->_field2, SL_FMT_NUM_DEC)
80 80 #define PRINT_HEX(_title, _field) \
81 81 print_num(state, _title, &layout->_field, SL_FMT_NUM_HEX)
82 82 #define PRINT_HEX_2UP(_title1, _field1, _title2, _field2) \
83 83 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_HEX, \
84 84 _title2, &layout->_field2, SL_FMT_NUM_HEX)
85 85 #define PRINT_ZHEX(_title, _field) \
86 86 print_num(state, _title, &layout->_field, SL_FMT_NUM_ZHEX)
87 87 #define PRINT_ZHEX_2UP(_title1, _field1, _title2, _field2) \
88 88 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_ZHEX, \
89 89 _title2, &layout->_field2, SL_FMT_NUM_ZHEX)
90 90 #define PRINT_SUBTYPE(_title, _field, _func) \
91 91 print_subtype(state, _title, &layout->_field, _func)
92 92 #define PRINT_STRBUF(_title, _field) \
93 93 print_strbuf(state, _title, &layout->_field)
94 94
95 95
96 96
97 97 /*
98 98 * Structure used to maintain state data for a core note, or a subregion
99 99 * (sub-struct) of a core note. These values would otherwise need to be
100 100 * passed to nearly every routine.
101 101 */
102 102 typedef struct {
103 103 Half ns_mach; /* ELF machine type of core file */
104 104 const sl_arch_layout_t *ns_arch; /* structure layout def for mach */
105 105 int ns_swap; /* True if byte swapping is needed */
106 106 int ns_indent; /* Left margin indentation */
107 107 int ns_vcol; /* Column where value starts */
108 108 int ns_t2col; /* Column where 2up title starts */
109 109 int ns_v2col; /* Column where 2up value starts */
110 110 const char *ns_data; /* Pointer to struct data area */
111 111 Word ns_len; /* Length of struct data area */
112 112 } note_state_t;
113 113
114 114 /*
115 115 * Standard signature for a dump function used to process a note
116 116 * or a sub-structure within a note.
117 117 */
118 118 typedef void (* dump_func_t)(note_state_t *state, const char *title);
119 119
120 120
121 121
122 122
123 123
124 124
125 125 /*
126 126 * Some core notes contain string buffers of fixed size
127 127 * that are expected to contain NULL terminated strings.
128 128 * If the NULL is there, we can print these strings directly.
129 129 * However, the potential exists for a corrupt file to have
130 130 * a non-terminated buffer. This routine examines the given
131 131 * string, and if the string is terminated, the string itself
132 132 * is returned. Otherwise, it is copied to a static buffer,
133 133 * and a pointer to the buffer is returned.
134 134 */
135 135 static const char *
136 136 safe_str(const char *str, size_t n)
137 137 {
138 138 static char buf[512];
139 139 char *s;
140 140 size_t i;
141 141
142 142 if (n == 0)
143 143 return (MSG_ORIG(MSG_STR_EMPTY));
144 144
145 145 for (i = 0; i < n; i++)
146 146 if (str[i] == '\0')
147 147 return (str);
148 148
149 149 i = (n >= sizeof (buf)) ? (sizeof (buf) - 4) : (n - 1);
150 150 (void) memcpy(buf, str, i);
151 151 s = buf + i;
152 152 if (n >= sizeof (buf)) {
153 153 *s++ = '.';
154 154 *s++ = '.';
155 155 *s++ = '.';
156 156 }
157 157 *s = '\0';
158 158 return (buf);
159 159 }
160 160
161 161 /*
162 162 * Convenience wrappers on top of the corresponding sl_XXX() functions.
163 163 */
164 164 static Word
165 165 extract_as_word(note_state_t *state, const sl_field_t *fdesc)
166 166 {
167 167 return (sl_extract_as_word(state->ns_data, state->ns_swap, fdesc));
168 168 }
169 169 static Word
170 170 extract_as_lword(note_state_t *state, const sl_field_t *fdesc)
171 171 {
172 172 return (sl_extract_as_lword(state->ns_data, state->ns_swap, fdesc));
173 173 }
174 174 static int
175 175 extract_as_sword(note_state_t *state, const sl_field_t *fdesc)
176 176 {
177 177 return (sl_extract_as_sword(state->ns_data, state->ns_swap, fdesc));
178 178 }
179 179 static const char *
180 180 fmt_num(note_state_t *state, const sl_field_t *fdesc,
181 181 sl_fmt_num_t fmt_type, sl_fmtbuf_t buf)
182 182 {
183 183 return (sl_fmt_num(state->ns_data, state->ns_swap, fdesc,
184 184 fmt_type, buf));
185 185 }
186 186
187 187
188 188 /*
189 189 * Return true of the data for the specified field is available.
190 190 */
191 191 inline static int
192 192 data_present(note_state_t *state, const sl_field_t *fdesc)
193 193 {
194 194 return ((fdesc->slf_offset + fdesc->slf_eltlen) <= state->ns_len);
195 195 }
196 196
197 197 /*
198 198 * indent_enter/exit are used to start/end output for a subitem.
199 199 * On entry, a title is output, and the indentation level is raised
200 200 * by one unit. On exit, the indentation level is restrored to its
201 201 * previous value.
202 202 */
203 203 static void
204 204 indent_enter(note_state_t *state, const char *title,
205 205 const sl_field_t *first_fdesc)
206 206 {
207 207 /*
208 208 * If the first field offset and extent fall past the end of the
209 209 * available data, then return without printing a title. That note
210 210 * is from an older core file that doesn't have all the fields
211 211 * that we know about.
212 212 */
213 213 if (data_present(state, first_fdesc))
214 214 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_TITLE), INDENT, title);
215 215
216 216 state->ns_indent += INDENT_STEP;
217 217 }
218 218 static void
219 219 indent_exit(note_state_t *state)
220 220 {
221 221 state->ns_indent -= INDENT_STEP;
222 222 }
223 223
224 224
225 225 /*
226 226 * print_num outputs a field on one line, in the format:
227 227 *
228 228 * title: value
229 229 */
230 230 static void
231 231 print_num(note_state_t *state, const char *title,
232 232 const sl_field_t *fdesc, sl_fmt_num_t fmt_type)
233 233 {
234 234 sl_fmtbuf_t buf;
235 235
236 236 /*
237 237 * If the field offset and extent fall past the end of the
238 238 * available data, then return without doing anything. That note
239 239 * is from an older core file that doesn't have all the fields
240 240 * that we know about.
241 241 */
242 242 if (!data_present(state, fdesc))
243 243 return;
244 244
245 245 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
246 246 state->ns_vcol - state->ns_indent, title,
247 247 fmt_num(state, fdesc, fmt_type, buf));
248 248 }
249 249
250 250 /*
251 251 * print_num_2up outputs two fields on one line, in the format:
252 252 *
253 253 * title1: value1 title2: value2
254 254 */
255 255 static void
256 256 print_num_2up(note_state_t *state, const char *title1,
257 257 const sl_field_t *fdesc1, sl_fmt_num_t fmt_type1, const char *title2,
258 258 const sl_field_t *fdesc2, sl_fmt_num_t fmt_type2)
259 259 {
260 260 sl_fmtbuf_t buf1, buf2;
261 261
262 262 /*
263 263 * If the field offset and extent fall past the end of the
264 264 * available data, then return without doing anything. That note
265 265 * is from an older core file that doesn't have all the fields
266 266 * that we know about.
267 267 */
268 268 if (!(data_present(state, fdesc1) &&
269 269 data_present(state, fdesc2)))
270 270 return;
271 271
272 272 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
273 273 state->ns_vcol - state->ns_indent, title1,
274 274 state->ns_t2col - state->ns_vcol,
275 275 fmt_num(state, fdesc1, fmt_type1, buf1),
276 276 state->ns_v2col - state->ns_t2col, title2,
277 277 fmt_num(state, fdesc2, fmt_type2, buf2));
278 278 }
279 279
280 280 /*
281 281 * print_strbuf outputs a fixed sized character buffer field
282 282 * on one line, in the format:
283 283 *
284 284 * title: value
285 285 */
286 286 static void
287 287 print_strbuf(note_state_t *state, const char *title,
288 288 const sl_field_t *fdesc)
289 289 {
290 290 Word n;
291 291
292 292 /*
293 293 * If we are past the end of the data area, then return
294 294 * without doing anything. That note is from an older core
295 295 * file that doesn't have all the fields that we know about.
296 296 *
297 297 * Note that we are willing to accept a partial buffer,
298 298 * so we don't use data_present() for this test.
299 299 */
300 300 if (fdesc->slf_offset >= state->ns_len)
301 301 return;
302 302
303 303 /*
304 304 * We expect the full buffer to be present, but if there
305 305 * is less than that, we will still proceed. The use of safe_str()
306 306 * protects us from the effect of printing garbage data.
307 307 */
308 308 n = state->ns_len - fdesc->slf_offset;
309 309 if (n > fdesc->slf_nelts)
310 310 n = fdesc->slf_nelts;
311 311
312 312 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
313 313 state->ns_vcol - state->ns_indent,
314 314 title, safe_str(fdesc->slf_offset + state->ns_data, n));
315 315 }
316 316
317 317 /*
318 318 * print_str outputs an arbitrary string value item
319 319 * on one line, in the format:
320 320 *
321 321 * title: str
322 322 */
323 323 static void
324 324 print_str(note_state_t *state, const char *title, const char *str)
325 325 {
326 326 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
327 327 state->ns_vcol - state->ns_indent, title, str);
328 328 }
329 329
330 330 /*
331 331 * Used when one dump function needs to call another dump function
332 332 * in order to display a subitem. This routine constructs a state
333 333 * block for the sub-region, and then calls the dump function with it.
334 334 * This limits the amount of data visible to the sub-function to that
335 335 * for the sub-item.
336 336 */
337 337 static void
338 338 print_subtype(note_state_t *state, const char *title,
339 339 const sl_field_t *fdesc, dump_func_t dump_func)
340 340 {
341 341 note_state_t sub_state;
342 342
343 343 /*
344 344 * If there is no data for the sub-item, return immediately.
345 345 * Partial data is left to the dump function to handle,
346 346 * as that can be a sign of an older core file with less data,
347 347 * which can still be interpreted.
348 348 */
349 349 if (fdesc->slf_offset >= state->ns_len)
350 350 return;
351 351
352 352 /*
353 353 * Construct a state block that reflects the sub-item
354 354 */
355 355 sub_state = *state;
356 356 sub_state.ns_data += fdesc->slf_offset;
357 357 sub_state.ns_len -= fdesc->slf_offset;
358 358 if (sub_state.ns_len > fdesc->slf_eltlen)
359 359 sub_state.ns_len = fdesc->slf_eltlen;
360 360
361 361 (* dump_func)(&sub_state, title);
362 362 }
363 363
364 364
365 365 /*
366 366 * Output a sequence of array elements, giving each
367 367 * element an index, in the format:
368 368 *
369 369 * [ndx] value
370 370 *
371 371 * entry:
372 372 * state - Current state
373 373 * base_desc - Field descriptor for 1st element of array
374 374 * nelts - # of array elements to display
375 375 * check_nelts - If True (1), nelts is clipped to fdesc->slf_nelts.
376 376 * If False (1), nelts is not clipped.
377 377 * title - Name of array
378 378 */
379 379 static void
380 380 print_array(note_state_t *state, const sl_field_t *base_desc,
381 381 sl_fmt_num_t fmt_type, int nelts, int check_nelts, const char *title)
382 382 {
383 383 char index1[MAXNDXSIZE], index2[MAXNDXSIZE];
384 384 int i;
385 385 sl_field_t fdesc1, fdesc2;
386 386
387 387 if (check_nelts && (check_nelts > base_desc->slf_nelts))
388 388 nelts = base_desc->slf_nelts;
389 389 if (nelts == 0)
390 390 return;
391 391
392 392 indent_enter(state, title, base_desc);
393 393
394 394 fdesc1 = fdesc2 = *base_desc;
395 395 for (i = 0; i < nelts; ) {
396 396 if (i == (nelts - 1)) {
397 397 /* One final value is left */
398 398 if (!data_present(state, &fdesc1))
399 399 break;
400 400 (void) snprintf(index1, sizeof (index1),
401 401 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i));
402 402 print_num(state, index1, &fdesc1, fmt_type);
403 403 fdesc1.slf_offset += fdesc1.slf_eltlen;
404 404 i++;
405 405 continue;
406 406 }
407 407
408 408 /* There are at least 2 items left. Show 2 up. */
409 409 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
410 410 if (!(data_present(state, &fdesc1) &&
411 411 data_present(state, &fdesc2)))
412 412 break;
413 413 (void) snprintf(index1, sizeof (index1),
414 414 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i));
415 415 (void) snprintf(index2, sizeof (index2),
416 416 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i + 1));
417 417 print_num_2up(state, index1, &fdesc1, fmt_type,
418 418 index2, &fdesc2, fmt_type);
419 419 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
420 420 i += 2;
421 421 }
422 422
423 423 indent_exit(state);
424 424 }
425 425
426 426
427 427 /*
428 428 * Output information from auxv_t structure.
429 429 */
430 430 static void
431 431 dump_auxv(note_state_t *state, const char *title)
432 432 {
433 433 const sl_auxv_layout_t *layout = state->ns_arch->auxv;
434 434 union {
435 435 Conv_cap_val_hw1_buf_t hw1;
436 436 Conv_cap_val_hw2_buf_t hw2;
437 437 Conv_cnote_auxv_af_buf_t auxv_af;
438 438 Conv_ehdr_flags_buf_t ehdr_flags;
439 439 Conv_inv_buf_t inv;
440 440 } conv_buf;
441 441 sl_fmtbuf_t buf;
442 442 int ndx, ndx_start;
443 443 Word sizeof_auxv;
444 444
445 445 sizeof_auxv = layout->sizeof_struct.slf_eltlen;
446 446
447 447 indent_enter(state, title, &layout->sizeof_struct);
448 448
449 449 /*
450 450 * Immediate indent_exit() restores the indent level to
451 451 * that of the title. We include indentation as part of
452 452 * the index string, which is right justified, and don't
453 453 * want the usual indentation spacing.
454 454 */
455 455 indent_exit(state);
456 456
457 457 ndx = 0;
458 458 while (state->ns_len > sizeof_auxv) {
459 459 char index[(MAXNDXSIZE * 2) + 1];
460 460 sl_fmt_num_t num_fmt = SL_FMT_NUM_ZHEX;
461 461 const char *vstr = NULL;
462 462 Word w;
463 463 int type;
464 464 sl_field_t a_type_next;
465 465
466 466 type = extract_as_word(state, &layout->a_type);
467 467 ndx_start = ndx;
468 468 switch (type) {
469 469 case AT_NULL:
470 470 a_type_next = layout->a_type;
471 471 a_type_next.slf_offset += sizeof_auxv;
472 472 while ((state->ns_len - sizeof_auxv) >= sizeof_auxv) {
473 473 type = extract_as_word(state, &a_type_next);
474 474 if (type != AT_NULL)
475 475 break;
476 476 ndx++;
477 477 state->ns_data += sizeof_auxv;
478 478 state->ns_len -= sizeof_auxv;
479 479 }
480 480 num_fmt = SL_FMT_NUM_HEX;
481 481 break;
482 482
483 483
484 484
485 485 case AT_IGNORE:
486 486 case AT_SUN_IFLUSH:
487 487 num_fmt = SL_FMT_NUM_HEX;
488 488 break;
489 489
490 490 case AT_EXECFD:
491 491 case AT_PHENT:
492 492 case AT_PHNUM:
493 493 case AT_PAGESZ:
494 494 case AT_SUN_UID:
495 495 case AT_SUN_RUID:
496 496 case AT_SUN_GID:
497 497 case AT_SUN_RGID:
498 498 case AT_SUN_LPAGESZ:
499 499 num_fmt = SL_FMT_NUM_DEC;
500 500 break;
501 501
502 502 case AT_FLAGS: /* processor flags */
503 503 w = extract_as_word(state, &layout->a_val);
504 504 vstr = conv_ehdr_flags(state->ns_mach, w,
505 505 0, &conv_buf.ehdr_flags);
506 506 break;
507 507
508 508 case AT_SUN_HWCAP:
509 509 w = extract_as_word(state, &layout->a_val);
510 510 vstr = conv_cap_val_hw1(w, state->ns_mach,
511 511 0, &conv_buf.hw1);
512 512 /*
513 513 * conv_cap_val_hw1() produces output like:
514 514 *
515 515 * 0xfff [ flg1 flg2 0xff]
516 516 *
517 517 * where the first hex value is the complete value,
518 518 * and the second is the leftover bits. We only
519 519 * want the part in brackets, and failing that,
520 520 * would rather fall back to formatting the full
521 521 * value ourselves.
522 522 */
523 523 while ((*vstr != '\0') && (*vstr != '['))
524 524 vstr++;
525 525 if (*vstr != '[')
526 526 vstr = NULL;
527 527 num_fmt = SL_FMT_NUM_HEX;
528 528 break;
529 529 case AT_SUN_HWCAP2:
530 530 w = extract_as_word(state, &layout->a_val);
531 531 vstr = conv_cap_val_hw2(w, state->ns_mach,
532 532 0, &conv_buf.hw2);
533 533 /*
534 534 * conv_cap_val_hw2() produces output like:
535 535 *
536 536 * 0xfff [ flg1 flg2 0xff]
537 537 *
538 538 * where the first hex value is the complete value,
539 539 * and the second is the leftover bits. We only
540 540 * want the part in brackets, and failing that,
541 541 * would rather fall back to formatting the full
542 542 * value ourselves.
543 543 */
544 544 while ((*vstr != '\0') && (*vstr != '['))
545 545 vstr++;
546 546 if (*vstr != '[')
547 547 vstr = NULL;
548 548 num_fmt = SL_FMT_NUM_HEX;
549 549 break;
550 550
551 551
552 552
553 553 case AT_SUN_AUXFLAGS:
554 554 w = extract_as_word(state, &layout->a_val);
555 555 vstr = conv_cnote_auxv_af(w, 0, &conv_buf.auxv_af);
556 556 num_fmt = SL_FMT_NUM_HEX;
557 557 break;
558 558 }
559 559
560 560 if (ndx == ndx_start)
561 561 (void) snprintf(index, sizeof (index),
562 562 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(ndx));
563 563 else
564 564 (void) snprintf(index, sizeof (index),
565 565 MSG_ORIG(MSG_FMT_INDEXRNG),
566 566 EC_WORD(ndx_start), EC_WORD(ndx));
567 567
568 568 if (vstr == NULL)
569 569 vstr = fmt_num(state, &layout->a_val, num_fmt, buf);
570 570 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_AUXVLINE), INDENT, index,
571 571 state->ns_vcol - state->ns_indent,
572 572 conv_cnote_auxv_type(type, CONV_FMT_DECIMAL,
573 573 &conv_buf.inv), vstr);
574 574
575 575 state->ns_data += sizeof_auxv;
576 576 state->ns_len -= sizeof_auxv;
577 577 ndx++;
578 578 }
579 579 }
580 580
581 581
582 582 /*
583 583 * Output information from fltset_t structure.
584 584 */
585 585 static void
586 586 dump_fltset(note_state_t *state, const char *title)
587 587 {
588 588 #define NELTS 4
589 589
590 590 const sl_fltset_layout_t *layout = state->ns_arch->fltset;
591 591 Conv_cnote_fltset_buf_t buf;
592 592 sl_field_t fdesc;
593 593 uint32_t mask[NELTS];
594 594 int i, nelts;
595 595
596 596 if (!data_present(state, &layout->sizeof_struct))
597 597 return;
598 598
599 599 fdesc = layout->word;
600 600 nelts = fdesc.slf_nelts;
601 601 if (nelts > NELTS) /* Type has grown? Show what we understand */
602 602 nelts = NELTS;
603 603 for (i = 0; i < nelts; i++) {
604 604 mask[i] = extract_as_word(state, &fdesc);
605 605 fdesc.slf_offset += fdesc.slf_eltlen;
606 606 }
607 607
608 608 print_str(state, title, conv_cnote_fltset(mask, nelts, 0, &buf));
609 609
610 610 #undef NELTS
611 611 }
612 612
613 613
614 614 /*
615 615 * Output information from sigset_t structure.
616 616 */
617 617 static void
618 618 dump_sigset(note_state_t *state, const char *title)
619 619 {
620 620 #define NELTS 4
621 621
622 622 const sl_sigset_layout_t *layout = state->ns_arch->sigset;
623 623 Conv_cnote_sigset_buf_t buf;
624 624 sl_field_t fdesc;
625 625 uint32_t mask[NELTS];
626 626 int i, nelts;
627 627
628 628 if (!data_present(state, &layout->sizeof_struct))
629 629 return;
630 630
631 631 fdesc = layout->sigbits;
632 632 nelts = fdesc.slf_nelts;
633 633 if (nelts > NELTS) /* Type has grown? Show what we understand */
634 634 nelts = NELTS;
635 635 for (i = 0; i < nelts; i++) {
636 636 mask[i] = extract_as_word(state, &fdesc);
637 637 fdesc.slf_offset += fdesc.slf_eltlen;
638 638 }
639 639
640 640 print_str(state, title, conv_cnote_sigset(mask, nelts, 0, &buf));
641 641
642 642 #undef NELTS
643 643 }
644 644
645 645
646 646 /*
647 647 * Output information from sigaction structure.
648 648 */
649 649 static void
650 650 dump_sigaction(note_state_t *state, const char *title)
651 651 {
652 652 const sl_sigaction_layout_t *layout = state->ns_arch->sigaction;
653 653 Conv_cnote_sa_flags_buf_t conv_buf;
654 654 Word w;
655 655
656 656 indent_enter(state, title, &layout->sa_flags);
657 657
658 658 if (data_present(state, &layout->sa_flags)) {
659 659 w = extract_as_word(state, &layout->sa_flags);
660 660 print_str(state, MSG_ORIG(MSG_CNOTE_T_SA_FLAGS),
661 661 conv_cnote_sa_flags(w, 0, &conv_buf));
662 662 }
663 663
664 664 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_SA_HANDLER), sa_hand,
665 665 MSG_ORIG(MSG_CNOTE_T_SA_SIGACTION), sa_sigact);
666 666 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_SA_MASK), sa_mask, dump_sigset);
667 667
668 668 indent_exit(state);
669 669 }
670 670
671 671
672 672 /*
673 673 * Output information from siginfo structure.
674 674 */
675 675 static void
676 676 dump_siginfo(note_state_t *state, const char *title)
677 677 {
678 678 const sl_siginfo_layout_t *layout = state->ns_arch->siginfo;
679 679 Conv_inv_buf_t inv_buf;
680 680 Word w;
681 681 int v_si_code, v_si_signo;
682 682
683 683 if (!data_present(state, &layout->sizeof_struct))
684 684 return;
685 685
686 686 indent_enter(state, title, &layout->f_si_signo);
687 687
688 688 v_si_signo = extract_as_sword(state, &layout->f_si_signo);
689 689 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_SIGNO),
690 690 conv_cnote_signal(v_si_signo, CONV_FMT_DECIMAL, &inv_buf));
691 691
692 692 w = extract_as_word(state, &layout->f_si_errno);
693 693 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_ERRNO),
694 694 conv_cnote_errno(w, CONV_FMT_DECIMAL, &inv_buf));
695 695
696 696 v_si_code = extract_as_sword(state, &layout->f_si_code);
697 697 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_CODE),
698 698 conv_cnote_si_code(state->ns_mach, v_si_signo, v_si_code,
699 699 CONV_FMT_DECIMAL, &inv_buf));
700 700
701 701 if ((v_si_signo == 0) || (v_si_code == SI_NOINFO)) {
702 702 indent_exit(state);
703 703 return;
704 704 }
705 705
706 706 /* User generated signals have (si_code <= 0) */
707 707 if (v_si_code <= 0) {
708 708 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_PID), f_si_pid);
709 709 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_UID), f_si_uid);
710 710 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_CTID), f_si_ctid);
711 711 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_ZONEID), f_si_zoneid);
712 712 switch (v_si_code) {
713 713 case SI_QUEUE:
714 714 case SI_TIMER:
715 715 case SI_ASYNCIO:
716 716 case SI_MESGQ:
717 717 indent_enter(state, MSG_ORIG(MSG_CNOTE_T_SI_VALUE),
718 718 &layout->f_si_value_int);
719 719 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SIVAL_INT),
720 720 f_si_value_int);
721 721 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SIVAL_PTR),
722 722 f_si_value_ptr);
723 723 indent_exit(state);
724 724 break;
725 725 }
726 726 indent_exit(state);
727 727 return;
728 728 }
729 729
730 730 /*
731 731 * Remaining cases are kernel generated signals. Output any
732 732 * signal or code specific information.
733 733 */
734 734 if (v_si_code == SI_RCTL)
735 735 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_SI_ENTITY), f_si_entity);
736 736 switch (v_si_signo) {
737 737 case SIGILL:
738 738 case SIGFPE:
739 739 case SIGSEGV:
740 740 case SIGBUS:
741 741 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SI_ADDR), f_si_addr);
742 742 break;
743 743 case SIGCHLD:
744 744 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_PID), f_si_pid);
745 745 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_STATUS), f_si_status);
746 746 break;
747 747 case SIGPOLL:
748 748 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_BAND), f_si_band);
749 749 break;
750 750 }
751 751
752 752 indent_exit(state);
753 753 }
754 754
755 755
756 756 /*
757 757 * Output information from stack_t structure.
758 758 */
759 759 static void
760 760 dump_stack(note_state_t *state, const char *title)
761 761 {
762 762 const sl_stack_layout_t *layout = state->ns_arch->stack;
763 763 Conv_cnote_ss_flags_buf_t conv_buf;
764 764 Word w;
765 765
766 766 indent_enter(state, title, &layout->ss_size);
767 767
768 768 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_SS_SP), &layout->ss_sp,
769 769 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_SS_SIZE), &layout->ss_size,
770 770 SL_FMT_NUM_HEX);
771 771
772 772 if (data_present(state, &layout->ss_flags)) {
773 773 w = extract_as_word(state, &layout->ss_flags);
774 774 print_str(state, MSG_ORIG(MSG_CNOTE_T_SS_FLAGS),
775 775 conv_cnote_ss_flags(w, 0, &conv_buf));
776 776 }
777 777
778 778 indent_exit(state);
779 779 }
780 780
781 781
782 782 /*
783 783 * Output information from sysset_t structure.
784 784 */
785 785 static void
786 786 dump_sysset(note_state_t *state, const char *title)
787 787 {
788 788 #define NELTS 16
789 789
790 790 const sl_sysset_layout_t *layout = state->ns_arch->sysset;
791 791 Conv_cnote_sysset_buf_t buf;
792 792 sl_field_t fdesc;
793 793 uint32_t mask[NELTS];
794 794 int i, nelts;
795 795
796 796 if (!data_present(state, &layout->sizeof_struct))
797 797 return;
798 798
799 799 fdesc = layout->word;
800 800 nelts = fdesc.slf_nelts;
801 801 if (nelts > NELTS) /* Type has grown? Show what we understand */
802 802 nelts = NELTS;
803 803 for (i = 0; i < nelts; i++) {
804 804 mask[i] = extract_as_word(state, &fdesc);
805 805 fdesc.slf_offset += fdesc.slf_eltlen;
806 806 }
807 807
808 808 print_str(state, title, conv_cnote_sysset(mask, nelts, 0, &buf));
809 809
810 810 #undef NELTS
811 811 }
812 812
813 813
814 814 /*
815 815 * Output information from timestruc_t structure.
816 816 */
817 817 static void
818 818 dump_timestruc(note_state_t *state, const char *title)
819 819 {
820 820 const sl_timestruc_layout_t *layout = state->ns_arch->timestruc;
821 821
822 822 indent_enter(state, title, &layout->tv_sec);
823 823
824 824 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_TV_SEC), tv_sec,
825 825 MSG_ORIG(MSG_CNOTE_T_TV_NSEC), tv_nsec);
826 826
827 827 indent_exit(state);
828 828 }
829 829
830 830
831 831 /*
832 832 * Output information from utsname structure.
833 833 */
834 834 static void
835 835 dump_utsname(note_state_t *state, const char *title)
836 836 {
837 837 const sl_utsname_layout_t *layout = state->ns_arch->utsname;
838 838
839 839 indent_enter(state, title, &layout->sysname);
840 840
841 841 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_SYSNAME), sysname);
842 842 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_NODENAME), nodename);
843 843 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_RELEASE), release);
844 844 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_VERSION), version);
845 845 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_MACHINE), machine);
846 846
847 847 indent_exit(state);
848 848 }
849 849
850 850
851 851 /*
↓ open down ↓ |
851 lines elided |
↑ open up ↑ |
852 852 * Dump register contents
853 853 */
854 854 static void
855 855 dump_prgregset(note_state_t *state, const char *title)
856 856 {
857 857 sl_field_t fdesc1, fdesc2;
858 858 sl_fmtbuf_t buf1, buf2;
859 859 Conv_inv_buf_t inv_buf1, inv_buf2;
860 860 Word w;
861 861
862 + fdesc1 = fdesc2 = state->ns_arch->prgregset->elt0;
862 863 indent_enter(state, title, &fdesc1);
863 864
864 - fdesc1 = fdesc2 = state->ns_arch->prgregset->elt0;
865 865 for (w = 0; w < fdesc1.slf_nelts; ) {
866 866 if (w == (fdesc1.slf_nelts - 1)) {
867 867 /* One last register is left */
868 868 if (!data_present(state, &fdesc1))
869 869 break;
870 870 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
871 871 INDENT, state->ns_vcol - state->ns_indent,
872 872 conv_cnote_pr_regname(state->ns_mach, w,
873 873 CONV_FMT_DECIMAL, &inv_buf1),
874 874 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
875 875 fdesc1.slf_offset += fdesc1.slf_eltlen;
876 876 w++;
877 877 continue;
878 878 }
879 879
880 880 /* There are at least 2 more registers left. Show 2 up */
881 881 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
882 882 if (!(data_present(state, &fdesc1) &&
883 883 data_present(state, &fdesc2)))
884 884 break;
885 885 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
886 886 state->ns_vcol - state->ns_indent,
887 887 conv_cnote_pr_regname(state->ns_mach, w,
888 888 CONV_FMT_DECIMAL, &inv_buf1),
889 889 state->ns_t2col - state->ns_vcol,
890 890 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
891 891 state->ns_v2col - state->ns_t2col,
892 892 conv_cnote_pr_regname(state->ns_mach, w + 1,
893 893 CONV_FMT_DECIMAL, &inv_buf2),
894 894 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
895 895 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
896 896 w += 2;
897 897 }
898 898
899 899 indent_exit(state);
900 900 }
901 901
902 902 /*
903 903 * Output information from lwpstatus_t structure.
904 904 */
905 905 static void
906 906 dump_lwpstatus(note_state_t *state, const char *title)
907 907 {
908 908 const sl_lwpstatus_layout_t *layout = state->ns_arch->lwpstatus;
909 909 Word w, w2;
910 910 int32_t i;
911 911 union {
912 912 Conv_inv_buf_t inv;
913 913 Conv_cnote_pr_flags_buf_t flags;
914 914 } conv_buf;
915 915
916 916 indent_enter(state, title, &layout->pr_flags);
917 917
918 918 if (data_present(state, &layout->pr_flags)) {
919 919 w = extract_as_word(state, &layout->pr_flags);
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
920 920 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
921 921 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
922 922 }
923 923
924 924 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LWPID), pr_lwpid);
925 925
926 926 if (data_present(state, &layout->pr_why)) {
927 927 w = extract_as_word(state, &layout->pr_why);
928 928 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
929 929 conv_cnote_pr_why(w, 0, &conv_buf.inv));
930 - }
931 930
932 - if (data_present(state, &layout->pr_what)) {
933 - w2 = extract_as_word(state, &layout->pr_what);
934 - print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
935 - conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
931 + if (data_present(state, &layout->pr_what)) {
932 + w2 = extract_as_word(state, &layout->pr_what);
933 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
934 + conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
935 + }
936 936 }
937 937
938 938 if (data_present(state, &layout->pr_cursig)) {
939 939 w = extract_as_word(state, &layout->pr_cursig);
940 940 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
941 941 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
942 942 }
943 943
944 944 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
945 945 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_lwppend,
946 946 dump_sigset);
947 947 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPHOLD), pr_lwphold,
948 948 dump_sigset);
949 949 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
950 950 dump_sigaction);
951 951 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
952 952 dump_stack);
953 953
954 954 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
955 955
956 956 if (data_present(state, &layout->pr_syscall)) {
957 957 w = extract_as_word(state, &layout->pr_syscall);
958 958 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
959 959 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
960 960 }
961 961
962 962 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
963 963
964 964 if (data_present(state, &layout->pr_errno)) {
965 965 w = extract_as_word(state, &layout->pr_errno);
966 966 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRNO),
967 967 conv_cnote_errno(w, CONV_FMT_DECIMAL, &conv_buf.inv));
968 968 }
969 969
970 970 if (data_present(state, &layout->pr_nsysarg)) {
971 971 w2 = extract_as_word(state, &layout->pr_nsysarg);
972 972 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
973 973 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
974 974 }
975 975
976 976 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RVAL1), pr_rval1,
977 977 MSG_ORIG(MSG_CNOTE_T_PR_RVAL2), pr_rval2);
978 978 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
979 979 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TSTAMP), pr_tstamp,
980 980 dump_timestruc);
981 981 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
982 982 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
983 983
984 984 if (data_present(state, &layout->pr_errpriv)) {
985 985 i = extract_as_sword(state, &layout->pr_errpriv);
986 986 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRPRIV),
987 987 conv_cnote_priv(i, CONV_FMT_DECIMAL, &conv_buf.inv));
988 988 }
989 989
990 990 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_USTACK), pr_ustack,
991 991 MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
992 992
993 993 /*
994 994 * In order to line up all the values in a single column,
995 995 * we would have to set vcol to a very high value, which results
996 996 * in ugly looking output that runs off column 80. So, we use
997 997 * two levels of vcol, one for the contents so far, and a
998 998 * higher one for the pr_reg sub-struct.
999 999 */
1000 1000 state->ns_vcol += 3;
1001 1001 state->ns_t2col += 3;
1002 1002 state->ns_v2col += 2;
1003 1003 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1004 1004 state->ns_vcol -= 3;
1005 1005 state->ns_t2col -= 3;
1006 1006 state->ns_v2col -= 2;
1007 1007
1008 1008 /*
1009 1009 * The floating point register state is complex, and highly
1010 1010 * platform dependent. For now, we simply display it as
1011 1011 * a hex dump. This can be replaced if better information
1012 1012 * is required.
1013 1013 */
1014 1014 if (data_present(state, &layout->pr_fpreg)) {
1015 1015 indent_enter(state, MSG_ORIG(MSG_CNOTE_T_PR_FPREG),
1016 1016 &layout->pr_fpreg);
1017 1017 dump_hex_bytes(layout->pr_fpreg.slf_offset + state->ns_data,
1018 1018 layout->pr_fpreg.slf_eltlen, state->ns_indent, 4, 3);
1019 1019 indent_exit(state);
1020 1020 }
1021 1021
1022 1022 indent_exit(state);
1023 1023 }
1024 1024
1025 1025
1026 1026 /*
1027 1027 * Output information from pstatus_t structure.
1028 1028 */
1029 1029 static void
1030 1030 dump_pstatus(note_state_t *state, const char *title)
1031 1031 {
1032 1032 const sl_pstatus_layout_t *layout = state->ns_arch->pstatus;
1033 1033 Word w;
1034 1034 union {
1035 1035 Conv_inv_buf_t inv;
1036 1036 Conv_cnote_pr_flags_buf_t flags;
1037 1037 } conv_buf;
1038 1038
1039 1039 indent_enter(state, title, &layout->pr_flags);
1040 1040
1041 1041 if (data_present(state, &layout->pr_flags)) {
1042 1042 w = extract_as_word(state, &layout->pr_flags);
1043 1043 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1044 1044 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
1045 1045 }
1046 1046
1047 1047 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1048 1048 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1049 1049 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1050 1050 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1051 1051 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1052 1052 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid,
1053 1053 MSG_ORIG(MSG_CNOTE_T_PR_AGENTID), pr_agentid);
1054 1054 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1055 1055 dump_sigset);
1056 1056 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1057 1057 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1058 1058 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1059 1059 &layout->pr_brksize, SL_FMT_NUM_HEX);
1060 1060 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1061 1061 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1062 1062 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1063 1063 &layout->pr_stksize, SL_FMT_NUM_HEX);
1064 1064 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1065 1065 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1066 1066 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1067 1067 dump_timestruc);
1068 1068 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1069 1069 dump_timestruc);
1070 1070 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGTRACE), pr_sigtrace,
1071 1071 dump_sigset);
1072 1072 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_FLTTRACE), pr_flttrace,
1073 1073 dump_fltset);
1074 1074 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSENTRY), pr_sysentry,
1075 1075 dump_sysset);
1076 1076 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSEXIT), pr_sysexit,
1077 1077 dump_sysset);
1078 1078
1079 1079 if (data_present(state, &layout->pr_dmodel)) {
1080 1080 w = extract_as_word(state, &layout->pr_dmodel);
1081 1081 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1082 1082 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1083 1083 }
1084 1084
1085 1085 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1086 1086 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1087 1087 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1088 1088 MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid);
1089 1089
1090 1090 /*
1091 1091 * In order to line up all the values in a single column,
1092 1092 * we would have to set vcol to a very high value, which results
1093 1093 * in ugly looking output that runs off column 80. So, we use
1094 1094 * two levels of vcol, one for the contents so far, and a
1095 1095 * higher one for the pr_lwp sub-struct.
1096 1096 */
1097 1097 state->ns_vcol += 5;
1098 1098 state->ns_t2col += 5;
1099 1099 state->ns_v2col += 5;
1100 1100 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpstatus);
1101 1101 state->ns_vcol -= 5;
1102 1102 state->ns_t2col -= 5;
1103 1103 state->ns_v2col -= 5;
1104 1104
1105 1105 indent_exit(state);
1106 1106 }
1107 1107
1108 1108
1109 1109 /*
1110 1110 * Output information from prstatus_t (<sys/old_procfs.h>) structure.
1111 1111 */
1112 1112 static void
1113 1113 dump_prstatus(note_state_t *state, const char *title)
1114 1114 {
1115 1115 const sl_prstatus_layout_t *layout = state->ns_arch->prstatus;
1116 1116 Word w, w2;
1117 1117 int i;
1118 1118 union {
1119 1119 Conv_inv_buf_t inv;
1120 1120 Conv_cnote_old_pr_flags_buf_t flags;
1121 1121 } conv_buf;
1122 1122
1123 1123 indent_enter(state, title, &layout->pr_flags);
1124 1124
↓ open down ↓ |
179 lines elided |
↑ open up ↑ |
1125 1125 if (data_present(state, &layout->pr_flags)) {
1126 1126 w = extract_as_word(state, &layout->pr_flags);
1127 1127 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1128 1128 conv_cnote_old_pr_flags(w, 0, &conv_buf.flags));
1129 1129 }
1130 1130
1131 1131 if (data_present(state, &layout->pr_why)) {
1132 1132 w = extract_as_word(state, &layout->pr_why);
1133 1133 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
1134 1134 conv_cnote_pr_why(w, 0, &conv_buf.inv));
1135 - }
1136 1135
1137 - if (data_present(state, &layout->pr_what)) {
1138 - w2 = extract_as_word(state, &layout->pr_what);
1139 - print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
1140 - conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
1136 +
1137 + if (data_present(state, &layout->pr_what)) {
1138 + w2 = extract_as_word(state, &layout->pr_what);
1139 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
1140 + conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
1141 + }
1141 1142 }
1142 1143
1143 1144 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
1144 1145
1145 1146 if (data_present(state, &layout->pr_cursig)) {
1146 1147 w = extract_as_word(state, &layout->pr_cursig);
1147 1148 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
1148 1149 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1149 1150 }
1150 1151
1151 1152 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1152 1153 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1153 1154 dump_sigset);
1154 1155 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGHOLD), pr_sighold,
1155 1156 dump_sigset);
1156 1157 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
1157 1158 dump_stack);
1158 1159 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
1159 1160 dump_sigaction);
1160 1161 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1161 1162 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1162 1163 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1163 1164 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1164 1165 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1165 1166 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1166 1167 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1167 1168 dump_timestruc);
1168 1169 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1169 1170 dump_timestruc);
1170 1171 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1171 1172
1172 1173 if (data_present(state, &layout->pr_syscall)) {
1173 1174 w = extract_as_word(state, &layout->pr_syscall);
1174 1175 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1175 1176 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1176 1177 }
1177 1178
1178 1179 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
1179 1180
1180 1181 if (data_present(state, &layout->pr_nsysarg)) {
1181 1182 w2 = extract_as_word(state, &layout->pr_nsysarg);
1182 1183 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
1183 1184 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
1184 1185 }
1185 1186
1186 1187 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_WHO), pr_who);
1187 1188 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_sigpend,
1188 1189 dump_sigset);
1189 1190 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
1190 1191 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1191 1192 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1192 1193 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1193 1194 &layout->pr_brksize, SL_FMT_NUM_HEX);
1194 1195 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1195 1196 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1196 1197 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1197 1198 &layout->pr_stksize, SL_FMT_NUM_HEX);
1198 1199 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
1199 1200
1200 1201 if (data_present(state, &layout->pr_bind)) {
1201 1202 i = extract_as_sword(state, &layout->pr_bind);
1202 1203 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BIND),
1203 1204 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1204 1205 }
1205 1206
1206 1207 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
1207 1208 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1208 1209
1209 1210 indent_exit(state);
1210 1211 }
1211 1212
1212 1213
1213 1214 /*
1214 1215 * Print percent from 16-bit binary fraction [0 .. 1]
1215 1216 * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
1216 1217 *
1217 1218 * Note: This routine was copied from ps(1) and then modified.
1218 1219 */
1219 1220 static const char *
1220 1221 prtpct_value(note_state_t *state, const sl_field_t *fdesc,
1221 1222 sl_fmtbuf_t buf)
1222 1223 {
1223 1224 uint_t value; /* need 32 bits to compute with */
1224 1225
1225 1226 value = extract_as_word(state, fdesc);
1226 1227 value = ((value * 1000) + 0x7000) >> 15; /* [0 .. 1000] */
1227 1228 if (value >= 1000)
1228 1229 value = 999;
1229 1230
1230 1231 (void) snprintf(buf, sizeof (sl_fmtbuf_t),
1231 1232 MSG_ORIG(MSG_CNOTE_FMT_PRTPCT), value / 10, value % 10);
1232 1233
1233 1234 return (buf);
1234 1235 }
1235 1236
1236 1237
1237 1238
1238 1239 /*
1239 1240 * Version of prtpct() used for a 2-up display of two adjacent percentages.
1240 1241 */
1241 1242 static void
1242 1243 prtpct_2up(note_state_t *state, const sl_field_t *fdesc1,
1243 1244 const char *title1, const sl_field_t *fdesc2, const char *title2)
1244 1245 {
1245 1246 sl_fmtbuf_t buf1, buf2;
1246 1247
1247 1248 if (!(data_present(state, fdesc1) &&
1248 1249 data_present(state, fdesc2)))
1249 1250 return;
1250 1251
1251 1252 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1252 1253 state->ns_vcol - state->ns_indent, title1,
1253 1254 state->ns_t2col - state->ns_vcol,
1254 1255 prtpct_value(state, fdesc1, buf1),
1255 1256 state->ns_v2col - state->ns_t2col, title2,
1256 1257 prtpct_value(state, fdesc2, buf2));
1257 1258 }
1258 1259
1259 1260
1260 1261 /*
1261 1262 * The psinfo_t and prpsinfo_t structs have pr_state and pr_sname
1262 1263 * fields that we wish to print in a 2up format. The pr_state is
1263 1264 * an integer, while pr_sname is a single character.
1264 1265 */
1265 1266 static void
1266 1267 print_state_sname_2up(note_state_t *state,
1267 1268 const sl_field_t *state_fdesc,
1268 1269 const sl_field_t *sname_fdesc)
1269 1270 {
1270 1271 sl_fmtbuf_t buf1, buf2;
1271 1272 int sname;
1272 1273
1273 1274 /*
1274 1275 * If the field slf_offset and extent fall past the end of the
1275 1276 * available data, then return without doing anything. That note
1276 1277 * is from an older core file that doesn't have all the fields
1277 1278 * that we know about.
1278 1279 */
1279 1280 if (!(data_present(state, state_fdesc) &&
1280 1281 data_present(state, sname_fdesc)))
1281 1282 return;
1282 1283
1283 1284 sname = extract_as_sword(state, sname_fdesc);
1284 1285 buf2[0] = sname;
1285 1286 buf2[1] = '\0';
1286 1287
1287 1288 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1288 1289 state->ns_vcol - state->ns_indent, MSG_ORIG(MSG_CNOTE_T_PR_STATE),
1289 1290 state->ns_t2col - state->ns_vcol,
1290 1291 fmt_num(state, state_fdesc, SL_FMT_NUM_DEC, buf1),
1291 1292 state->ns_v2col - state->ns_t2col, MSG_ORIG(MSG_CNOTE_T_PR_SNAME),
1292 1293 buf2);
1293 1294 }
1294 1295
1295 1296 /*
1296 1297 * Output information from lwpsinfo_t structure.
1297 1298 */
1298 1299 static void
1299 1300 dump_lwpsinfo(note_state_t *state, const char *title)
1300 1301 {
1301 1302 const sl_lwpsinfo_layout_t *layout = state->ns_arch->lwpsinfo;
1302 1303 Word w;
1303 1304 int32_t i;
1304 1305 union {
1305 1306 Conv_cnote_proc_flag_buf_t proc_flag;
1306 1307 Conv_inv_buf_t inv;
1307 1308 } conv_buf;
1308 1309
1309 1310 indent_enter(state, title, &layout->pr_flag);
1310 1311
1311 1312 if (data_present(state, &layout->pr_flag)) {
1312 1313 w = extract_as_word(state, &layout->pr_flag);
1313 1314 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1314 1315 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1315 1316 }
1316 1317
1317 1318 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_LWPID), &layout->pr_lwpid,
1318 1319 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1319 1320 SL_FMT_NUM_ZHEX);
1320 1321 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1321 1322
1322 1323 if (data_present(state, &layout->pr_stype)) {
1323 1324 w = extract_as_word(state, &layout->pr_stype);
1324 1325 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_STYPE),
1325 1326 conv_cnote_pr_stype(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1326 1327 }
1327 1328
1328 1329 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1329 1330
1330 1331 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1331 1332
1332 1333 if (data_present(state, &layout->pr_syscall)) {
1333 1334 w = extract_as_word(state, &layout->pr_syscall);
1334 1335 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1335 1336 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1336 1337 }
1337 1338
1338 1339 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri,
1339 1340 MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1340 1341
1341 1342 if (data_present(state, &layout->pr_pri) &&
1342 1343 data_present(state, &layout->pr_pctcpu)) {
1343 1344 sl_fmtbuf_t buf1, buf2;
1344 1345
1345 1346 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1346 1347 state->ns_vcol - state->ns_indent,
1347 1348 MSG_ORIG(MSG_CNOTE_T_PR_PRI),
1348 1349 state->ns_t2col - state->ns_vcol,
1349 1350 fmt_num(state, &layout->pr_pri, SL_FMT_NUM_DEC, buf1),
1350 1351 state->ns_v2col - state->ns_t2col,
1351 1352 MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1352 1353 prtpct_value(state, &layout->pr_pctcpu, buf2));
1353 1354 }
1354 1355
1355 1356 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1356 1357 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1357 1358 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1358 1359 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_NAME), pr_name);
1359 1360 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ONPRO), pr_onpro,
1360 1361 MSG_ORIG(MSG_CNOTE_T_PR_BINDPRO), pr_bindpro);
1361 1362
1362 1363 if (data_present(state, &layout->pr_bindpset)) {
1363 1364 i = extract_as_sword(state, &layout->pr_bindpset);
1364 1365 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BINDPSET),
1365 1366 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1366 1367 }
1367 1368
1368 1369 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LGRP), pr_lgrp);
1369 1370
1370 1371 indent_exit(state);
1371 1372 }
1372 1373
1373 1374
1374 1375 /*
1375 1376 * Output information from psinfo_t structure.
1376 1377 */
1377 1378 static void
1378 1379 dump_psinfo(note_state_t *state, const char *title)
1379 1380 {
1380 1381 const sl_psinfo_layout_t *layout = state->ns_arch->psinfo;
1381 1382 Word w;
1382 1383 union {
1383 1384 Conv_cnote_proc_flag_buf_t proc_flag;
1384 1385 Conv_inv_buf_t inv;
1385 1386 } conv_buf;
1386 1387
1387 1388 indent_enter(state, title, &layout->pr_flag);
1388 1389
1389 1390 if (data_present(state, &layout->pr_flag)) {
1390 1391 w = extract_as_word(state, &layout->pr_flag);
1391 1392 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1392 1393 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1393 1394 }
1394 1395
1395 1396 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1396 1397 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1397 1398 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1398 1399 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1399 1400 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1400 1401 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1401 1402 MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid);
1402 1403 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid,
1403 1404 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1404 1405 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1405 1406 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1406 1407 SL_FMT_NUM_HEX);
1407 1408 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE),
1408 1409 &layout->pr_rssize, SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_TTYDEV),
1409 1410 &layout->pr_ttydev, SL_FMT_NUM_DEC);
1410 1411 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1411 1412 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1412 1413 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1413 1414 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1414 1415 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1415 1416 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1416 1417 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1417 1418 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1418 1419 SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1419 1420 SL_FMT_NUM_DEC);
1420 1421 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ARGV), pr_argv,
1421 1422 MSG_ORIG(MSG_CNOTE_T_PR_ENVP), pr_envp);
1422 1423
1423 1424 if (data_present(state, &layout->pr_dmodel)) {
1424 1425 w = extract_as_word(state, &layout->pr_dmodel);
1425 1426 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1426 1427 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1427 1428 }
1428 1429
1429 1430 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1430 1431 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1431 1432 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1432 1433 MSG_ORIG(MSG_CNOTE_T_PR_POOLID), pr_poolid);
1433 1434 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid,
1434 1435 MSG_ORIG(MSG_CNOTE_T_PR_CONTRACT), pr_contract);
1435 1436
1436 1437 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpsinfo);
1437 1438
1438 1439 indent_exit(state);
1439 1440 }
1440 1441
1441 1442 /*
1442 1443 * Output information from prpsinfo_t structure.
1443 1444 */
1444 1445 static void
1445 1446 dump_prpsinfo(note_state_t *state, const char *title)
1446 1447 {
1447 1448 const sl_prpsinfo_layout_t *layout = state->ns_arch->prpsinfo;
1448 1449 Word w;
1449 1450 union {
1450 1451 Conv_cnote_proc_flag_buf_t proc_flag;
1451 1452 Conv_inv_buf_t inv;
1452 1453 } conv_buf;
1453 1454
1454 1455 indent_enter(state, title, &layout->pr_state);
1455 1456
1456 1457 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1457 1458 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZOMB), pr_zomb,
1458 1459 MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1459 1460
1460 1461 if (data_present(state, &layout->pr_flag)) {
1461 1462 w = extract_as_word(state, &layout->pr_flag);
1462 1463 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1463 1464 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1464 1465 }
1465 1466
1466 1467
1467 1468 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1468 1469 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1469 1470 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1470 1471 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1471 1472 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1472 1473 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1473 1474 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1474 1475 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1475 1476 SL_FMT_NUM_HEX);
1476 1477 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE), pr_rssize,
1477 1478 MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1478 1479 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1479 1480 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1480 1481 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PRI), pr_pri,
1481 1482 MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri);
1482 1483 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1483 1484 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OTTYDEV), pr_ottydev,
1484 1485 MSG_ORIG(MSG_CNOTE_T_PR_LTTYDEV), pr_lttydev);
1485 1486 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1486 1487 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1487 1488 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1488 1489
1489 1490 if (data_present(state, &layout->pr_syscall)) {
1490 1491 w = extract_as_word(state, &layout->pr_syscall);
1491 1492 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1492 1493 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1493 1494 }
1494 1495
1495 1496 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1496 1497 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_BYSIZE), pr_bysize,
1497 1498 MSG_ORIG(MSG_CNOTE_T_PR_BYRSSIZE), pr_byrssize);
1498 1499 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1499 1500 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ARGV), &layout->pr_argv,
1500 1501 SL_FMT_NUM_ZHEX);
1501 1502 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ENVP), &layout->pr_envp,
1502 1503 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1503 1504 SL_FMT_NUM_HEX);
1504 1505 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1505 1506 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1506 1507 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1507 1508 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1508 1509 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid);
1509 1510
1510 1511 if (data_present(state, &layout->pr_dmodel)) {
1511 1512 w = extract_as_word(state, &layout->pr_dmodel);
1512 1513 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1513 1514 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1514 1515 }
1515 1516
1516 1517 indent_exit(state);
1517 1518 }
1518 1519
1519 1520
1520 1521 /*
1521 1522 * Output information from prcred_t structure.
1522 1523 */
1523 1524 static void
1524 1525 dump_prcred(note_state_t *state, const char *title)
1525 1526 {
1526 1527 const sl_prcred_layout_t *layout = state->ns_arch->prcred;
1527 1528 Word ngroups;
1528 1529
1529 1530 indent_enter(state, title, &layout->pr_euid);
1530 1531
1531 1532 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1532 1533 MSG_ORIG(MSG_CNOTE_T_PR_RUID), pr_ruid);
1533 1534 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SUID), pr_suid,
1534 1535 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1535 1536 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RGID), pr_rgid,
1536 1537 MSG_ORIG(MSG_CNOTE_T_PR_SGID), pr_sgid);
1537 1538 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NGROUPS), pr_ngroups);
1538 1539
1539 1540 if (data_present(state, &layout->pr_ngroups)) {
1540 1541 ngroups = extract_as_word(state, &layout->pr_ngroups);
1541 1542 print_array(state, &layout->pr_groups, SL_FMT_NUM_DEC, ngroups,
1542 1543 0, MSG_ORIG(MSG_CNOTE_T_PR_GROUPS));
1543 1544 }
1544 1545
1545 1546 indent_exit(state);
1546 1547 }
1547 1548
1548 1549
1549 1550 /*
1550 1551 * Output information from prpriv_t structure.
1551 1552 */
1552 1553 static void
1553 1554 dump_prpriv(note_state_t *state, const char *title)
1554 1555 {
1555 1556 const sl_prpriv_layout_t *layout = state->ns_arch->prpriv;
1556 1557 Word nsets;
1557 1558
1558 1559 indent_enter(state, title, &layout->pr_nsets);
1559 1560
1560 1561 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSETS), pr_nsets);
1561 1562 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_SETSIZE), pr_setsize);
1562 1563 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_INFOSIZE), pr_infosize);
1563 1564
1564 1565 if (data_present(state, &layout->pr_nsets)) {
1565 1566 nsets = extract_as_word(state, &layout->pr_nsets);
1566 1567 print_array(state, &layout->pr_sets, SL_FMT_NUM_ZHEX, nsets,
1567 1568 0, MSG_ORIG(MSG_CNOTE_T_PR_SETS));
1568 1569 }
1569 1570
1570 1571 indent_exit(state);
1571 1572 }
1572 1573
1573 1574 static void
1574 1575 dump_prfdinfo(note_state_t *state, const char *title)
1575 1576 {
1576 1577 const sl_prfdinfo_layout_t *layout = state->ns_arch->prfdinfo;
1577 1578 char buf[1024];
1578 1579 uint32_t fileflags, mode;
1579 1580
1580 1581 indent_enter(state, title, &layout->pr_fd);
1581 1582
1582 1583 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FD), pr_fd);
1583 1584 mode = extract_as_word(state, &layout->pr_mode);
1584 1585
1585 1586 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_MODE),
1586 1587 conv_cnote_filemode(mode, 0, buf, sizeof (buf)));
1587 1588
1588 1589 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1589 1590 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1590 1591
1591 1592 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_MAJOR), pr_major,
1592 1593 MSG_ORIG(MSG_CNOTE_T_PR_MINOR), pr_minor);
1593 1594 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RMAJOR), pr_rmajor,
1594 1595 MSG_ORIG(MSG_CNOTE_T_PR_RMINOR), pr_rminor);
1595 1596
1596 1597 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_INO), pr_ino);
1597 1598
1598 1599 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SIZE), pr_size,
1599 1600 MSG_ORIG(MSG_CNOTE_T_PR_OFFSET), pr_offset);
1600 1601
1601 1602 fileflags = extract_as_word(state, &layout->pr_fileflags);
1602 1603
1603 1604 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FILEFLAGS),
1604 1605 conv_cnote_fileflags(fileflags, 0, buf, sizeof (buf)));
1605 1606
1606 1607 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FDFLAGS), pr_fdflags);
1607 1608
1608 1609 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PATH), pr_path);
1609 1610
1610 1611 indent_exit(state);
1611 1612 }
1612 1613
1613 1614 /*
1614 1615 * Output information from priv_impl_info_t structure.
1615 1616 */
1616 1617 static void
1617 1618 dump_priv_impl_info(note_state_t *state, const char *title)
1618 1619 {
1619 1620 const sl_priv_impl_info_layout_t *layout;
1620 1621
1621 1622 layout = state->ns_arch->priv_impl_info;
1622 1623 indent_enter(state, title, &layout->priv_headersize);
1623 1624
1624 1625 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PRIV_HEADERSIZE), priv_headersize,
1625 1626 MSG_ORIG(MSG_CNOTE_T_PRIV_FLAGS), priv_flags);
1626 1627
1627 1628 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_NSETS),
1628 1629 &layout->priv_nsets, SL_FMT_NUM_DEC,
1629 1630 MSG_ORIG(MSG_CNOTE_T_PRIV_SETSIZE), &layout->priv_setsize,
1630 1631 SL_FMT_NUM_HEX);
1631 1632 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_MAX), &layout->priv_max,
1632 1633 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PRIV_INFOSIZE),
1633 1634 &layout->priv_infosize, SL_FMT_NUM_HEX);
1634 1635 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PRIV_GLOBALINFOSIZE),
1635 1636 priv_globalinfosize);
1636 1637
1637 1638 indent_exit(state);
1638 1639 }
1639 1640
1640 1641
1641 1642 /*
1642 1643 * Dump information from an asrset_t array. This data
1643 1644 * structure is specific to sparcv9, and does not appear
1644 1645 * on any other platform.
1645 1646 *
1646 1647 * asrset_t is a simple array, defined in <sys/regset.h> as
1647 1648 * typedef int64_t asrset_t[16]; %asr16 - > %asr31
1648 1649 *
1649 1650 * As such, we do not make use of the struct_layout facilities
1650 1651 * for this routine.
1651 1652 */
1652 1653 static void
1653 1654 dump_asrset(note_state_t *state, const char *title)
1654 1655 {
1655 1656 static const sl_field_t ftemplate = { 0, sizeof (int64_t), 16, 0 };
1656 1657 sl_field_t fdesc1, fdesc2;
1657 1658 sl_fmtbuf_t buf1, buf2;
1658 1659 char index1[MAXNDXSIZE * 2], index2[MAXNDXSIZE * 2];
1659 1660 Word w, nelts;
1660 1661
1661 1662 fdesc1 = fdesc2 = ftemplate;
1662 1663
1663 1664 /* We expect 16 values, but will print whatever is actually there */
1664 1665 nelts = state->ns_len / ftemplate.slf_eltlen;
1665 1666 if (nelts == 0)
1666 1667 return;
1667 1668
1668 1669 indent_enter(state, title, &fdesc1);
1669 1670
1670 1671 for (w = 0; w < nelts; ) {
1671 1672 (void) snprintf(index1, sizeof (index1),
1672 1673 MSG_ORIG(MSG_FMT_ASRINDEX), w + 16);
1673 1674
1674 1675 if (w == (nelts - 1)) {
1675 1676 /* One last register is left */
1676 1677 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
1677 1678 INDENT, state->ns_vcol - state->ns_indent, index1,
1678 1679 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
1679 1680 fdesc1.slf_offset += fdesc1.slf_eltlen;
1680 1681 w++;
1681 1682 continue;
1682 1683 }
1683 1684
1684 1685 /* There are at least 2 more registers left. Show 2 up */
1685 1686 (void) snprintf(index2, sizeof (index2),
1686 1687 MSG_ORIG(MSG_FMT_ASRINDEX), w + 17);
1687 1688
1688 1689 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
1689 1690 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1690 1691 state->ns_vcol - state->ns_indent, index1,
1691 1692 state->ns_t2col - state->ns_vcol,
1692 1693 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
1693 1694 state->ns_v2col - state->ns_t2col, index2,
1694 1695 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
1695 1696 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
1696 1697 w += 2;
1697 1698 }
1698 1699
1699 1700 indent_exit(state);
1700 1701 }
1701 1702
1702 1703 corenote_ret_t
1703 1704 corenote(Half mach, int do_swap, Word type,
1704 1705 const char *desc, Word descsz)
1705 1706 {
1706 1707 note_state_t state;
1707 1708
1708 1709 /*
1709 1710 * Get the per-architecture layout definition
1710 1711 */
1711 1712 state.ns_mach = mach;
1712 1713 state.ns_arch = sl_mach(state.ns_mach);
1713 1714 if (sl_mach(state.ns_mach) == NULL)
1714 1715 return (CORENOTE_R_BADARCH);
1715 1716
1716 1717 state.ns_swap = do_swap;
1717 1718 state.ns_indent = 4;
1718 1719 state.ns_t2col = state.ns_v2col = 0;
1719 1720 state.ns_data = desc;
1720 1721 state.ns_len = descsz;
1721 1722
1722 1723 switch (type) {
1723 1724 case NT_PRSTATUS: /* prstatus_t <sys/old_procfs.h> */
1724 1725 state.ns_vcol = 26;
1725 1726 state.ns_t2col = 46;
1726 1727 state.ns_v2col = 60;
1727 1728 dump_prstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSTATUS_T));
1728 1729 return (CORENOTE_R_OK);
1729 1730
1730 1731 case NT_PRFPREG: /* prfpregset_t <sys/procfs_isa.h> */
1731 1732 return (CORENOTE_R_OK_DUMP);
1732 1733
1733 1734 case NT_PRPSINFO: /* prpsinfo_t <sys/old_procfs.h> */
1734 1735 state.ns_vcol = 20;
1735 1736 state.ns_t2col = 41;
1736 1737 state.ns_v2col = 54;
1737 1738 dump_prpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPSINFO_T));
1738 1739 return (CORENOTE_R_OK);
1739 1740
1740 1741 case NT_PRXREG: /* prxregset_t <sys/procfs_isa.h> */
1741 1742 return (CORENOTE_R_OK_DUMP);
1742 1743
1743 1744 case NT_PLATFORM: /* string from sysinfo(SI_PLATFORM) */
1744 1745 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1745 1746 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1746 1747 return (CORENOTE_R_OK);
1747 1748
1748 1749 case NT_AUXV: /* auxv_t array <sys/auxv.h> */
1749 1750 state.ns_vcol = 18;
1750 1751 dump_auxv(&state, MSG_ORIG(MSG_CNOTE_DESC_AUXV_T));
1751 1752 return (CORENOTE_R_OK);
1752 1753
1753 1754 case NT_GWINDOWS: /* gwindows_t SPARC only */
1754 1755 return (CORENOTE_R_OK_DUMP);
1755 1756
1756 1757 case NT_ASRS: /* asrset_t <sys/regset> sparcv9 only */
1757 1758 state.ns_vcol = 18;
1758 1759 state.ns_t2col = 38;
1759 1760 state.ns_v2col = 46;
1760 1761 dump_asrset(&state, MSG_ORIG(MSG_CNOTE_DESC_ASRSET_T));
1761 1762 return (CORENOTE_R_OK);
1762 1763
1763 1764 case NT_LDT: /* ssd array <sys/sysi86.h> IA32 only */
1764 1765 return (CORENOTE_R_OK_DUMP);
1765 1766
1766 1767 case NT_PSTATUS: /* pstatus_t <sys/procfs.h> */
1767 1768 state.ns_vcol = 22;
1768 1769 state.ns_t2col = 42;
1769 1770 state.ns_v2col = 54;
1770 1771 dump_pstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PSTATUS_T));
1771 1772 return (CORENOTE_R_OK);
1772 1773
1773 1774 case NT_PSINFO: /* psinfo_t <sys/procfs.h> */
1774 1775 state.ns_vcol = 25;
1775 1776 state.ns_t2col = 45;
1776 1777 state.ns_v2col = 58;
1777 1778 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1778 1779 return (CORENOTE_R_OK);
1779 1780
1780 1781 case NT_PRCRED: /* prcred_t <sys/procfs.h> */
1781 1782 state.ns_vcol = 20;
1782 1783 state.ns_t2col = 34;
1783 1784 state.ns_v2col = 44;
1784 1785 dump_prcred(&state, MSG_ORIG(MSG_CNOTE_DESC_PRCRED_T));
1785 1786 return (CORENOTE_R_OK);
1786 1787
1787 1788 case NT_UTSNAME: /* struct utsname <sys/utsname.h> */
1788 1789 state.ns_vcol = 18;
1789 1790 dump_utsname(&state, MSG_ORIG(MSG_CNOTE_DESC_STRUCT_UTSNAME));
1790 1791 return (CORENOTE_R_OK);
1791 1792
1792 1793 case NT_LWPSTATUS: /* lwpstatus_t <sys/procfs.h> */
1793 1794 state.ns_vcol = 24;
1794 1795 state.ns_t2col = 44;
1795 1796 state.ns_v2col = 54;
1796 1797 dump_lwpstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSTATUS_T));
1797 1798 return (CORENOTE_R_OK);
1798 1799
1799 1800 case NT_LWPSINFO: /* lwpsinfo_t <sys/procfs.h> */
1800 1801 state.ns_vcol = 22;
1801 1802 state.ns_t2col = 42;
1802 1803 state.ns_v2col = 54;
1803 1804 dump_lwpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSINFO_T));
1804 1805 return (CORENOTE_R_OK);
1805 1806
1806 1807 case NT_PRPRIV: /* prpriv_t <sys/procfs.h> */
1807 1808 state.ns_vcol = 21;
1808 1809 state.ns_t2col = 34;
1809 1810 state.ns_v2col = 38;
1810 1811 dump_prpriv(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPRIV_T));
1811 1812 return (CORENOTE_R_OK);
1812 1813
1813 1814 case NT_PRPRIVINFO: /* priv_impl_info_t <sys/priv.h> */
1814 1815 state.ns_vcol = 29;
1815 1816 state.ns_t2col = 41;
1816 1817 state.ns_v2col = 56;
1817 1818 dump_priv_impl_info(&state,
1818 1819 MSG_ORIG(MSG_CNOTE_DESC_PRIV_IMPL_INFO_T));
1819 1820 return (CORENOTE_R_OK);
1820 1821
1821 1822 case NT_CONTENT: /* core_content_t <sys/corectl.h> */
1822 1823 if (sizeof (core_content_t) > descsz)
1823 1824 return (CORENOTE_R_BADDATA);
1824 1825 {
1825 1826 static sl_field_t fdesc = { 0, 8, 0, 0 };
1826 1827 Conv_cnote_cc_content_buf_t conv_buf;
1827 1828 core_content_t content;
1828 1829
1829 1830 state.ns_vcol = 8;
1830 1831 indent_enter(&state,
1831 1832 MSG_ORIG(MSG_CNOTE_DESC_CORE_CONTENT_T),
1832 1833 &fdesc);
1833 1834 content = extract_as_lword(&state, &fdesc);
1834 1835 print_str(&state, MSG_ORIG(MSG_STR_EMPTY),
1835 1836 conv_cnote_cc_content(content, 0, &conv_buf));
1836 1837 indent_exit(&state);
1837 1838 }
1838 1839 return (CORENOTE_R_OK);
1839 1840
1840 1841 case NT_ZONENAME: /* string from getzonenamebyid(3C) */
1841 1842 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1842 1843 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1843 1844 return (CORENOTE_R_OK);
1844 1845
1845 1846
1846 1847 case NT_FDINFO:
1847 1848 state.ns_vcol = 22;
1848 1849 state.ns_t2col = 41;
1849 1850 state.ns_v2col = 54;
1850 1851 dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
1851 1852 return (CORENOTE_R_OK);
1852 1853
1853 1854 case NT_SPYMASTER:
1854 1855 state.ns_vcol = 25;
1855 1856 state.ns_t2col = 45;
1856 1857 state.ns_v2col = 58;
1857 1858 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1858 1859 return (CORENOTE_R_OK);
1859 1860 }
1860 1861
1861 1862 return (CORENOTE_R_BADTYPE);
1862 1863 }
↓ open down ↓ |
712 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX