When serial isn't an option, what should I use for debug?
When serial isn't an option, what should I use for debug?
If there is already a thread on this subject / a wiki page that I managed to skip I am sorry and I will happily go there.
I usually use serial for debug output / input. It's pretty easy and convenient. But I want to test my work on a laptop and I loose this option. I imagine that I can use some serial-*something_else_adapter*, but that won't really help me as I will have to send data over that something_else anyway. So assuming I have no serial on both my developer machine and my test machine, what's recommended?
Firewire comes in mind, but I have the same problem: I can't put it in my laptop.
I usually use serial for debug output / input. It's pretty easy and convenient. But I want to test my work on a laptop and I loose this option. I imagine that I can use some serial-*something_else_adapter*, but that won't really help me as I will have to send data over that something_else anyway. So assuming I have no serial on both my developer machine and my test machine, what's recommended?
Firewire comes in mind, but I have the same problem: I can't put it in my laptop.
- BASICFreak
- Member
- Posts: 284
- Joined: Fri Jan 16, 2009 8:34 pm
- Location: Louisiana, USA
Re: When serial isn't an option, what should I use for debug
My recommendation, which I do on HW, is printf debugging. (may also need delays or stop points if trying to locate a bug)
Also, I haven't done so yet, you could check out the Debug Registers
Also, I haven't done so yet, you could check out the Debug Registers
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
BOS Expanded Commentary
Both under active development!
Sortie wrote:
- Don't play the role of an operating systems developer, be one.
- Be truly afraid of undefined [behavior].
- Your operating system should be itself, not fight what it is.
Re: When serial isn't an option, what should I use for debug
What about the network?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: When serial isn't an option, what should I use for debug
I once used the keyboard LEDs for serial output while debugging graphics driver code. Not that I can recommend that.
- BASICFreak
- Member
- Posts: 284
- Joined: Fri Jan 16, 2009 8:34 pm
- Location: Louisiana, USA
Re: When serial isn't an option, what should I use for debug
The network requires a working system.iansjack wrote:What about the network?
Network stack
NIC Drivers
TCP/IP
UDP
and whatever else is needed for the communication...
And most of the time the debugging is needed well before these can be implemented.
But if OP is at that point it is an option.
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
BOS Expanded Commentary
Both under active development!
Sortie wrote:
- Don't play the role of an operating systems developer, be one.
- Be truly afraid of undefined [behavior].
- Your operating system should be itself, not fight what it is.
Re: When serial isn't an option, what should I use for debug
That is an option up until a point. My bad, I should have given a bit more context: I'm not really making an OS, I'm making a hyper-visor (osdev is still a extremely valuable source of information). I can't print on screen once a guest is loaded; also, some output may be a bit large, sometimes I want / need to be able to send debug commands (from setting breakpoints, to modifying memory / registers, single stepping etc). I'm talking about full debugging support (which already exists, I just need to find a way to use it).BASICFreak wrote:My recommendation, which I do on HW, is printf debugging. (may also need delays or stop points if trying to locate a bug)
Also, I haven't done so yet, you could check out the Debug Registers
This is what I wanted to ask. Well, I need and want to have something, so everything is an option. I just don't know what option is better.The network requires a working system.
Network stack
NIC Drivers
TCP/IP
UDP
and whatever else is needed for the communication...
And most of the time the debugging is needed well before these can be implemented.
But if OP is at that point it is an option.
That must have been fun. My darkest memory is generating BSODs on purpose in order to debug a Windows driver on a machine that WinDbg refused to accept in it's life. Now I feel that my darkest memory is boringI once used the keyboard LEDs for serial output while debugging graphics driver code. Not that I can recommend that.

- BASICFreak
- Member
- Posts: 284
- Joined: Fri Jan 16, 2009 8:34 pm
- Location: Louisiana, USA
Re: When serial isn't an option, what should I use for debug
USB would probably be easier to program than a NIC.
Then you could use USB-to-RS232 adapter and have the serial output you already use.
Then you could use USB-to-RS232 adapter and have the serial output you already use.
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
BOS Expanded Commentary
Both under active development!
Sortie wrote:
- Don't play the role of an operating systems developer, be one.
- Be truly afraid of undefined [behavior].
- Your operating system should be itself, not fight what it is.
Re: When serial isn't an option, what should I use for debug
I'm thinking that if I implement another method for communication I should implement it on both ends. So in the end I will have both serial - serial and USB - USB / network - network / etc. The more, the better, you never know what could happen.BASICFreak wrote:USB would probably be easier to program than a NIC.
Then you could use USB-to-RS232 adapter and have the serial output you already use.
Re: When serial isn't an option, what should I use for debug
And we still have speakers. Morse code or not, why not?Combuster wrote:I once used the keyboard LEDs for serial output while debugging graphics driver code. Not that I can recommend that.

