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