riscvarchive / riscv-binutils-gdb

RISC-V backports for binutils-gdb. Development is done upstream at the FSF.
GNU General Public License v2.0
148 stars 233 forks source link

How gdb register csr #234

Closed Phantom1003 closed 3 years ago

Phantom1003 commented 3 years ago

I'm trying to implement a simple gdb server to support a interfaces above qemu, now I can use gdb serial protocol to communicate with qemu, to get general register and memory. But I failed to get the value in csr, for example I want the value in mtvec, I send $pa5#xx, and I got $#00. I filter the packages send by gdb, I found that gdb will request some xml files, is this necessary step to register csr ?

jim-wilson commented 3 years ago

Yes, you must specify the register set with xml files, including the available csrs. gdb, qemu, and openocd have example xml files for RISC-V.

Phantom1003 commented 3 years ago

Thanks, for qemu we should request a .xml to enable the hasxmlfiles variable with a qXfer:feature:read command, usually we use target.xml, then you can use p command to get csr value.