Kernel debugger

A very simple kernel debugger has been added to the JNode nano-kernel. This debugger is able to send all data outputted to the console (using Unsafe.debug) to another computer via a null-modem cable connected to COM1.

From the other computer you can give simple commands to the debugger, such as dump the processor thread queues and print the current thread.

The kernel debugger can be enabled by adding " kdb" to the grub kernel command line, or by activating it in JNode using a newly added command: "kdb".

Ewout

kdb tips

If you have problems with kdb from a physical PC, here's a couple of tips to try:

Question 1: How do you setup baudrate, word length, parity, and stop bits for kdb?

Answer 1: Jnode's kdb.asm does not seem to setup the serial port characteristics, such as baud and line discipline, so it defaults to your chip's current state. The bits in the baud rate divisor registers in most UARTs default to zero, meaning "run the UART at full speed". Maxbaud on the old 8250 UART was usually 38400, and the maxbaud on the old 16450 and 16550 UARTs was usually 115200. Newer SuperIO serial UARTs may have maxbauds as high as 960000, but may default to a legacy maxspeed of 115,200 if they initialize in 16550-compatible mode. Check your motherboard documentation or the SuperIO datasheet for details.

Question 2: So, um, how do I use kdb then?

Answer 2: Use GRUB to setup your serial port characteristics:
In /boot/grub/menu.lst I added a new block (for my PC's SuperIO chip which defaults to dual 16550-compatible mode):
title Jnode [all plugins + kernel debugger kdb on com1]
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
kernel (hd0,0)/jnode32.gz mp=no kdb
module (hd0,0)/full.jgz

Connect your null modem to another terminal or a computer with a serial terminal emulator program, setup the terminal port to match what you put on the grub serial command options, and give it a shot!

Question3: I tried minicom on Linux, and it captured some stuff, but after a line or two, all it shows is 1 single character on the far right of the terminal window?

Answer3: This happens to me too. I think kdb is sending line feeds, which mean "roll down to next line", but not a matching carriage return which means "and move carriage back to beginning of line".
DOS, Mac, and Unix all use different "interpretations" of the ASCII standard for how to handle End-Of-Lines.

Question 4: So, how do I fix it?
Answer 4: many terminals and terminal emulators have a configuration choice that will handle end of line issues any way you like. I am also looking at changing the default end of line sent by KDB itself in order to make it more widely compatible out of the box.
--
Robert "Exile In Paradise" Murphey

Thanks

Hi Exile,
Thanks for this useful Comments Smiling
Thanks,
Tanmoy