c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * CDDL HEADER START
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The contents of this file are subject to the terms of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Common Development and Distribution License (the "License").
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * You may not use this file except in compliance with the License.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * See the License for the specific language governing permissions
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and limitations under the License.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * When distributing Covered Code, include this CDDL HEADER in each
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If applicable, add the following below this CDDL HEADER, with the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fields enclosed by brackets "[]" replaced with your own identifying
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * information: Portions Copyright [yyyy] [name of copyright owner]
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * CDDL HEADER END
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Use is subject to license terms.
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
f971a3462face662ae8ef220a18a98354d625d54Bryan Cantrill * Copyright (c) 2013, Joyent, Inc. All rights reserved.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#include <_elfdump.h>
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * This module contains the code that displays data from the note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sections found in Solaris core files. The format of these
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * note sections are described in the core(4) manpage.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Much of the code in this file uses the "%*s" format to set
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the left margin indentation. This macro combines the indent
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * integer argument and the NULL string that follows it.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Indent unit, used for each nesting
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The PRINT_ macros are convenience wrappers on print_num(),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * print_subtype(), and print_strbuf(). They reduce code
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * clutter by hiding the boilerplate arguments.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Assumptions:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * - A variable named "layout" exists in the compilation
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * environment, referencing the layout information for the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * current type.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * - The variable "state" references the current note state.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num(state, _title, &layout->_field, SL_FMT_NUM_DEC)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#define PRINT_DEC_2UP(_title1, _field1, _title2, _field2) \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_DEC, \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num(state, _title, &layout->_field, SL_FMT_NUM_HEX)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#define PRINT_HEX_2UP(_title1, _field1, _title2, _field2) \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_HEX, \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num(state, _title, &layout->_field, SL_FMT_NUM_ZHEX)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#define PRINT_ZHEX_2UP(_title1, _field1, _title2, _field2) \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_ZHEX, \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Structure used to maintain state data for a core note, or a subregion
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * (sub-struct) of a core note. These values would otherwise need to be
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * passed to nearly every routine.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abtypedef struct {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_arch_layout_t *ns_arch; /* structure layout def for mach */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Standard signature for a dump function used to process a note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * or a sub-structure within a note.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abtypedef void (* dump_func_t)(note_state_t *state, const char *title);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Some core notes contain string buffers of fixed size
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that are expected to contain NULL terminated strings.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If the NULL is there, we can print these strings directly.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * However, the potential exists for a corrupt file to have
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * a non-terminated buffer. This routine examines the given
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * string, and if the string is terminated, the string itself
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is returned. Otherwise, it is copied to a static buffer,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and a pointer to the buffer is returned.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic const char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (n == 0)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < n; i++)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (n >= sizeof (buf)) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab *s++ = '.';
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab *s++ = '.';
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab *s++ = '.';
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab *s = '\0';
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Convenience wrappers on top of the corresponding sl_XXX() functions.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abextract_as_word(note_state_t *state, const sl_field_t *fdesc)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (sl_extract_as_word(state->ns_data, state->ns_swap, fdesc));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abextract_as_lword(note_state_t *state, const sl_field_t *fdesc)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (sl_extract_as_lword(state->ns_data, state->ns_swap, fdesc));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abextract_as_sword(note_state_t *state, const sl_field_t *fdesc)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (sl_extract_as_sword(state->ns_data, state->ns_swap, fdesc));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic const char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (sl_fmt_num(state->ns_data, state->ns_swap, fdesc,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Return true of the data for the specified field is available.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abinline static int
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abdata_present(note_state_t *state, const sl_field_t *fdesc)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return ((fdesc->slf_offset + fdesc->slf_eltlen) <= state->ns_len);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * indent_enter/exit are used to start/end output for a subitem.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * On entry, a title is output, and the indentation level is raised
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * by one unit. On exit, the indentation level is restrored to its
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * previous value.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If the first field offset and extent fall past the end of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * available data, then return without printing a title. That note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is from an older core file that doesn't have all the fields
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that we know about.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_TITLE), INDENT, title);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * print_num outputs a field on one line, in the format:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * title: value
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If the field offset and extent fall past the end of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * available data, then return without doing anything. That note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is from an older core file that doesn't have all the fields
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that we know about.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * print_num_2up outputs two fields on one line, in the format:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * title1: value1 title2: value2
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_field_t *fdesc1, sl_fmt_num_t fmt_type1, const char *title2,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If the field offset and extent fall past the end of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * available data, then return without doing anything. That note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is from an older core file that doesn't have all the fields
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that we know about.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * print_strbuf outputs a fixed sized character buffer field
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * on one line, in the format:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * title: value
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If we are past the end of the data area, then return
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * without doing anything. That note is from an older core
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * file that doesn't have all the fields that we know about.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Note that we are willing to accept a partial buffer,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * so we don't use data_present() for this test.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * We expect the full buffer to be present, but if there
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is less than that, we will still proceed. The use of safe_str()
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * protects us from the effect of printing garbage data.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * print_str outputs an arbitrary string value item
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * on one line, in the format:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * title: str
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abprint_str(note_state_t *state, const char *title, const char *str)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Used when one dump function needs to call another dump function
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * in order to display a subitem. This routine constructs a state
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * block for the sub-region, and then calls the dump function with it.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * This limits the amount of data visible to the sub-function to that
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * for the sub-item.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If there is no data for the sub-item, return immediately.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Partial data is left to the dump function to handle,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * as that can be a sign of an older core file with less data,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * which can still be interpreted.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Construct a state block that reflects the sub-item
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output a sequence of array elements, giving each
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * element an index, in the format:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * [ndx] value
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * state - Current state
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * base_desc - Field descriptor for 1st element of array
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * nelts - # of array elements to display
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * check_nelts - If True (1), nelts is clipped to fdesc->slf_nelts.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If False (1), nelts is not clipped.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * title - Name of array
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abprint_array(note_state_t *state, const sl_field_t *base_desc,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab sl_fmt_num_t fmt_type, int nelts, int check_nelts, const char *title)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < nelts; ) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* One final value is left */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* There are at least 2 items left. Show 2 up. */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from auxv_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Immediate indent_exit() restores the indent level to
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that of the title. We include indentation as part of
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the index string, which is right justified, and don't
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * want the usual indentation spacing.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (type) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cap_val_hw1() produces output like:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * 0xfff [ flg1 flg2 0xff]
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * where the first hex value is the complete value,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and the second is the leftover bits. We only
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * want the part in brackets, and failing that,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * would rather fall back to formatting the full
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * value ourselves.
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi w = extract_as_word(state, &layout->a_val);
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * conv_cap_val_hw2() produces output like:
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * 0xfff [ flg1 flg2 0xff]
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * where the first hex value is the complete value,
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * and the second is the leftover bits. We only
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * want the part in brackets, and failing that,
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * would rather fall back to formatting the full
ebb8ac078e9265f87093fbb363e8c2cbc6ee13e6Robert Mustacchi * value ourselves.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_AUXVLINE), INDENT, index,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from fltset_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_fltset_layout_t *layout = state->ns_arch->fltset;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (nelts > NELTS) /* Type has grown? Show what we understand */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < nelts; i++) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_str(state, title, conv_cnote_fltset(mask, nelts, 0, &buf));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from sigset_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_sigset_layout_t *layout = state->ns_arch->sigset;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (nelts > NELTS) /* Type has grown? Show what we understand */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < nelts; i++) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_str(state, title, conv_cnote_sigset(mask, nelts, 0, &buf));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from sigaction structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_sigaction_layout_t *layout = state->ns_arch->sigaction;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_SA_HANDLER), sa_hand,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_SA_MASK), sa_mask, dump_sigset);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from siginfo structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_siginfo_layout_t *layout = state->ns_arch->siginfo;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab v_si_signo = extract_as_sword(state, &layout->f_si_signo);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab conv_cnote_signal(v_si_signo, CONV_FMT_DECIMAL, &inv_buf));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab conv_cnote_si_code(state->ns_mach, v_si_signo, v_si_code,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* User generated signals have (si_code <= 0) */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (v_si_code <= 0) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Remaining cases are kernel generated signals. Output any
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * signal or code specific information.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from stack_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_SS_SP), &layout->ss_sp,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_SS_SIZE), &layout->ss_size,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from sysset_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_sysset_layout_t *layout = state->ns_arch->sysset;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (nelts > NELTS) /* Type has grown? Show what we understand */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < nelts; i++) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_str(state, title, conv_cnote_sysset(mask, nelts, 0, &buf));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from timestruc_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_timestruc_layout_t *layout = state->ns_arch->timestruc;
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Output information from prsecflags_t structure.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowedump_secflags(note_state_t *state, const char *title)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe const sl_prsecflags_layout_t *layout = state->ns_arch->prsecflags;
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe indent_enter(state, title, &layout->pr_version);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe w = extract_as_word(state, &layout->pr_version);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe PRINT_DEC(MSG_INTL(MSG_NOTE_BAD_SECFLAGS_VER), pr_version);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe dump_hex_bytes(state->ns_data, state->ns_len, state->ns_indent,
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_VERSION), pr_version);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe lw = extract_as_lword(state, &layout->pr_effective);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_EFFECTIVE),
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe lw = extract_as_lword(state, &layout->pr_inherit);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_INHERIT),
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe lw = extract_as_lword(state, &layout->pr_lower);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_LOWER),
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe lw = extract_as_lword(state, &layout->pr_upper);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_UPPER),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from utsname structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_utsname_layout_t *layout = state->ns_arch->utsname;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_SYSNAME), sysname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_NODENAME), nodename);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_RELEASE), release);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_VERSION), version);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_MACHINE), machine);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Dump register contents
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
3f3aaf4e95972f6d6393cbff0a4652f4ee2c0dbfRichard Lowe fdesc1 = fdesc2 = state->ns_arch->prgregset->elt0;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* One last register is left */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* There are at least 2 more registers left. Show 2 up */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from lwpstatus_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_lwpstatus_layout_t *layout = state->ns_arch->lwpstatus;
3f3aaf4e95972f6d6393cbff0a4652f4ee2c0dbfRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_lwppend,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPHOLD), pr_lwphold,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TSTAMP), pr_tstamp,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_USTACK), pr_ustack,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * In order to line up all the values in a single column,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * we would have to set vcol to a very high value, which results
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * in ugly looking output that runs off column 80. So, we use
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * two levels of vcol, one for the contents so far, and a
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * higher one for the pr_reg sub-struct.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The floating point register state is complex, and highly
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * platform dependent. For now, we simply display it as
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * a hex dump. This can be replaced if better information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is required.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_hex_bytes(layout->pr_fpreg.slf_offset + state->ns_data,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from pstatus_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_pstatus_layout_t *layout = state->ns_arch->pstatus;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGTRACE), pr_sigtrace,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_FLTTRACE), pr_flttrace,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSENTRY), pr_sysentry,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSEXIT), pr_sysexit,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * In order to line up all the values in a single column,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * we would have to set vcol to a very high value, which results
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * in ugly looking output that runs off column 80. So, we use
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * two levels of vcol, one for the contents so far, and a
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * higher one for the pr_lwp sub-struct.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpstatus);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from prstatus_t (<sys/old_procfs.h>) structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_prstatus_layout_t *layout = state->ns_arch->prstatus;
3f3aaf4e95972f6d6393cbff0a4652f4ee2c0dbfRichard Lowe print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGHOLD), pr_sighold,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_sigpend,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Print percent from 16-bit binary fraction [0 .. 1]
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Note: This routine was copied from ps(1) and then modified.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic const char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abprtpct_value(note_state_t *state, const sl_field_t *fdesc,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab value = ((value * 1000) + 0x7000) >> 15; /* [0 .. 1000] */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Version of prtpct() used for a 2-up display of two adjacent percentages.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const char *title1, const sl_field_t *fdesc2, const char *title2)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The psinfo_t and prpsinfo_t structs have pr_state and pr_sname
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fields that we wish to print in a 2up format. The pr_state is
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * an integer, while pr_sname is a single character.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If the field slf_offset and extent fall past the end of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * available data, then return without doing anything. That note
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * is from an older core file that doesn't have all the fields
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that we know about.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab state->ns_vcol - state->ns_indent, MSG_ORIG(MSG_CNOTE_T_PR_STATE),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab state->ns_v2col - state->ns_t2col, MSG_ORIG(MSG_CNOTE_T_PR_SNAME),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from lwpsinfo_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_lwpsinfo_layout_t *layout = state->ns_arch->lwpsinfo;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_LWPID), &layout->pr_lwpid,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab conv_cnote_pr_stype(w, CONV_FMT_DECIMAL, &conv_buf.inv));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from psinfo_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_psinfo_layout_t *layout = state->ns_arch->psinfo;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab &layout->pr_rssize, SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_TTYDEV),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpsinfo);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from prpsinfo_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_prpsinfo_layout_t *layout = state->ns_arch->prpsinfo;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE), pr_rssize,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OTTYDEV), pr_ottydev,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_BYSIZE), pr_bysize,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ARGV), &layout->pr_argv,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ENVP), &layout->pr_envp,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from prcred_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_prcred_layout_t *layout = state->ns_arch->prcred;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_array(state, &layout->pr_groups, SL_FMT_NUM_DEC, ngroups,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from prpriv_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const sl_prpriv_layout_t *layout = state->ns_arch->prpriv;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_INFOSIZE), pr_infosize);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_array(state, &layout->pr_sets, SL_FMT_NUM_ZHEX, nsets,
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amoredump_prfdinfo(note_state_t *state, const char *title)
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore const sl_prfdinfo_layout_t *layout = state->ns_arch->prfdinfo;
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FD), pr_fd);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore mode = extract_as_word(state, &layout->pr_mode);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_MODE),
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore conv_cnote_filemode(mode, 0, buf, sizeof (buf)));
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_MAJOR), pr_major,
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RMAJOR), pr_rmajor,
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore MSG_ORIG(MSG_CNOTE_T_PR_RMINOR), pr_rminor);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_INO), pr_ino);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SIZE), pr_size,
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore MSG_ORIG(MSG_CNOTE_T_PR_OFFSET), pr_offset);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore fileflags = extract_as_word(state, &layout->pr_fileflags);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FILEFLAGS),
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore conv_cnote_fileflags(fileflags, 0, buf, sizeof (buf)));
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FDFLAGS), pr_fdflags);
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PATH), pr_path);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Output information from priv_impl_info_t structure.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abdump_priv_impl_info(note_state_t *state, const char *title)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PRIV_HEADERSIZE), priv_headersize,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_ORIG(MSG_CNOTE_T_PRIV_SETSIZE), &layout->priv_setsize,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_MAX), &layout->priv_max,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Dump information from an asrset_t array. This data
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * structure is specific to sparcv9, and does not appear
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * on any other platform.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * asrset_t is a simple array, defined in <sys/regset.h> as
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * typedef int64_t asrset_t[16]; %asr16 - > %asr31
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * As such, we do not make use of the struct_layout facilities
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * for this routine.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic void
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab static const sl_field_t ftemplate = { 0, sizeof (int64_t), 16, 0 };
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* We expect 16 values, but will print whatever is actually there */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (w = 0; w < nelts; ) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* One last register is left */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* There are at least 2 more registers left. Show 2 up */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Get the per-architecture layout definition
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (type) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_prstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSTATUS_T));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_prpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPSINFO_T));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_pstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PSTATUS_T));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_utsname(&state, MSG_ORIG(MSG_CNOTE_DESC_STRUCT_UTSNAME));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_lwpstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSTATUS_T));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dump_lwpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSINFO_T));
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
34bdffbf3e3c188027e767e631f717b10159316dGarrett D'Amore dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
f971a3462face662ae8ef220a18a98354d625d54Bryan Cantrill dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));