From owner-freebsd-hackers@freebsd.org Sat Jul 25 20:03:04 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 D20429AA921 for ; Sat, 25 Jul 2015 20:03:04 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu [18.7.68.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64ADAF0 for ; Sat, 25 Jul 2015 20:03:04 +0000 (UTC) (envelope-from kaduk@mit.edu) X-AuditID: 12074425-f799a6d000007db3-b1-55b3ea427a00 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 22.00.32179.34AE3B55; Sat, 25 Jul 2015 15:57:55 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id t6PJvsJP017024; Sat, 25 Jul 2015 15:57:54 -0400 Received: from multics.mit.edu (system-low-sipb.mit.edu [18.187.2.37]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id t6PJvpoj003110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 25 Jul 2015 15:57:53 -0400 Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id t6PJvoDM029828; Sat, 25 Jul 2015 15:57:50 -0400 (EDT) Date: Sat, 25 Jul 2015 15:57:50 -0400 (EDT) From: Benjamin Kaduk To: HeTak cc: freebsd-hackers Subject: Re: Kernel Debug Howto In-Reply-To: <514DDE7F-CF61-461D-A9FF-232DC938BDF5@FreeBSD.org> Message-ID: References: <514DDE7F-CF61-461D-A9FF-232DC938BDF5@FreeBSD.org> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IR4hRV1nV+tTnU4NRzDovtm/8xWsyc947V gcljxqf5LB47Z91lD2CK4rJJSc3JLEst0rdL4Mp4+byHueACX8WcXTdZGxhvcHcxcnJICJhI HJ76gAXCFpO4cG89WxcjF4eQwGImiefv37FCOBsZJf52dzNCOIeYJB42bYHKNDBKPF27iwmk n0VAW2JWy3J2EJtNQEVi5puNbCC2iICCxNZ5+5hBbGYBQ4klq34A1bNzCAvIS3TkgUQ5Bewl ln29AzaFV8BRYuvHN1C7mhklNj3fCjZGVEBHYvX+KSwQRYISJ2c+YYEYGSix9cM3pgmMgrOQ pGYhSUHY6hKND86yQdjaEvdvtrEtYGRZxSibklulm5uYmVOcmqxbnJyYl5dapGuhl5tZopea UrqJERTa7C6qOxgnHFI6xCjAwajEw7vh96ZQIdbEsuLK3EOMkhxMSqK8XyQ3hwrxJeWnVGYk FmfEF5XmpBYfYpTgYFYS4d3zCCjHm5JYWZValA+TkuZgURLn3fSDL0RIID2xJDU7NbUgtQgm K8PBoSTBu/4FUKNgUWp6akVaZk4JQpqJgxNkOA/Q8IUgNbzFBYm5xZnpEPlTjIpS4rzdIAkB kERGaR5cLyz1vGIUB3pFmPcDSBUPMG3Bdb8CGswENJinbwPI4JJEhJRUA6O3Sukrm7VvdJ96 RN693fBxi1Ntz+lmoxDjoD06OboB72bm9+7hXX69+Hlf6c1z/ywrt1y0zHhQ0iK+omhZ2b3T /rninC+5F5fvLHK07e+PeLPTxqBM2fFdduxlw19+ZgJ3vGYInzlRpjeBc5vmiWf7z4VPVbac Ve64O4incO8Wr62yuxykOpRYijMSDbWYi4oTAX8BSqEYAwAA Content-Type: TEXT/PLAIN; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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 20:03:05 -0000 On Sat, 25 Jul 2015, Kristof Provost wrote: > > > 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 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