diff mbox series

[1/1] docs: debugging OpenSBI

Message ID 20210528101617.31237-1-xypron.glpk@gmx.de
State Superseded
Headers show
Series [1/1] docs: debugging OpenSBI | expand

Commit Message

Heinrich Schuchardt May 28, 2021, 10:16 a.m. UTC
Describe how to debug OpenSBI on QEMU with GDB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 docs/platform/qemu_virt.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

--
2.32.0.rc0

Comments

Atish Patra May 28, 2021, 3:56 p.m. UTC | #1
On Fri, May 28, 2021 at 4:10 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Describe how to debug OpenSBI on QEMU with GDB.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@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'
> +
> +```
> --
> 2.32.0.rc0
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>
Jessica Clarke May 28, 2021, 3:59 p.m. UTC | #2
On 28 May 2021, at 11:16, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> 
> Describe how to debug OpenSBI on QEMU with GDB.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@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
diff mbox series

Patch

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'
+
+```