I’m using the two machine remote kernel debugging setup described in the following documents:
Kernel Programming Guide
Kernel Extension Programming Topics
Both documents are a bit outdated but the still hold valuable information.
Download and install the kernel debug kit for OS X 10.11 from Apple on the the "debugger“ machine.
You need to start by setting the boot-args of the machine that you want to debug to
This allows you to debug the kernel after issuing a non maskable interrupt (NMI). You do this by pressing Command-Option-Control-Shift-Escape at the same time on the machine that is to be debugged, when it hangs.
Then you will need to run lldb on your "debugger" machine and connect to the remote machine. Running the following commands will get you started. You will need to alter the path to the kernel in the lldb command and the IP address for kdb-remote.
$ lldb /path/to/Kernels/kernel
(lldb) settings set target.load-script-from-symbol-file true
(lldb) kdb-remote 172.16.115.128
And when you are done:
The above command will print the (kernel) stack traces for all running processes at the time of the hang.