Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
7.  Kernel Debugging Modules Generic Kernel Debugging Support (genunix) Virtual Memory Walkers  Previous   Contents   Next 
   
 

CPUs and the Dispatcher

This section describes the facilities for examining the state of the cpu structures and the kernel dispatcher.

dcmds

::callout

Display the callout table. The function, argument, and expiration time for each callout is displayed.

::class

Display the scheduling class table.

[ cpuid ] ::cpuinfo [-v]

Display a table of the threads currently executing on each CPU. If an optional CPU ID number or CPU structure address is specified prior to the dcmd name, only the information for the specified CPU is displayed. If the -v option is present, ::cpuinfo also displays the runnable threads waiting to execute on each CPU as well as the active interrupt threads.

Walkers

cpu

Iterate over the set of kernel CPU structures. The cpu_t structure is defined in <sys/cpuvar.h>.

Device Drivers and DDI Framework

This section describes dcmds and walkers that are useful for kernel developers as well as third-party device driver developers.

dcmds

address ::binding_hash_entry

Given the address of a kernel name-to-major number binding hash table entry (struct bind), display the node binding name, major number, and pointer to the next element.

::devbindings device-name

Display the list of all instances of the named driver. The output consists of an entry for each instance, beginning with the pointer to the struct dev_info (viewable with $<devinfo or ::devinfo), the driver name, the instance number, and the driver and system properties associated with that instance.

address ::devinfo [ -q ]

Print the system and driver properties associated with a devinfo node. If the -q option is specified, only a quick summary of the device node is shown.

address ::devinfo2driver

Print the name of the driver (if any) associated with the devinfo node.

[ address ] ::devnames [ -v ]

Display the kernel's devnames table along with the dn_head pointer, which points at the driver instance list. If the -v flag is specified, additional information stored at each entry in the devnames table is displayed.

[ devinfo ] ::prtconf [ -cpv ]

Display the kernel device tree starting at the device node specified by devinfo. If devinfo is not provided, the root of the device tree is assumed by default. If the -c option is specified, only children of the given device node are displayed. If the -p option is specified, only ancestors of the given device node are displayed. If -v is specified, the properties associated with each node are displayed.

[ major-num ] ::major2name [ major-num ]

Display the driver name corresponding to the specified major number. The major number can be specified as an expression preceding the dcmd or as a command-line argument.

[ address ] ::modctl2devinfo

Print all of the device nodes that correspond to the specified modctl address.

::name2major driver-name

Given a device driver name, display its major number.

[ address ] ::softstate [ instance-number ]

Given a softstate state pointer (see ddi_soft_state_init(9F)) and a device instance number, display the soft state for that instance.

Walkers

binding_hash

Given the address of an array of kernel binding hash table entries (struct bind **), walk all entries in the hash table and return the address of each struct bind.

devinfo

First, iterate over the parents of the given devinfo and return them in order of seniority from most to least senior. Second, return the given devinfo itself. Third, iterate over the children of the given devinfo in order of seniority from most to least senior. The dev_info struct is defined in <sys/ddi_impldefs.h>.

devinfo_children

First, return the given devinfo, then iterate over the children of the given devinfo in order of seniority from most to least senior. The dev_info struct is defined in <sys/ddi_impldefs.h>.

devinfo_parents

Iterate over the parents of the given devinfo in order of seniority from most to least senior, and then return the given devinfo. The dev_info struct is defined in <sys/ddi_impldefs.h>.

devi_next

Iterate over the siblings of the given devinfo. The dev_info struct is defined in <sys/ddi_impldefs.h>.

devnames

Iterate over the entries in the devnames array. This structure is defined in <sys/autoconf.h>.

softstate

Given a softstate pointer (see ddi_soft_state_init(9F)) display all non-NULL pointers to driver state structures.

softstate_all

Given a softstate pointer (see ddi_soft_state_init(9F)) display all pointers to driver state structures. Note that the pointers for unused instances will be NULL.

STREAMS

This section describes dcmds and walkers that are useful for kernel developers as well as developers of third-party STREAMS modules and drivers.

dcmds

address ::mblk2dblk

Given the address of an mblk_t, print the address of the corresponding dblk_t.

[address] ::mblk_verify

Verify the integrity of one or more message blocks. If an explicit message block address is specified, the integrity of this message block is checked. If no address is specified, the integrity of all active message blocks are checked. This dcmd produces output for any invalid message block state that is detected.

address ::queue [-v] [-f flag] [-F flag] [-s syncq]

