Closed NoahRoseLedesma closed 3 years ago
There are no gdb experts here. An FSF GDB mailing list is a better place to ask gdb questions.
Does your stub send back XML? Gdb will try to read an XML target description first, and if the stub doesn't support an XML target description then it has to guess. it will use a binary if it was given one, otherwise it will use default architecture info. All of the known working gdb stubs support XML. The non-XML case will probably never work right. The non-XML case works better if you always provide a binary to gdb to debug first, before trying to connect to the target, where the binary has enough info for gdb to figure out what the target is. Otherwise, configuring a riscv32 gdb instead of a riscv64 gdb might help.
For an example of what gdb is expecting, see the gdb/features/riscv/32bit-cpu.xml file. See the Target Descriptions section of the gdb manual. And see various commands like "maint print xml-tdesc". And optionally see simulators with working xml support, like qemu.
Adding XML target description support did resolve the issue. Thank you for your help! The behavior of set architecture
is misleading here, I created a bug report upstream to clarify.
Hello,
I am implementing a remote stub for an educational rv32 simulator. Currently, when the GDB client requests the contents of the registers via the
g
packet, my server responds with some dummy data. However, the client only seems to accept my response if the packet contains 528 bytes, despite setting the target architecture torv32
in the client. I am specifying the architecture withset architecture riscv:rv32
. If my server responds to theg
packet with 264 bytes (i.e. 33 registers 4-byte wide 2 ASCII digits), I receive the following error from the client:When I send 528 bytes, the client accepts my packet and displays 64-bit registers.
Is this an issue with my use of the client, my implementation of the server, or GDB itself?