@xypron You can set the QEMU_GDB environment variable inside the riscv64 container, then launch the cross-toolchain gdb on your external x86 host (for example, from Spacemit toolchain https://archive.spacemit.com/toolchain/spacemit-toolchain-linux- glibc-x86_64-v1.1.2.tar.xz) to debug RISC-V applications.
Steps: Inside the RISC-V container: QEMU_GDB=10000 cmake --system-information This launches your program with QEMU’s built-in GDB server listening on port 10000. On your x86 host, start the RISC-V cross GDB: ./spacemit-toolchain-linux-glibc-x86_64-v1.1.2/bin/riscv64-unknown-linux-gnu-gdb (Standard GDB output...) Then connect to the remote target: (gdb) target remote :10000 If the connection times out, check that your container exposes the port, and QEMU is running. Once connected, run your program. If you hit a SIGILL (illegal instruction): Program received signal SIGILL, Illegal instruction. 0x00007fffee44695a in ?? () (gdb) bt #0 0x00007fffee44695a in ?? () (gdb) x/16i $pc-32 You observe output like this, including: => 0x7fffee44695a:.insn4, 0x0207f0a7 When decoding 0x0207f0a7 with an online RISC-V disassembler (such as AboutRV, https://www.aboutrv.com/tools/disassembler?code=IDB4MDIwN2YwYTc%3D), you find the instruction is: 0x0207f0a7 → vse64.v v1, (a5) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2133188 Title: Illegal instruction in memset under qemu-user for riscv64 To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/2133188/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