Filter and display the specified queue_t data structure. With no options, various properties of the queue_t are shown. If the -v option is present, the queue flags are decoded in greater detail. If the -f, -F, or -m options are present, the queue is displayed only if it matches the criteria defined by the arguments to these options; in this way, the dcmd can be used as a filter for input from a pipeline. The -f option indicates that the specified flag (one of the Q flag names from <sys/stream.h>) must be present in the queue flags. The -F option indicates that the specified flag must be absent from the queue flags. The -m option indicates that the module name associated with the queue must match the specified modname. The -s option indicates that the syncq_t associated with the queue must match the specified syncq_t address.

address ::q2syncq

Given the address of a queue_t, print the address of the corresponding syncq_t data structure.

address ::q2otherq

Given the address of a queue_t, print the address of the peer read or write queue structure.

address ::q2rdq

Given the address of a queue_t, print the address of the corresponding read queue.

address ::q2wrq

Given the address of a queue_t, print the address of the corresponding write queue.

[ address ] ::stream

Display a visual picture of a kernel STREAM data structure, given the address of the stdata_t structure representing the STREAM head. The read and write queue pointers, byte count, and flags for each module are shown, and in some cases additional information for the specific queue is shown in the margin.

address ::syncq [-v] [-f flag] [-F flag] [-t type] [-T type]

Filter and display the specified syncq_t data structure. With no options, various properties of the syncq_t are shown. If the -v option is present, the syncq flags are decoded in greater detail. If the -f, -F, -t, or -T options are present, the syncq is displayed only if it matches the criteria defined by the arguments to these options; in this way, the dcmd can be used as a filter for input from a pipeline. The -f option indicates that the specified flag (one of the SQ_ flag names from <sys/strsubr.h>) must be present in the syncq flags. The -F option indicates that the specified flag must be absent from the syncq flags. The -t option indicates that the specified type (one of the SQ_CI or SQ_CO type names from <sys/strsubr.h>) must be present in the syncq type bits. The -T option indicates that the specified type must be absent from the syncq type bits.

address ::syncq2q

Given the address of a syncq_t, print the address of the corresponding queue_t data structure.

Walkers

b_cont

Given the address of an mblk_t, iterate over the set of associated message structures by following the b_cont pointer. The b_cont pointer is used to link a given message block to the next associated message block that is the ontinuation of the same message. The message block is described in more detail in msgb(9S)

b_next

Given the address of an mblk_t, iterate over the set of associated message structures by following the b_next pointer. The b_next pointer is used to link a given message block to the next associated message block on a given queue. The message block is described in more detail in msgb(9S).

qlink

Given the address of a queue_t structure, walk the list of related queues using the q_link pointer. This structure is defined in <sys/stream.h>.

qnext

Given the address of a queue_t structure, walk the list of related queues using the q_next pointer. This structure is defined in <sys/stream.h>.

readq

Given the address of an stdata_t structure, walk the list of read-side queue structures.

writeq

Given the address of an stdata_t structure, walk the list of write-side queue structures.

Networking

The following dcmds and walkers are provided to help debug the core kernel networking stack protocols.

dcmds

address ::mi [-p] [-d | -m]

Given the address of a kernel MI_O, filter and display the MI_O or its payload. If the -p option is specified, then the address of the corresponding payload of the MI_O is displayed, otherwise the MI_O itself is displayed. Specifying filter -d or -m enables the dcmd to filter device or module MI_O objects respectively.

::netstat [-av] [-f inet | inet6 | unix] [-P tcp | udp]

Show network statistics and active connections. If the -a option is present, the state of all sockets is displayed. If the -v option is present, more verbose output is displayed. If the -f option is present, only connections associated with the specified address family are displayed. If the -P option is present, only connections associated with the specified protocols are displayed.

[ address ] ::sonode [-f inet | inet6 | unix | id] [-t stream | dgram | raw | id] [-p id]

Filters and displays sonode objects. If no address is given, then the list of AF_UNIX sockets is displayed, otherwise only the specified sonode is displayed. If the -f option is present, then only sockets of the given family will be output. If the -t option is present, then only sonodes of the given type will be output. If the -p option is present, then only sockets of the given protocol will be displayed.

[ address ] ::tcpb [-av] [-P v4 | v6]

Filters and displays tcpb objects. If no address is specified, all connections are walked, otherwise only the specified tcpb is filtered/displayed. Specifying -a filters for only active connections and -P can be used to filter for TCP IPv4 or IPv6 connections. The tcpb dcmd is intelligent about filtering TCP connections, and if a IPv6 TCP connection is in a state that would still facilitate a IPv4 connection, the -P filter considers the connection as both IPv4 and IPv6 in much the same way that ::netstat does. If the dcmd is not being used as a filter and the -v option is specified, then the output of the dcmd will be verbose.

 
 
 
  Previous   Contents   Next