Skip to content

target/riscv: Generate the GDB XML file for CSR registers dynamically

Bin Meng qemu-devel qemu-riscv 2 versions – Applied

Status from this message: Applied to riscv-to-apply.next

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied
  2. v14 patches 11 repliesSuperseded

Changes in v2 from the cover letter

- rebase on top of riscv-to-apply.next branch
- drop the first 2 patches that are already applied on riscv-to-apply.next

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2target/riscv: Generate the GDB XML file for CSR registers dynamicallytarget/riscv/cpu.c target/riscv/cpu.h target/riscv/gdbstub.c+58 -2640 replies
2/2target/riscv: Remove built-in GDB XML files for CSRsdefault-configs/targets/riscv32-linux-user.mak default-configs/targets/riscv32-softmmu.mak default-configs/targets/riscv64-linux-user.mak +3 more+4 -5041 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAlistair Francis
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] target/riscv: Generate the GDB XML file for CSR registers dynamically

From: Bin Meng <[email protected]>

At present QEMU RISC-V uses a hardcoded XML to report the feature "org.gnu.gdb.riscv.csr" [1]. There are two major issues with the approach being used currently:

- The XML does not specify the "regnum" field of a CSR entry, hence consecutive numbers are used by the remote GDB client to access CSRs. In QEMU we have to maintain a map table to convert the GDB number to the hardware number which is error prone.
- The XML contains some CSRs that QEMU does not implement at all, which causes an "E14" response sent to remote GDB client.

Change to generate the CSR register list dynamically, based on the availability presented in the CSR function table. This new approach will reflect a correct list of CSRs that QEMU actually implements.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/RISC_002dV-Features.html#RISC_002dV-Features

Changes in v2:
- rebase on top of riscv-to-apply.next branch
- drop the first 2 patches that are already applied on riscv-to-apply.next

Bin Meng (2):
target/riscv: Generate the GDB XML file for CSR registers dynamically target/riscv: Remove built-in GDB XML files for CSRs

 .../targets/riscv32-linux-user.mak            |   2 +-
 default-configs/targets/riscv32-softmmu.mak   |   2 +-
 .../targets/riscv64-linux-user.mak            |   2 +-
 default-configs/targets/riscv64-softmmu.mak   |   2 +-
 target/riscv/cpu.h                            |   2 +
 target/riscv/cpu.c                            |  12 +
 target/riscv/gdbstub.c                        | 308 +++---------------
 gdb-xml/riscv-32bit-csr.xml                   | 250 --------------
 gdb-xml/riscv-64bit-csr.xml                   | 250 --------------
 9 files changed, 62 insertions(+), 768 deletions(-)
 delete mode 100644 gdb-xml/riscv-32bit-csr.xml
 delete mode 100644 gdb-xml/riscv-64bit-csr.xml
Signature · 1 line
2.25.1