White Paper: Red Hat Crash Utility


Contents

help page:  union


NAME
  union - union contents

SYNOPSIS
  union union_name[.member] [[-o][-l offset][-r] [address | symbol] [count]]

DESCRIPTION
  This command displays either a union definition, or a formatted display
  of the contents of a union at a specified address.  When no address is
  specified, the union definition is shown along with the union size.
  A union member may be appended to the structure name in order to limit
  the scope of the data displayed to that particular member; when no address
  is specified, the member's offset (always 0) and definition are shown.

     union_name  name of a C-code union used by the kernel.
        .member  name of a union member.
             -o  show member offsets when displaying union definitions.
                 (always 0)
      -l offset  if the address argument is a pointer to a list_head structure
                 that is embedded in the target union structure, the offset
                 to the list_head member may be entered in either of the
                 following manners:
                   1. in "structure.member" format.
                   2. a number of bytes. 
             -r  raw dump of union data.
        address  hexadecimal address of a union; if the address points
                 to an embedded list_head structure contained within the
                 target union structure, then the "=l" option must be used.
         symbol  symbolic reference to the address of a union.
          count  count of unions to dump from an array of unions; if used,
                 this must be the last argument entered.

  Union data, sizes, and member offsets are shown in the current output radix.
 
  Please note that in the vast majority of cases, the "union" command
  name may be dropped; if the union name does not conflict with any crash
  or gdb command name, then the "union_name[.member]" argument will be
  recognized as a union name, and this command automatically executed.
  See the NOTE below.

EXAMPLES

  Display the bdflush_param union definition, and then an instance of it:

    crash> union bdflush_param
    union bdflush_param {
        struct {
            int nfract;
            int ndirty;
            int nrefill;
            int nref_dirt;
            int dummy1;
            int age_buffer;
            int age_super;
            int dummy2;
            int dummy3;
        } b_un;
        unsigned int data[9];
    }
    
    SIZE: 36  (0x24)
 
    crash> union bdflush_param bdf_prm
    union bdflush_param {
      b_un = {
        nfract = 40, 
        ndirty = 500, 
        nrefill = 64, 
        nref_dirt = 256, 
        dummy1 = 15, 
        age_buffer = 3000, 
        age_super = 500, 
        dummy2 = 1884, 
        dummy3 = 2
      }, 
      data = {40, 500, 64, 256, 15, 3000, 500, 1884, 2}
    }

NOTE
  If the union name does not conflict with any crash command name, the
  "union" command may be dropped.  Accordingly, the examples above could
  also have been accomplished like so:

    crash> bdflush_param
    crash> bdflush_param bdf_prm
 
  Lastly, the short-cut "*" (pointer-to) command may also be used to negate
  the need to enter the "union" command name (enter "help *" for details).


Contents