Debugging RISCV-64 bootloader in QEMU | Haiku Project

Debugging early bootloader code can be extremely difficult. The lack of printf and other classical black-box debugging tools means you’re limited to one of the following methods of debugging lockups:


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/kallisti5/2021-01-17_debugging_riscv-64_bootloader_in_qemu/
3 Likes

When debugging UEFI loader for ARM (UEFI Haiku boot loader for ARM), I used UEFI text output protocol to write checkpoints like (1), (2), (2.1). Also UEFI display crash report with IP register value that can be converted to source code position by llvm-addr2line.

I used serial for ARM as well. However I found out printf was broken on ARM and in some very important info print 0 instead of the correct numerical values. So I think using both methods is important. (Turned out packages used by bootlloader was compiled with hardfloat, while UEFI in ARM arn’t allowed to use float).