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