RE: Debugging a Kernel Panic
RE: Debugging a Kernel Panic
- Subject: RE: Debugging a Kernel Panic
- From: Matt Darland <email@hidden>
- Date: Tue, 27 Feb 2007 14:36:19 -0600
To debug memory stompers in the kernel, I build a list of all the
allocations I make. When it comes time to free an allocation, instead
of freeing it, I mark it as unusable and scribble a pattern over the
buffer (but don't return it to the OS). Often in my code I'll call a
routine, that scans the list, making sure the scribbled pattern still
exists over all of the bytes of 'freed' buffers. If a buffer has a
modified byte I'll call panic().
Over time this approach as evolved so I keep a list of the last X
number (say 256) of allocations/frees so I don't exhaust the kernel
memory (by freeing the least recently allocated). I also record the
function and line number where the allocation took place, where it
was freed, etc.
It's time consuming to instrument your code like this, but its
invaluable.
----
Matt
I have a customer who is experiencing kernel panics that are likely
caused (at least partially) by my kernel extension. Thankfully, this
is a fairly technically proficient customer, with multiple machines,
and a desire to learn about remote kernel debugging. Hard to beat
that. I sent him debug builds of the kernel extension and
instructions on how to get everything set up and what to do when a
panic occurs.
There is no obvious reason, circumstance or pattern to the crashes
and I absolutely can not reproduce them (although I do not have a
dual-proc G5, which is the machine of his that is crashing).
The information gdb provides is rarely anything more than this:
(gdb) bt
#0 0x000ab7f8 in kernelStackUnaligned ()
Cannot access memory at address 0x44097f00
Cannot access memory at address 0x44097f00
I'm not sure how to proceed. Can anyone suggest any methods for
getting gdb to give me more helpful information? Also, there isn't
exactly an abundance of information (on Google) regarding
kernelStackUnaligned(); perhaps it is indicative of a certain type of
problem that might help with debugging? Any help appreciated....
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden