Closed lewurm closed 4 years ago
It works on a hifive unleashed running Fedora rawhide.
(gdb) run Starting program: /home/jimw/tmp/a.out glibc-2.30.9000-31.fc32.riscv64 Missing separate debuginfos, use: dnf debuginfo-install Program received signal SIGABRT, Aborted. 0x000000200006ca0e in raise () from /lib64/lp64d/libc.so.6 (gdb) where
(gdb)
This is probably a qemu user bug. The ucontext_t structure changed a few times before it was frozen, and qemu is probably using the wrong definition for it. This is probably the same issue reported on sw-dev in Oct 2019. https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/BUyJ_00Vvn0/m/rDNS7gAbDAAJ
I see you are using qemu-4.2 from last year. A lot of bugs in the RISC-V support have been fixed since then. You could try building your own qemu from top of tree. It is possible this has been fixed already. If not, then you could try using qemu system instead of qemu user. And/or report the bug to the qemu folks and hope someone fixes it.
Thank you for your reply @jim-wilson!
I checked out qemu HEAD
(see below for precise version), but I get the same behaviour.
$ ~/qemu/build/riscv64-linux-user/qemu-riscv64 --version
qemu-riscv64 version 5.0.91 (v5.1.0-rc1-122-g0c4fa5bc1a-dirty)
I also tried to apply the missing alignment attribute for target_sigcontext
(that part of the patch didn't make it upstream apparently), but still the same behaviour.
Since it works on real hardware, I agree with your observation that this is most likely a problem with qemu instead of gdb, thus I'll report it there.
Thanks again!
Qemu bug entry: https://bugs.launchpad.net/qemu/+bug/1889411
Full reproducer: https://gist.github.com/lewurm/befb9ddf5894bad9628b1df77258598b
Consider the following program:
Compiling and running it via:
I get a proper backtrace, as expected.
If I let the signal trigger however, gdb is not able to unwind the stack:
I get the same behaviour for
SIGSEGV
andSIGILL
(I didn't try others).Is this a known issue or is something wrong with my setup?
Versions
GDB was built from: