Solaris Modular Debugger Guide

Files, Processes, and Threads

This section describes dcmds and walkers used to format and examine various fundamental file, process, and thread structures in the Solaris kernel.

dcmds

process ::fd fd-num

Print the file_t address corresponding to the file descriptor fd-num associated with the specified process. The process is specified using the virtual address of its proc_t structure.

thread ::findstack [ command ]

Print the stack trace associated with the given kernel thread, identified by the virtual address of its kthread_t structure. The dcmd employs several different algorithms to locate the appropriate stack backtrace. If an optional command string is specified, the dot variable is reset to the frame pointer address of the topmost stack frame, and the specified command is evaluated as if it had been typed at the command line. The default command string is "<.$C0"; that is, print a stack trace including frame pointers but no arguments.

pid ::pid2proc

Print the proc_t address corresponding to the specified PID. Recall that MDB's default base is hexadecimal, so decimal PIDs obtained using pgrep(1) or ps(1) should be prefixed with 0t.

process ::pmap

Print the memory map of the process indicated by the given process address. The dcmd displays output using a format similar to pmap(1).

[ process ] ::ps [-flt]

Print a summary of the information related to the specified process, or all active system processes, similar to ps(1). If the -f option is specified, the full command name and initial arguments are printed. If the -l option is specified, the LWPs associated with each process are printed. If the -t option is specified, the kernel threads associated with each process LWP are printed.

::ptree

Print a process tree, with child processes indented from their respective parent processes. The dcmd displays output using a format similar to ptree(1).

vnode ::whereopen

Given a vnode_t address, print the proc_t addresses of all processes that have this vnode currently open in their file table.

Walkers

file

Given the address of a proc_t structure as a starting point, iterate over the set of open files (file_t structures) associated with the specified process. The file_t structure is defined in <sys/file.h>.

proc

Iterate over the active process (proc_t) structures. This structure is defined in <sys/proc.h>.

thread

Iterate over a set of kernel thread (kthread_t) structures. If the global walk is invoked, all kernel threads are returned by the walker. If a local walk is invoked using a proc_t address as the starting point, the set of threads associated with the specified process is returned. The kthread_t structure is defined in <sys/thread.h>.