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