VirtualBox Serial Debugging on Linux
This tutorial describes using a feature of VirtualBox that writes the output of a serial port into a file on the host machine. Because Haiku, by default, writes debug information to the COM1 port, you can use it to quickly extract stacktraces to text files, for example.
This tutorial is based on following tools:
- Debian Wheezy
- VirtualBox 4.1.18
- Haiku R1A4.1
It should also work on platforms other than Linux.
Step 1: Configure the virtual machine
First, we will create a serial port in VirtualBox and redirect its output to file:- Open machine settings.
- Go to the Serial Ports tab.
- Check Enable Serial Port.
- Under Port Number, chose a port and remember the one you pick.
- In the Port Mode menu, choose the Raw File option.
- In the Port/File Path field, enter the output file path.
- Click OK.
There is also the possibility to redirect output to a physical port:
- Choose the Host Device option in the Port Mode menu
- Change Port/File Path values to port file path (for example /dev/ttyS0 on Linux, COM1 on Windows).
Step 2: Configure Haiku
This step allows you to adjust output port and speed. If you have chosen COM1 as your virtual port and you don't want to change the default speed (115200 bps), there is no need to do anything.- Launch Haiku VM.
- Open the /boot/home/config/settings/kernel/drivers/kernel file.
#serial_debug_port 1to
serial_debug_port number
“number” is the serial port number minus 1 (COM2 = 1).
You can also adapt the transmission speed: Change the line:
#serial_debug_speed 57600
to
serial_debug_speed speed
Possible “speed” values are: 9600, 19200, 38400, 57600, 115200.
The End
Don’t forget to delete or move the output file! VirtualBox won’t do it automatically and it can grow to immense sizes.