opensbi icon indicating copy to clipboard operation
opensbi copied to clipboard

[Debug opensbi] Using qemu+gdb to debug opensbi

Open hptsf opened this issue 2 years ago • 5 comments

Hi,

building opensbi, and then starting system using qemu with -S -s params

in other terminal, riscv64_unknown_linux_gdb fw_payload.elf target remote :1234 b sbi_init c n will get tips as below, and can't stop on next line image

hptsf avatar Oct 04 '22 11:10 hptsf

Anyone has any idea?

hptsf avatar Oct 08 '22 13:10 hptsf

Have you tried step instead of next?

alistair23 avatar Oct 09 '22 22:10 alistair23

yes, step is ok, but is not what i want. Maybe step is too slow.

hptsf avatar Oct 10 '22 01:10 hptsf

Maybe you can check if the GCC you use to compile and the GDB you use to debug are the same version. For example, I may have multi versions of the toolchain, sometimes mixing them.

Compile with riscv64-unknown-linux-gnu-gcc and debug with riscv64-unknown-linux-gnu-gcc may not be able to debug normally.

Dunky-Z avatar Nov 07 '22 11:11 Dunky-Z

When you build the OpenSBI binary, you can pass "DEBUG=1" on the command line which generates debugger-friendly bits.

lbmeng avatar Jul 22 '23 00:07 lbmeng