Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jul 2015 15:57:50 -0400 (EDT)
From:      Benjamin Kaduk <kaduk@MIT.EDU>
To:        HeTak <hetakcoder@gmail.com>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Kernel Debug Howto
Message-ID:  <alpine.GSO.1.10.1507251552590.22210@multics.mit.edu>
In-Reply-To: <514DDE7F-CF61-461D-A9FF-232DC938BDF5@FreeBSD.org>
References:  <CAGyHxXWFwU%2Ba-S62DJA==UagFFvFxwpiw0Zmht6O-ppS-ddx%2Bg@mail.gmail.com> <514DDE7F-CF61-461D-A9FF-232DC938BDF5@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 25 Jul 2015, Kristof Provost wrote:

>
> > On 25 Jul 2015, at 10:54, HeTak <hetakcoder@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 understa=
nd 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 exa=
mple
> > 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, =
=E2=80=A6

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.

> > 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=E2=80=99re working on it mig=
ht be easier to run it in a VM.
> My work lately has been on the network code, so a VM is very convenient.
> It=E2=80=99s not so useful if you=E2=80=99re working on drivers, of cours=
e.

To speed up the build stage, you can 'make -DKERNFAST kernel' if you have
only made "normal" code changes.

-Ben


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.GSO.1.10.1507251552590.22210>