Kernel Debug Howto

HeTak hetakcoder at gmail.com
Sun Jul 26 05:06:45 UTC 2015


Thank you, Mehmet and Benjamin, for the tips :)

On Sun, Jul 26, 2015 at 12:27 AM, Benjamin Kaduk <kaduk at mit.edu> wrote:

> On Sat, 25 Jul 2015, Kristof Provost wrote:
>
> >
> > > On 25 Jul 2015, at 10:54, HeTak <hetakcoder at gmail.com> wrote:
> > > I have recently started some developments on FreeBSD net section.
> > Great!
> >
> > > But I am kinda new to this field. My base interest is to first
> understand the
> > > implementation structure via tracing the code and so.
> > >
> > > I have three major questions:
> > > 1-  how to debug changes made to FreeBSD kernel?
> > > (You know, till some levels, I can even use uprintf or so, but, for
> example
> > > inside radix.c (where I wanna understand how a route is checked to be
> > > unique and then inserted to the tree) I can't do such checks..)
> > dtrace can be quite useful to understand flows. You can grab stack traces
> > (i.e. figure out where things are called from), get function arguments, …
>
> Remote kgdb over a serial line can also be useful for stepping through
> execution in cases where that is appropriate, and of course kgdb on
> coredumps when the kernel panics.
>
​I'm working on VMs to use of snapshots and other facilities while applying
my changes. so i guess this serial line solution is not useful for me, btw,
is this debugging tool really useful? don't you face possible kernel
crashes after applying some changes on kernel which disconnects you from
the system?
 ​


>
> > > 3- what is the fastest way to apply changes to FreeBSD kernel?
> > > (For now, I just follow the normal build & install kernel & reboot.)
> > I pretty much do that. Depending on what you’re working on it might be
> easier to run it in a VM.
> > My work lately has been on the network code, so a VM is very convenient.
> > It’s not so useful if you’re working on drivers, of course.
>
> To speed up the build stage, you can 'make -DKERNFAST kernel' if you have
> only made "normal" code changes.
>
​I have seen this option before but I don't know what it means by "normal"
code changes. would you please explain it to me?

Thank you :)

--HeTak


More information about the freebsd-hackers mailing list