LekKit / RVVM

The RISC-V Virtual Machine
GNU General Public License v3.0
929 stars 65 forks source link

gdb/lldb debugging kernel images #140

Closed ZLangJIT closed 1 month ago

ZLangJIT commented 1 month ago

how can i debug a kernel being booted by RVVM via gdb or lldb, specifically for a non-riscv host (eg, to debug an SIGILL init[1])

LekKit commented 1 month ago

how can i debug a kernel being booted by RVVM via gdb or lldb, specifically for a non-riscv host (eg, to debug an SIGILL init[1])

You can use KGDB over UART (Pass -serial /path/to/pipe to pipe RVVM serial port) to debug Linux kernel in a guest. For debugging guest userland, you can run GDB in a guest altogether.

A gdbstub implementation is in the works (Similar to that of QEMU), but not finished and not upstreamed yet.

Debugging SIGILL should be pretty straightforward as it usually means the guest uses some unimplemented RISC-V extension (Vectors, or proprietary THead extensions usually). Can you post the guest kernel log upon the crash?

ZLangJIT commented 1 month ago

the SIGILL was from Vector extensions in buildroot