|
|||
4. Using MDB Commands Interactively 9. Debugging With the Kernel Memory Allocator |
Booting, Loading, and UnloadingTo facilitate the debugging of kernel startup, kmdb can be loaded during the earliest stages of the boot process, before control has passed from the kernel runtime linker (krtld) to the kernel. kmdb may be loaded at boot using the -k boot flag, the kmdb boot file, or the kadb boot file (for compatibility). If kmdb is loaded at boot, the debugger cannot be unloaded until the system subsequently reboots. Some functionality will not be immediately available during the earliest stages of boot. In particular, debugging modules will not be loaded until the kernel module subsystem has initialized. Processor-specific functionality will not be enabled until the kernel has completed the processor identification process. If you boot your system using the -k option, kmdb will automatically load during the boot process. You can use the -d boot option to request a debugger breakpoint prior to starting the kernel. This feature works with the default kernel as well as alternate kernels. For example, to boot a SPARC system with kmdb and request immediate entry to the debugger, type any of the following commands: ok boot -kd ok boot kmdb -d ok boot kadb -d To boot an x86 system in the same manner, type any of the following commands: Select (b)oot or (i)nterpreter: b -kd Select (b)oot or (i)nterpreter: b kmdb -d Select (b)oot or (i)nterpreter: b kadb -d To boot a SPARC system with kmdb and load an alternate 64–bit kernel, type the following command: ok boot kernel.test/sparcv9/unix -k To boot an x86 system with kmdb and load an alternate 64–bit kernel, type the following command: Select (b)oot or (i)nterpreter: b kernel.test/amd64/unix -k If the boot file is set to the string kmdb or kadb and you want to boot an alternate kernel, use the -D option to specify the name of the kernel to boot. To boot a SPARC system in this manner, type the following command: ok boot kmdb -D kernel.test/sparcv9/unix To boot a 32–bit x86 system in this manner, type the following command: Select (b) or (i)nterpreter: b kmdb -D kernel.test/unix To boot a 64–bit x86 system in this manner, type the following command: Select (b) or (i)nterpreter: b kmdb -D kernel.test/amd64/unix To debug a system that has already booted, use the mdb -K option to load kmdb and stop kernel execution. When the debugger is loaded using this method, it can be subsequently unloaded. You can unload kmdb when you are done debugging by specifying the -u option to the ::quit dcmd. Alternatively, you can resume execution of the operating system using the command mdb -U. |
||
|