[PATCH 1/1] docs: debugging OpenSBI

Jessica Clarke jrtc27 at jrtc27.com
Fri May 28 08:59:26 PDT 2021


On 28 May 2021, at 11:16, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> 
> Describe how to debug OpenSBI on QEMU with GDB.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> docs/platform/qemu_virt.md | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 
> diff --git a/docs/platform/qemu_virt.md b/docs/platform/qemu_virt.md
> index 2777148..de7a028 100644
> --- a/docs/platform/qemu_virt.md
> +++ b/docs/platform/qemu_virt.md
> @@ -147,3 +147,27 @@ qemu-system-riscv32 -M virt -m 256M -nographic \
> 	-device virtio-blk-device,drive=hd0 \
> 	-append "root=/dev/vda rw console=ttyS0"
> ```
> +
> +Debugging with GDB
> +------------------
> +
> +In a first console start OpenSBI with QEMU:
> +
> +```
> +qemu-system-riscv64 -M virt -m 256M -nographic \
> +	-bios build/platform/generic/firmware/fw_payload.bin \
> +	-gdb tcp::1234 \
> +	-S
> +
> +```
> +
> +Parameter *-gdb tcp::1234* specifies 1234 as the debug port.
> +Parameter *-S* lets QEMU wait at the first instruction.
> +
> +In a second console start GDB:
> +
> +```
> +gdb-multiarch build/platform/generic/firmware/fw_payload.elf \
> +	-ex 'target remote localhost:1234'

This is rather presumptuous about what the user’s gdb is. More often than not
they probably have a triple-prefixed gdb, not a gdb-multiarch. I would just
leave it as gdb and let them figure out what that means for them, maybe with a
note that they should make sure to use a gdb that’s built with RISC-V support.

Jess




More information about the opensbi mailing list