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