This section describes changes to debugging tools.
The dbx and dbxtool tools are no longer available with default system software. Enhanced versions of these tools are available as part of Sun WorkShop(TM), an unbundled product.
The adb and kadb tools are available in the Solaris 2.6 operating environment. They offer the same capabilities as the SunOS release 4.x tools. kadb has been enhanced to recognize multiple processors. The processor ID is displayed in the kadb prompt. In the following examples, it is 0.
To make kernel debugging under the Solaris 2.6 operating environment easier:
Enable savecore (uncomment the savecore lines in the /etc/init.d/sysetup file)
Boot under kadb (type $c when the system crashes)
Use adb and crash
The kadb macros described below are particularly useful with the new multithreaded kernel.
thread displays the current thread. The current thread pointer is in SPARC global register g7.
kadb[0]: <g7$<thread |
threadlist shows the stack traces of all the kernel threads in the system. This can be a long list.
kadb[0]: $<threadlist |
mutex shows you the address of the owning thread. The following example uses the global unsafe driver mutex.
kadb[0]: unsafe_driver$<mutex |
kadb[0]: moddebug/W 0x80000000 |
moddebug enables you to watch module loading. See the end of <sys/modctl.h> for legal values for moddebug for debugging purposes only.
Use the following command to debug a live kernel.
# adb -k /dev/ksyms /dev/mem |
/dev/ksyms is a pseudo device that contains the complete name list of the running kernel.
truss is a new utility, provided to trace system calls performed, signals received, and machine faults incurred. truss offers several significant improvements over the SunOS release 4.x trace(1) command, including the ability to follow forked processes and to deal with multithreaded processes.
The following example shows a summary of traced calls for the date command. With the -c option, truss does not display the trace line by line. Instead, it counts the system calls, signals, and faults, and displays a summary.
example% truss -c date Fri Sep 18 14:31:30 PDT 1992 syscall seconds calls errors _exit .00 1 read .00 7 write .00 1 open .03 12 close .00 12 time .00 1 brk .01 4 lseek .00 1 fstat .00 4 ioctl .00 1 execve .00 1 mmap .01 17 munmap .00 8 ---- --- --- sys totals: .05 70 0 usr time: .03 elapsed: .28 |
See the truss(1) man page for complete details on all truss options. There are a number of other Solaris 2.6 debugging tools based on proc(4) such as pmap(1).