From owner-freebsd-questions@FreeBSD.ORG Fri Jan 2 08:56:16 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F43D106566B; Fri, 2 Jan 2009 08:56:16 +0000 (UTC) (envelope-from eugen@kuzbass.ru) Received: from www.svzserv.kemerovo.su (www.svzserv.kemerovo.su [213.184.65.80]) by mx1.freebsd.org (Postfix) with ESMTP id B579B8FC08; Fri, 2 Jan 2009 08:56:15 +0000 (UTC) (envelope-from eugen@kuzbass.ru) Received: from www.svzserv.kemerovo.su (eugen@localhost [127.0.0.1]) by www.svzserv.kemerovo.su (8.13.8/8.13.8) with ESMTP id n028LHQl079659; Fri, 2 Jan 2009 15:21:17 +0700 (KRAT) (envelope-from eugen@www.svzserv.kemerovo.su) Received: (from eugen@localhost) by www.svzserv.kemerovo.su (8.13.8/8.13.8/Submit) id n028LHs2079658; Fri, 2 Jan 2009 15:21:17 +0700 (KRAT) (envelope-from eugen) Date: Fri, 2 Jan 2009 15:21:17 +0700 From: Eugene Grosbein To: Kamlesh Patel Message-ID: <20090102082117.GA78125@svzserv.kemerovo.su> References: <387210.21917.qm@web45407.mail.sp1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <387210.21917.qm@web45407.mail.sp1.yahoo.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org, freebsd-questions@freebsd.org Subject: Re: FreeBSD kernel Debugging tools for Virtual Memory Module X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jan 2009 08:56:16 -0000 On Thu, Jan 01, 2009 at 06:27:44PM -0800, Kamlesh Patel wrote: > I am working on Virtual Memory parts of FreeBSD OS. My Problem is, whenever i modify little code of vmpage.c file i need to build the whole kernel to check the modification and i even am not able to debug the kernel code. > > Could anyone please inform me kernel Debugging tools for FreeBSD OS? First, you need to recompile source you change for sure :-) But you have not rebuild all other files all the time. You need to add to your /etc/src.conf (or /etc/make.conf for 6.x and earlier): MODULES_WITH_WORLD=yes This will skip rebuilding of all modules during 'make buildkernel' but you MUST to copy all modules from /boot/kernel to /boot/modules (all files other than /boot/kernel/kernel*) if you do this. Otherwise, you'll lose modules and system may not boot due to missing vital modules like acpi.ko Then, if you do not change kernel config file, recompile your changes with command (only second time and then): cd /usr/src; make NO_KERNELDEPEND=yes NO_KERNELCLEAN=yes buildkernel So, your rebuild time changes drastically: no modules rebuild, no other sources rebuild other that you touched last time. It will relink previously compiled object code with your changes only, that's way much quicker. Reinstall kernel and reboot. Second, you should use some kind of virtual machine (like qemu from ports) to speedup your development cycle even more: install the system into virtual machine and you'll need not another box to debug the kernel and need not rebuild your development box. Test your changes with the system installed into VM and reboot it only. Use ddb or kgdb already noted here. Eugene Grosbein