- Nutterts
- Member
- Posts: 159
- Joined: Wed Aug 05, 2015 5:33 pm
- Libera.chat IRC: Nutterts
- Location: Drenthe, Netherlands
Re: When serial isn't an option, what should I use for debug
yet you saidzdz wrote:I'm thinking that if I implement another method for communication I should implement it on both ends. So in the end I will have both serial - serial and USB - USB / network - network / etc. The more, the better, you never know what could happen.BASICFreak wrote:Then you could use USB-to-RS232 adapter and have the serial output you already use.
Cause yeah, you want to redirect stdout in your OS. But if it's just for testing your work on a device that doesn't have a serial port. Then use one of those cheap USB-to-RS232 adapters. Just make sure you get the right one, if you tell me what you normally do I'd be happy to lookup the right one for you.zdz wrote:But I want to test my work on a laptop and I loose this option
If you want to add another i/o device (usb, etc) to use for debug... it's nice to be able to debug while developing it.
Also.. you don't want serial<->serial, you want serial<>any-other-compatible-io-device. So like on any other OS, a usb->serial converter should atleast at the user level basicly be the same thing as serial<>serial.
"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods
Failed project: GoOS - https://github.com/nutterts/GoOS
Failed project: GoOS - https://github.com/nutterts/GoOS
Re: When serial isn't an option, what should I use for debug
Bochs supports writing output to console using port 0xE9.
Re: When serial isn't an option, what should I use for debug
I think you're right. But after I have seril <> USB working I will probably want to have USB <> USB, because why not?Nutterts wrote:yet you saidzdz wrote:I'm thinking that if I implement another method for communication I should implement it on both ends. So in the end I will have both serial - serial and USB - USB / network - network / etc. The more, the better, you never know what could happen.BASICFreak wrote:Then you could use USB-to-RS232 adapter and have the serial output you already use.Cause yeah, you want to redirect stdout in your OS. But if it's just for testing your work on a device that doesn't have a serial port. Then use one of those cheap USB-to-RS232 adapters. Just make sure you get the right one, if you tell me what you normally do I'd be happy to lookup the right one for you.zdz wrote:But I want to test my work on a laptop and I loose this option
If you want to add another i/o device (usb, etc) to use for debug... it's nice to be able to debug while developing it.
Also.. you don't want serial<->serial, you want serial<>any-other-compatible-io-device. So like on any other OS, a usb->serial converter should atleast at the user level basicly be the same thing as serial<>serial.
What other devices fall into the other-compatible-device category? I've done some reading and USB seems far easier than network.
In the next days I will probably look for some gotchas met by people around here who implemented USB support. Just having debug input / output it not like having full USB support so I should be fine.
Suggestions, advises, tips, other methods are still valuable to me so please don't treat this as a solved topic

Bochs supports writing output to console using port 0xE9.
That's not helping me in any way.
Re: When serial isn't an option, what should I use for debug
I did't see the laptop thing. You could also write your output to storage like hdd etc. and analyze it afterwards.
Re: When serial isn't an option, what should I use for debug
I wouldn't be too sure about that.I've done some reading and USB seems far easier than network.
Providing you have a documented NIC it is relatively simple to write a workable network driver; it is then trivial to implement a custom protocol to transfer your debug information to another machine.
Re: When serial isn't an option, what should I use for debug
Writing to disk comes with it's own problems and I will need a stable environment and debugger when I'll implement that. For short, I have to make sure that the portion of the disk that I write to will never be used by the guest. Details are... a bit more complicated.Roflo wrote:I did't see the laptop thing. You could also write your output to storage like hdd etc. and analyze it afterwards.
My first thought (when I opened this thread) is that it can't be that hard to make the NIC work and after that a simple communication protocol is trivial. Once I started to look into things that first impression changed.Providing you have a documented NIC it is relatively simple to write a workable network driver; it is then trivial to implement a custom protocol to transfer your debug information to another machine.
I guess that I have to weight my options. Right now I'm almost sure that I want USB, but I don't really have time for development in this period (~2 weeks). The good news is that I can read about this and that so I have time to look over things and come with a list of pro and cons and a plan.
Any examples on how USB might backfire / be harder to make it work properly?