crash utility help page:  tree


NAME
  tree - display radix tree or red-black tree

SYNOPSIS
  tree -t [radix|rbtree] [-r offset] [-s struct[.member[,member]] -[x|d]]
          [-o offset] [-p] [-N] start

DESCRIPTION
  This command dumps the contents of a radix tree or a red-black tree.
  The arguments are as follows:

    -t type  The type of tree to dump; the type string can be either 
             "radix" or "rbtree", although only the first two characters
             are required.
  -r offset  If the "start" argument is the address of a data structure that
             contains the radix_tree_root or rb_root structure, then this is
             the offset to that structure member.  If the offset is non-zero,
             then this option is required.  The offset may be entered in either
             of two manners:
               1. In "structure.member" format.
               2. A number of bytes.
  -o offset  For red-black trees only, the offset of the rb_node within its 
             containing data structure; if the offset is non-zero, then this
             option is required.  The offset may be entered in either of two
             manners:
               1. In "structure.member" format.
               2. A number of bytes.
             This option is not applicable to radix trees.
  -s struct  For each entry in a tree, format and print it as this type of data
             structure; use the "struct.member" format in order to display a
             particular member of the structure.  To display multiple members
             of a structure, use a comma-separated list of members.
         -x  Override default output format with hexadecimal format.
         -d  Override default output format with decimal format.
         -p  Display the node's position information, showing the relationship
             between it and the root.  For red-black trees, a position that
             indicates "root/l/r" means that the node is the right child
             of the left child of the root node.  For radix trees, the height
             and slot index values are shown with respect to the root.
 
  The meaning of the "start" argument, which can be expressed either in
  hexadecimal format or symbolically, depends upon whether the -N option
  is prepended:
 
      start  The address of a radix_tree_root or rb_root structure, or the
             address of a structure containing the radix_tree_root or rb_root
             structure; if the latter, then the "-r offset" option must be
             used if the member offset of the root structure is non-zero.
               
   -N start  The address of the structure radix_tree_node or rb_node, bypassing
             the radix_tree_root or rb_root that points to it.


EXAMPLES
  The vmap_area_root is a standalone rb_root structure.  Display the 
  virtual addresses of each vmap_area in its red-black tree:

    crash> whatis vmap_area_root
    struct rb_root vmap_area_root;
    crash> tree -t rbtree -o vmap_area.rb_node vmap_area_root
    ffff880128c508c0
    ffff88012cb68140
    ffff88012c9afec0
    ffff88012d65c440
    ...

  Display the vmap_area's va_start and va_end members of each of
  the entries above expressing the vmap_area.rb_node offset as a
  number of bytes:

    crash> tree -t rbtree -o 24 vmap_area_root -s vmap_area.va_start,va_end
    ffff880128c508c0
      va_start = 0xffffc90014900000
      va_end = 0xffffc90014921000
    ffff88012cb68140
      va_start = 0xffffc900110c0000
      va_end = 0xffffc900110d1000
    ffff88012c9afec0
      va_start = 0xffffc90000640000
      va_end = 0xffffc90000642000
    ffff88012d65c440
      va_start = 0xffffc90000620000
      va_end = 0xffffc90000622000
    ...

  Alternatively, use the -N option with the rb_node address contained
  in the vmap_area_root structure:

    crash> p vmap_area_root
    vmap_area_root = $8 = {
      rb_node = 0xffff880128c508d8
    }
    crash> tree -t rbtree -o vmap_area.rb_node -N 0xffff880128c508d8
    ffff880128c508c0
    ffff88012cb68140
    ffff88012c9afec0
    ffff88012d65c440
 
  Display the virtual address of each vm_area_struct in the red-black
  tree that has its root inside an mm_struct located at ffff880128b5a300.
  The vm_area_struct.vm_rb rb_node member has an offset of 0x38 bytes:

    crash> tree -t rbtree -r mm_struct.mm_rb ffff880128b5a300 -o 0x38
    ffff88012a0de080
    ffff880123e3ac78
    ffff880123e3a700
    ffff88012b2837c8
    ...
    ffff880128c02ed0
    ffff8801292e7958
    ffff880123e3a318
    ffff880123e3ad40
 
  Add the -p option to the command above to show position information:

    crash> tree -t rbtree -r mm_struct.mm_rb ffff880128b5a300 -o 0x38 -p
    ffff88012a0de080
      position: root
    ffff880123e3ac78
      position: root/l
    ffff880123e3a700
      position: root/l/l
    ffff88012b2837c8
      position: root/l/l/l
    ...
    ffff880128c02ed0
      position: root/r/r/l/r
    ffff8801292e7958
      position: root/r/r/l/r/r
    ffff880123e3a318
      position: root/r/r/r
    ffff880123e3ad40
      position: root/r/r/r/r

  Display a list of the page structs in the radix tree of an address_space
  structure located at ffff88012d364de0:

    crash> tree -t radix -r address_space.page_tree ffff88012d364de0
    ffffea00040d12c0
    ffffea00040d9a60
    ffffea00040d9b08
    ffffea000407eda8
    ffffea0004084288
    ...
    ffffea000407bc70
    ffffea00040baf48
    ffffea0004043f48
    ffffea000407de58
 
  Add the -p option to the command above to show position information:

    crash> tree -t radix -r address_space.page_tree ffff88012d364de0 -p
    ffffea00040d12c0
      position: root/0/0
    ffffea00040d9a60
      position: root/0/1
    ffffea00040d9b08
      position: root/0/2
    ffffea000407eda8
      position: root/0/3
    ffffea0004084288
      position: root/0/4
    ...
    ffffea000407bc70
      position: root/3/25
    ffffea00040baf48
      position: root/3/26
    ffffea0004043f48
      position: root/3/27
    ffffea000407de58
      position: root/3/28

  Alternatively, take the address of the radix_tree_node from the
  radix_tree_root structure in the address_space structure above,
  and display the tree with the -N option:

    crash> struct address_space.page_tree ffff88012d364de0
      page_tree = {
        height = 0x2, 
        gfp_mask = 0x20, 
        rnode = 0xffff8801238add71
      }
    crash> tree -t radix -N 0xffff8801238add71
    ffffea00040d12c0
    ffffea00040d9a60
    ffffea00040d9b08
    ffffea000407eda8
    ffffea0004084288
    ffffea00040843a0
    ...
 
  Using the same radix tree as above, display the flags and _count
  members of each page struct in the list, and force the output format
  to be hexadecimal:

    crash> tree -t radix -N 0xffff8801238add71 -s page.flags,_count -x
    ffffea00040d12c0
      flags = 0x4000000002006c
      _count = {
        counter = 0x7
      }
    ffffea00040d9a60
      flags = 0x4000000002006c
      _count = {
        counter = 0x7
      }
    ffffea00040d9b08
      flags = 0x4000000002006c
      _count = {
        counter = 0x7
      }
    ffffea000407eda8
      flags = 0x4000000002006c
      _count = {
        counter = 0x7
      }
    ...