Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-05 Thread Dag-Erling Smørgrav
Eugene Grosbein eu...@kuzbass.ru writes:
 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.

What is the point, if you use NO_KERNELCLEAN as recommended below?  The
modules won't be rebuilt either unless something that affects them has
changed.  Running a new kernel with old modules is a great way to shoot
yourself in the foot.

If you absolutely want to skip modules, build your kernel with
-DNO_MODULES, but install it normally, or use reinstallkernel instead of
installkernel.  The latter will overwrite your running kernel - but you
should keep an unmodified kernel around anyway.

You can boot entirely without modules if you include everything you need
(including acpi) in your kernel config.

 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

You should not use -DNO_KERNELDEPEND unless you know for sure that no
#include directives have been added or removed and no kernel options
have changed.

It is safe to use -DNO_KERNELCLEAN, but not -DNO_KERNELDEPEND, even if
your config file changed.

 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.

The best solution by far is to use actual hardware and netboot from your
development machine.  It's easy to set up, and you don't lose context
every time you reboot the test system.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-02 Thread Bakul Shah
ddb and kgdb are two useful and often indispensable tools for kernel
 debugging on FBSD. ddb won't allow you source level debugging, kgdb will,
 but you'll need an extra machine. 

If the code you are debugging doesn't depend on specific
hardware, one option is to run FreeBSD (with the kernel being
debugged) under qemu and run kgdb on the host FreeBSD.
Something like

In Window1
$ qemu -s freebsd-disk-img ...

In Window2
$ cd where the kernel under test was built
$ kgdb kernel.debug
(gdb) target remote localhost:1234
do your debugging
(gdb) detach
Ending remote debugging.
(gdb) q
$

Note: I have not tried this recently but it should work.

 AFAIK, if you are modifying the kernel source directly  there is no option
 but to recompile all the changed and dependent files.

Well... there used to be a debugger called ups with a builtin
C interpreter. It allowed you to add code at run time.  This
was quite handy when you wanted to temporarily patch things
up and continue debugging or set conditional breakpoints or
insert assertion verification code on the fly.  The C
interpreter is worth adding to gdb but I am not sure if any
of ups code can be reused.  See http://ups.sourceforge.net/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-02 Thread Eugene Grosbein
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-02 Thread Michel Talon
Mehul Chadha wrote:

 But I am working on a virtual
 mode freebsd project similar to what UML does in linux. 

Do you mean like vkernel in DragonFlyBSD?
http://leaf.dragonflybsd.org/cgi/web-man/?command=vkernelsection=ANY


-- 

Michel TALON

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-02 Thread Mehul Chadha
Michel Talon Wrote:

 Do you mean like vkernel in DragonFlyBSD?

Yes, UML and vkernel cater to same problem the implementation being the
obvious difference between them.
We have implemented some part of it and working on the design of the rest.
We have been following the vkernel and UML and trying to move away with some
of the shortcomings in both.
It will be helpful for us if we can have some valuable inputs or any advice
from your side.

Regards,
Mehul


On Fri, Jan 2, 2009 at 6:24 PM, Michel Talon ta...@lpthe.jussieu.fr wrote:

 Mehul Chadha wrote:

  But I am working on a virtual
  mode freebsd project similar to what UML does in linux.

 Do you mean like vkernel in DragonFlyBSD?
 http://leaf.dragonflybsd.org/cgi/web-man/?command=vkernelsection=ANY


 --

 Michel TALON

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-01 Thread Mehul Chadha
Hi kamlesh,
   Happy New Year.  I am not aware of the debugging tools
in freebsd available right now in the market. But I am working on a virtual
mode freebsd project similar to what UML does in linux. This will help in
executing the entire OS in the user space of real OS running on HW.  This
will be the best debugging tool to debug all the non architecture specific
code in freebsd. The project is specially catered to problems similar to
what you are facing. We are expecting the project to be completed in next 3
months.

Regards,
Mehul

On Fri, Jan 2, 2009 at 7:57 AM, Kamlesh Patel shilp.ka...@yahoo.com wrote:

 Hi Friends, Happy New Year,

 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?

 Kamlesh
 MS CS, CSUS




 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD kernel Debugging tools for Virtual Memory Module

2009-01-01 Thread Pranav Peshwe
On Fri, Jan 2, 2009 at 7:57 AM, Kamlesh Patel shilp.ka...@yahoo.com wrote:

 Hi Friends, Happy New Year,

 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?



Hi,
   ddb and kgdb are two useful and often indispensable tools for kernel
debugging on FBSD. ddb won't allow you source level debugging, kgdb will,
but you'll need an extra machine. Dtrace from the Solaris world is being
ported to FBSD, that too can be useful at times.
You can find more information in the FBSD developers handbook here -
http://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug.html

AFAIK, if you are modifying the kernel source directly  there is no option
but to recompile all the changed and dependent files. I do not know whether
it works out of the box, but you can try using ccache to speed up the
compilation.

HTH.

Best regards,
Pranav
http://pranavsbrain.peshwe.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD and Debugging?

2004-04-10 Thread Daan Vreeken [PA4DAN]
On Saturday 10 April 2004 07:23, Brandon Erhart wrote:
 Thank you. You are my new god. I had checked out a version of valgrind for
 BSD (one of the patches) and it failed to compile.

 Everything seems to be working, except I get this warning at the beginning
 of the program:

 Warning: ignoring --pointercheck=yes, because i386_set_ldt failed
 (errno=45)
Sounds like you need options   USER_LDT in you kernel.

grtz,
Daan

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]