Wednesday, August 11, 2004

Debugging OS X kernel and other deep crashes (needs two machines)

Macintouch Mac OS X Panther (10.3.5)
Panther Freezes

Steve St-Laurent
No, the 10.3.5 update does nothing to resolve this issue. Same pattern: iTunes plus heavy network activity (a file copy from a server, for example) causes a freeze. When did this mess start?

Rohan Lloyd
If you're not afraid of getting under the hood, this is the best way to track down what is causing the freeze and reporting it to Apple so they can fix it.

If you've never used the Terminal before, or don't know what I'm talking about, please don't just follow the instructions and blame me when something goes wrong.

* Enable remote debugging on your target machine by running the following command and rebooting.
$ sudo nvram boot-args='debug=0x144
* Download the KernelDebugKit from: http://developer.apple.com/sdk/#Kernel
* Mount the KernelDebugKit on a remote machine (not the one that is freezing)
* When the freeze happens, trigger a Non Maskable Interrupt (NMI). On a PowerBook you do this with Cmd-Power (google for other machines)
* On the remote machine, start gdb, and attach to the freezing machine:
$ gdb -x /Volumes/KernelDebugKit/kgmacros
/Volumes/KernelDebugKit/mach_kernel
(gdb) target remote-kdp
(gdb) attach ???.???.???.???
* Get a stack trace of all processes:
(gdb) showallstacks
* Report the bug to Apple including the stack trace: http://bugreporter.apple.com/

There's an earlier blog posting of mine about the lockup. A Macintouch contributor says it's related to a fairly deep VM/HFS+ bug. This is a good description of how to debug OS X kernel issues.

No comments: