xref: /xnu-8796.121.2/config/README.DEBUG-kernel.txt (revision c54f35ca767986246321eb901baf8f5ff7923f6a)
1*c54f35caSApple OSS DistributionsThis directory contains a universal DEBUG kernel, built for 32-bit and
2*c54f35caSApple OSS Distributions64-bit Intel. It includes a dSYM bundle for remote kernel debugging
3*c54f35caSApple OSS Distributionsand live kernel debugging.
4*c54f35caSApple OSS Distributions
5*c54f35caSApple OSS DistributionsINSTALLATION
6*c54f35caSApple OSS Distributions
7*c54f35caSApple OSS Distributions!!!WARNING!!! These steps will overwrite the default kernel and
8*c54f35caSApple OSS DistributionsSystem.kext. Backup all files before attempting these steps.
9*c54f35caSApple OSS Distributions
10*c54f35caSApple OSS DistributionsTo install the DEBUG kernel, do:
11*c54f35caSApple OSS Distributionsbash-3.2$ sudo -s
12*c54f35caSApple OSS Distributionsbash-3.2# cd /
13*c54f35caSApple OSS Distributionsbash-3.2# ditto /AppleInternal/Developer/Extras/Kernel\ Debugging/System.kext /System/Library/Extensions/System.kext
14*c54f35caSApple OSS Distributionsbash-3.2# cp -r /AppleInternal/Developer/Extras/Kernel\ Debugging/mach_kernel* /
15*c54f35caSApple OSS Distributionsbash-3.2# chown -R root:wheel /System/Library/Extensions/System.kext /mach_kernel*
16*c54f35caSApple OSS Distributionsbash-3.2# chmod -R g-w /System/Library/Extensions/System.kext /mach_kernel*
17*c54f35caSApple OSS Distributionsbash-3.2# touch /System/Library/Extensions
18*c54f35caSApple OSS Distributionsbash-3.2# shutdown -r now
19*c54f35caSApple OSS Distributions
20*c54f35caSApple OSS DistributionsREMOTE KERNEL DEBUGGING
21*c54f35caSApple OSS Distributions
22*c54f35caSApple OSS DistributionsSee the documentation that accompanies the Kernel Debug Kit
23*c54f35caSApple OSS Distributions
24*c54f35caSApple OSS DistributionsLIVE KERNEL DEBUGGING
25*c54f35caSApple OSS Distributions
26*c54f35caSApple OSS DistributionsWith the DEBUG kernel installed, set "kmem=1" in your "boot-args"
27*c54f35caSApple OSS DistributionsNVRAM variable, reboot, and do:
28*c54f35caSApple OSS Distributions
29*c54f35caSApple OSS Distributionsbash-3.2$ sudo gdb -a <arch> --quiet /mach_kernel
30*c54f35caSApple OSS Distributions(gdb) target darwin-kernel
31*c54f35caSApple OSS Distributions(gdb) source /AppleInternal/Developer/Extras/Kernel\ Debugging/kgmacros
32*c54f35caSApple OSS DistributionsLoading Kernel GDB Macros package.  Type "help kgm" for more info.
33*c54f35caSApple OSS Distributions(gdb) attach
34*c54f35caSApple OSS DistributionsConnected.
35*c54f35caSApple OSS Distributions
36*c54f35caSApple OSS Distributions<arch> should reflect the currently booted kernel architecture, either
37*c54f35caSApple OSS Distributions"i386" or "x86_64"
38*c54f35caSApple OSS Distributions
39*c54f35caSApple OSS Distributions
40