for some reason I think my short term memory is somehow damaged. If I’m not regularly dealing with stuff I almost forget everything about…therefore I decided to write that little reminder for me, just in case for the next time 😉
I’m only working on Mac OS X Mavericks, don’t ask me about the others! 😉 I really suggest you to read following piece of info before you start. Quite useful if you ask me:
Ok, so got the machine you want to debug. Open up a console window and setup nvram accordingly. I use native firewire because I have older machines to work with. You can change that to whatever you need ( again, the suggested paper is pretty helpful here… )
“sudo nvram boot-args=”debug=0x144 kdp_match_name=firewire””
Reboot the machine, it should stop at the very early boot stage, waiting for your remote debugger attaching…
Now switch to your machine you want to use as debugger.
Download the Kernel Debug Kit which matches the your debuggees kernel version and mount it. If you haven’t already installed download the latest mavericks xcode commandline tools and install them as well.
So far so good, you have your tools set. Remember your debuggee is still waiting! Lets get friendly and talk to it 😉
Open up a console and execute following command:
The last line of the output should print something like “Ready.”, which is good!!! That tools prepare the communication between debugger and debuggee.
One more step and we are ready:
Open another console and type “xcrun lldb /Volumes/KernelDebugKit/mach_kernel“. That will fireup lldb with the correct kernel loaded for additional debug information. Now you tell the debuggee that you want to attach by “kdp-remote localhost” and BOOM!, there you go…
As I have more physical machines available I prefer this method instead of remote debugging “into” a VMware image. From time to time VMware troubles me and thats an easy way out.
Hope you find that useful, if not I will. The question is not whether I will forget it again, its about the when, hehe.