From owner-freebsd-hackers@freebsd.org Sat Jul 25 09:11:37 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9E989A96E1 for ; Sat, 25 Jul 2015 09:11:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93D8F350 for ; Sat, 25 Jul 2015 09:11:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [IPv6:2001:4dd0:ff00:809d:1449:a7d9:ccf6:b355] (unknown [IPv6:2001:4dd0:ff00:809d:1449:a7d9:ccf6:b355]) by venus.codepro.be (Postfix) with ESMTPSA id B7FE6110F2; Sat, 25 Jul 2015 11:11:32 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3071\)) Subject: Re: Kernel Debug Howto From: Kristof Provost In-Reply-To: Date: Sat, 25 Jul 2015 11:11:32 +0200 Cc: freebsd-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <514DDE7F-CF61-461D-A9FF-232DC938BDF5@FreeBSD.org> References: To: HeTak X-Mailer: Apple Mail (2.3071) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2015 09:11:37 -0000 > On 25 Jul 2015, at 10:54, HeTak 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. >=20 > 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, = =E2=80=A6 > 2- are there standards there for freebsd kernel developments of which = I can > follow so my job gets a bit simplified? > (Any development guides or so?I prospect it to be some differences = between > system developments and normal coding, but I don't have an idea on how = to > get that). There=E2=80=99s style(9) for coding style. I=E2=80=99d also recommend "The Design and Implementation of the FreeBSD = Operating System=E2=80=9D (the second edition). > 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 = 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=E2=80=99s not so useful if you=E2=80=99re working on drivers, of = course. Regards, Kristof=