riscv: gdb cannot connect to rtems runnin in qemu

Jiri Gaisler jiri at gaisler.se
Fri Jan 29 17:03:39 UTC 2021

On 1/29/21 3:10 PM, Jan.Sommer at dlr.de wrote:
>> 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,
>      Jan

As of version 2.26, sis can also run regular rv32imafdc RISCV RTEMS 
binaries if started with -rv32:

$ sis -rv32

  SIS - SPARC/RISCV instruction simulator 2.26,  copyright Jiri Gaisler 2020
  Bug-reports to jiri at gaisler.se

  RISCV/CLINT emulation enabled, 1 cpus online, delta 50 clocks


You can also connect sis to gdb using the 'gdb' command. There is no 
support for 64-bit binaries (yet ..).


More information about the users mailing list