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