riscv: gdb cannot connect to rtems runnin in qemu

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Fri Jan 29 14:10:19 UTC 2021

> From: Joel Sherrill <joel at rtems.org> 
>On Fri, Jan 29, 2021 at 7:20 AM <Jan.Sommer at dlr.de> wrote:
>> Hello
>> I just tried to debug a riscv test program running in qemu.
>> However, gdb could not establish a connection to qemu and produced the following error:
>> /tmp/rtems/riscv❯ riscv-rtems6-gdb ticker.exe
>> GNU gdb (GDB)
>> [..]
>> For help, type "help".
>> Type "apropos word" to search for commands related to "word"...
>> Reading symbols from /tools/modulesystem/tools/rtems/rtems6/install/bsps/riscv-rtems6/grv32imafdc-smp/testsuites/samples/ticker.exe...
>> (gdb) target remote :1234
>> Remote debugging using :1234
>> bfd requires flen 8, but target has flen 4
> griscv are Jiri's BSPs and should run on sis and be able to be debugged that way.
> He should know if they worked on qemu and he was able to connect gdb.

Sorry for the confusion. Jiri already told me previously that for running on qemu I need to use the BSPs without a "g" like rv32imafdc.
That's what I did for my test application. For testing with ticker.exe I chose the wrong directory.
To clarify, I use the rv32imafdc BSP to run on qemu.
The application runs fine, but debugging it through the qemu gdb-server does not work.
This does also happen with the ticker.exe of the rv32imafdc BSP.

Best regards,


> Otherwise, this looks like a potential mismatch of 32 and 64 bit stuff like gdb 
> wasn't built with both 32 and 64 bit riscv support. Which seems odd to me 
> because it lives in the same repo as binutils and should have a comparable
> build of binutils.
>> The tools and rtems are built from master a couple of days ago.
>> I used the following command line for qemu (v. 4.2.0):
>> qemu-system-riscv32 -nographic -machine virt -m 2G -nographic -net none -serial mon:stdio -bios /tmp/riscv/ticker.exe -s -S
>> Does anyone have a hint if the problem is with qemu, gdb or rtems?
>> Without gdb the program runs normally in qemu.
>> Best regards,
>>     Jan
>> Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR)
>> German Aerospace Center
>> Institute for Software Technology | Software for Space Systems and Interactive Visualization | Lilienthalplatz 7 | 38108 Braunschweig | Germany
>> Jan Sommer
> _______________________________________________
users mailing list
users at rtems.org

More information about the users mailing list