Re: Debugging in kernel
Re: Debugging in kernel
- Subject: Re: Debugging in kernel
- From: Terry Lambert <email@hidden>
- Date: Thu, 28 Jun 2007 16:51:38 -0700
On Jun 28, 2007, at 3:32 PM, billy lau wrote:
Hi list,
I am currently trying to modify some memory allocators in darwin,
for example, the zalloc. However, I am not familiar with the
debugging APIs for darwin or Mac OS X, as I am very new to this
operating system. Can someone please shed some light on this?
Mostly, we use gdb. How to do this is documented in "two machine
debugging" and "kernel debugging" at <http://developer.apple.com> in
various places (look for the kernel debug kits).
For example, is there an equivalent of printk (used in linux) in mac?
printf
And if there is, how can I see the result of the these 'prints'?
This is covered at <http://developer.apple.com>; typically, you set
your boot-args to contain debug=0x14e; that causes the output to go to
the console, and you can tail -f /var/log/system.log.
Are they printed to some sort of buffer maintained the kernel?
Yes, which is then sent to the console device, which is then logged to
the system.log.
As for linux, printk would basically just print to the console, but,
as for Mac, how would that be done, since the operating systems
starts in the user graphical interface.
If you _can't_ look at the log because you are doing work that causes
the system to crash, then you can look at the console ring buffer from
kernel space using gdb and two machine debugging (<http://developer.apple.com
> again...); alternately, you can login to the non-graphical console,
which will cause them to show (more or less) immediately. Note that
there is a (very small) latency, so if you are printing e.g. single
letters with \n's, and they are very close together source-line-wise,
you could lose an event.
This is discussed on <http://developer.apple.com>, but basically if
you login with the username >console and no password, it will give you
a non-graphical login.
If you have an XServe, you can also use the serial console, instead.
-- Terry
_______________________________________________
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