flycast
flycast copied to clipboard
Segmentation Fault with every game since updating
I update yesterday for XU4.
Here is the log when trying to run dolphin.zip https://pastebin.com/VCKkrX2x Just in case it was an issue with the rom or bios I ran for a previously working rom of Crazy Taxi for dreamcast https://pastebin.com/F9kZg1Ys
I removed the naomi_boot.bin and dc_nvmem.bin based on #434 but no dice.
I've traced this further. The last working binary for xu4 was dated 10-26 with the subsequent on 11-18 showing the same error.
Perhaps there was some change in the required files or behavior between those dates? Possibly something to do with how naomi bios is loaded (although the fault does occur on dreamcast games as well)
The last working binary for xu4
Come back after confirming the issue while building from latest sources using make platform=odroid
please, there might be issues in how retropie built its binaries, and this is not the concern of lr-reicast.
I did that originally. Building from source is not working either.
Are you using the RetroArena image?
Are you using the RetroArena image?
@6alileo Yes
I am still thinking this issue is related to the addition of MAME compatibility; probably a change in the configurations, external files required, or an undeclared dependency.
I have the very same issue on my machine after I updated the core (before I was running an old OIT version). This is the log produced by retroarch -v:
Initializing VMU data... Initializing VMU data... Initializing VMU data... Initializing VMU data... SIGSEGV @ 0x7ff7be3f8c42 ... 0x7ff753d00000 -> was not in vram (dyna code 0) [libretro INFO] Fatal error : segfault in signal_handler -> core/libretro/common.cpp : 398 DEBUGBREAK! SIGSEGV @ 0x7ff74f2f4970 ... 0x7ff74f2f4970 -> was not in vram (dyna code 0) [libretro INFO] Fatal error : segfault in signal_handler -> core/libretro/common.cpp : 398 DEBUGBREAK!
I already bisected the code and I can confirm that the issue started on 25th October after this commit a2214fc7735bf7750fd83c3c64055b127db195bf
What platform are you on?
Please make sure that both RA and reicast are up to date
I'm on a PC with ArchLinux and Retroarch 1.7.6. If I update the core from the "Online Updater" I get the segfault.
Can you build the core with DEBUG=1 (or add the -g option) so we can get a stack trace with symbols? Let me known if you need guidance.
Yes, sure! Here is the gdb log with debug enabled:
Thread 32 "retroarch" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffaa5fd700 (LWP 11593)] bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:47 47 DynarecCodeEntryPtr rv=(DynarecCodeEntryPtr)FPCA(addr); (gdb) bt #0 bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:47 #1 0x00007fffd538e589 in ngen_mainloop (v_cntx=0x7fffd538e589 <ngen_mainloop(void*)+64>) at core/rec-x64/rec_x64.cpp:147 #2 0x0000000000000000 in ?? ()
This is a normal SIGSEGV. Type the following gdb command before running RA:
handle SIGSEGV nostop noprint
Here we go:
Initializing VMU data...
Initializing VMU data...
Initializing VMU data...
Initializing VMU data...
[New Thread 0x7fffaa5fd700 (LWP 4450)]
SIGSEGV @ 0x7fffd63c08d3 ... 0x7fff63d00000 -> was not in vram (dyna code 0)
[libretro INFO] Fatal error : segfault
in signal_handler -> core/libretro/common.cpp : 398
DEBUGBREAK!
Thread 32 "retroarch" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffaa5fd700 (LWP 4450)]
os_DebugBreak () at core/libretro/libretro.cpp:2700
2700 __builtin_trap();
(gdb) bt
#0 os_DebugBreak () at core/libretro/libretro.cpp:2700
#1 0x00007fff5f2c1808 in signal_handler (sn=11, si=0x7fffaa5fc630, segfault_ctx=0x7fffaa5fc500)
at core/libretro/common.cpp:398
#2 <signal handler called>
#3 bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:47
#4 0x00007fffd538e589 in ngen_mainloop (v_cntx=0x7fffd538e589 <ngen_mainloop(void*)+64>) at core/rec-x64/rec_x64.cpp:147
#5 0x0000000000000000 in ?? ()
(gdb) continue
Continuing.
SIGSEGV @ 0x7fff5f2c0a01 ... 0x7fff5f2c0a01 -> was not in vram (dyna code 0)
[libretro INFO] Fatal error : segfault
in signal_handler -> core/libretro/common.cpp : 398
DEBUGBREAK!
Thread 32 "retroarch" received signal SIGILL, Illegal instruction.
os_DebugBreak () at core/libretro/libretro.cpp:2700
2700 __builtin_trap();
(gdb) bt
#0 os_DebugBreak () at core/libretro/libretro.cpp:2700
#1 0x00007fff5f2c1808 in signal_handler (sn=4, si=0x7fffaa5fc030, segfault_ctx=0x7fffaa5fbf00)
at core/libretro/common.cpp:398
#2 <signal handler called>
#3 os_DebugBreak () at core/libretro/libretro.cpp:2700
#4 0x00007fff5f2c1808 in signal_handler (sn=11, si=0x7fffaa5fc630, segfault_ctx=0x7fffaa5fc500)
at core/libretro/common.cpp:398
#5 <signal handler called>
#6 bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:47
#7 0x00007fffd538e589 in ngen_mainloop (v_cntx=0x7fffd538e589 <ngen_mainloop(void*)+64>) at core/rec-x64/rec_x64.cpp:147
#8 0x0000000000000000 in ?? ()
In the file core/hw/mem/_vmem.cpp, please uncomment line 683:
printf("Allocated %d PAGES [%08X]\n",++pagecnt,addr);
and rerun with gdb
Unfortunately the change didn't have any effect, the string is not printed in the log and everything looks the same as before. EDIT: I made an interesting discovery. I don't get segfault if I use the same core with retroarch installed via snap. Could be something wrong in the Arch binary package? Strange because it was working fine with the old version of the core.
It could very well have to do with how RA is built for Arch. However I don't know what could cause this. It looks like reicast is not using virtual memory or something is wrong in this area. There are some compile flags (TARGET_NO_VMEM) but I assume you don't use any special flag except for debug mode. Can you paste a full log of a (crashing) run? In your previous posts the beginning of the log is missing. That's where the vmem is initialized.
For the test I'm up-to-date with master and changed only the DEBUG flag in Makefile:
$ git diff
diff --git a/Makefile b/Makefile
index db13ab8e..66d5d664 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-DEBUG := 0
+DEBUG := 1
NO_REND := 0
HAVE_GL := 1
HAVE_GL2 := 0
diff --git a/core/hw/mem/_vmem.cpp b/core/hw/mem/_vmem.cpp
index 32e58468..b403b2d1 100644
--- a/core/hw/mem/_vmem.cpp
+++ b/core/hw/mem/_vmem.cpp
@@ -680,7 +680,7 @@ bool BM_LockedWrite(u8* address)
if (addr<sizeof(p_sh4rcb->fpcb))
{
- //printf("Allocated %d PAGES [%08X]\n",++pagecnt,addr);
+ printf("Allocated %d PAGES [%08X]\n",++pagecnt,addr);
#ifdef _WIN32
verify(VirtualAlloc(address,PAGE_SIZE,MEM_COMMIT,PAGE_READWRITE));
Full log here: https://hastebin.com/onufigufot.cs
Looks like your log is empty. Can you check?
I also tried a couple of hours ago and it didn't work, but now it's magically back.. strange. Now it's attached here: retroarch.log
@ckont if your computer is showing random behavior, you should check your memory modules through the memtest utility.
@barbudreadmon I don't see a random behavior here, I always get the segfault at the same point using the Arch RA binary package with the latest version of the core. Just to be on the safe side I ran memtest86 and found 0 errors:
Result summary
Test Start Time 2019-03-28 19:55:44
Elapsed Time 3:03:29
Memory Range Tested 0x0 - 41F340000 (16883MB)
CPU Selection Mode Parallel (All CPUs)
ECC Polling Enabled
# Tests Passed 48/48 (100%)
Test # Tests Passed Errors
Test 0 [Address test, walking ones, 1 CPU] 4/4 (100%) 0
Test 1 [Address test, own address, 1 CPU] 4/4 (100%) 0
Test 2 [Address test, own address] 4/4 (100%) 0
Test 3 [Moving inversions, ones & zeroes] 4/4 (100%) 0
Test 4 [Moving inversions, 8-bit pattern] 4/4 (100%) 0
Test 5 [Moving inversions, random pattern] 4/4 (100%) 0
Test 6 [Block move, 64-byte blocks] 4/4 (100%) 0
Test 7 [Moving inversions, 32-bit pattern] 4/4 (100%) 0
Test 8 [Random number sequence] 4/4 (100%) 0
Test 9 [Modulo 20, ones & zeros] 4/4 (100%) 0
Test 10 [Bit fade test, 2 patterns, 1 CPU] 4/4 (100%) 0
Test 13 [Hammer test] 4/4 (100%) 0
I also tried a couple of hours ago and it didn't work, but now it's magically back.. strange.
Looked like random behavior to me
The whole "illegal instruction" thingy and issue inside the dynarec makes me think it's something related to cpu set instructions, what's your cpu ?
I have a Ryzen 5 2400g.
Looked like random behavior to me
I was referring to hastebin.com which didn't show the log for some reason
EDIT: attached log with full stacktrace: retroarch_full_stacktrace.log
Yeah apparently hastebin.com had issues but it's working now.
The only idea I have is that something is wrong in the Arch retroarch binary package. Or at least something is causing issues in the reicast core.
It'd be interesting to compare how different are the build options for snap and Arch.
I tried to compile retroarch from sources and used this AUR package: https://aur.archlinux.org/packages/retroarch-git/ In the end I get exactly the same error. This is how retroarch is build:
./configure \
--prefix='/usr' \
--disable-jack \
--disable-oss
make clean
make
make -C gfx/video_filters
I'm wondering if the issue could be a dynamically linked library and not retroarch itself, since the snap package comes with the libraries included. But still only the reicast core crashes, everything else works perfectly :confused:
FYI now I get the error also when using the snap package. For now I stick to an old version of reicast to avoid the problem.
Assuming resolved. Reopen if help needed
I'm still using the same old version of reicast with retroarch installed via snap because the new flycast core doesn't work for me. I always get the segfault :(
Can you try to compile a debug version of flycast and check where the problem happens? Also logs, etc.
I'm now testing using retroarch installed from arch repo, because the snap was more difficult to debug. Anyway I get the same error:
[INFO] [Environ]: GET_PREFERRED_HW_RENDER. [INFO] [Environ]: SET_HW_RENDER. [INFO] Requesting core OpenGL context (3.0). [libretro INFO] 00:00:410 hw/mem/_vmem.cpp:547 N[VMEM]: Info: nvmem is enabled, with addr space of size 4GB [libretro INFO] 00:00:410 hw/mem/_vmem.cpp:548 I[VMEM]: Info: p_sh4rcb: 0x7ffd6a3e0000 virt_ram_base: 0x7ffd724e0000 [libretro INFO] 00:00:429 reios/reios.cpp:704 I[REIOS]: reios: Init [libretro INFO] 00:00:430 e/hw/flashrom/flashrom.h:111 I[FLASHROM]: Loaded /mnt/dc/AeroWings//dc/dc_boot.bin as bootrom [libretro INFO] 00:00:430 e/hw/flashrom/flashrom.h:111 I[FLASHROM]: Loaded /mnt/dc/AeroWings//dc/dc_nvmem.bin as nvram [libretro INFO] 00:00:431 nullDC.cpp:134 I[DYNAREC]: Using Recompiler [libretro INFO] 00:00:431 hw/sh4/interpr/sh4_interpreter.cpp:116 I[INTERPRETER]: Sh4 Reset [libretro INFO] 00:00:431 hw/sh4/dyna/driver.cpp:73 I[DYNAREC]: recSh4:Dynarec Cache clear at A0000000 free space 16777216 [libretro INFO] 00:00:431 hw/sh4/dyna/driver.cpp:413 I[DYNAREC]: recSh4 Init [libretro INFO] 00:00:439 imgread/common.cpp:130 I[GDROM]: gdrom: Opened image "/mnt/dc/AeroWings/AeroWings.cdi" [libretro INFO] 00:00:451 hw/maple/maple_devs.cpp:543 I[MAPLE]: Initializing VMU data... [libretro INFO] 00:00:452 hw/maple/maple_devs.cpp:543 I[MAPLE]: Initializing VMU data... [libretro INFO] 00:00:453 hw/maple/maple_devs.cpp:543 I[MAPLE]: Initializing VMU data... [libretro INFO] 00:00:453 hw/maple/maple_devs.cpp:543 I[MAPLE]: Initializing VMU data... [libretro INFO] 00:00:458 hw/sh4/interpr/sh4_interpreter.cpp:116 I[INTERPRETER]: Sh4 Reset [libretro INFO] 00:00:458 hw/sh4/dyna/driver.cpp:73 I[DYNAREC]: recSh4:Dynarec Cache clear at A0000000 free space 16777216 [libretro INFO] 00:00:458 reios/reios.cpp:170 I[REIOS]: hardware SEGA SEGAKATANA maker SEGA ENTERPRISES ks E650 type GD-ROM num 1/1 area JUE ctrl 0799 dev A vga 1 wince 0 product T40202D 50 version V1.001 date 19990819 boot 1ST_READ.BIN softco xeal.cjb.net [libretro INFO] 00:00:458 nullDC.cpp:152 N[BOOT]: [LUT]: Product number: T40202D 50. [INFO] [Environ]: SET_ROTATION: 0 [INFO] [Environ]: SET_INPUT_DESCRIPTORS: [libretro INFO] 00:02:524 hw/sh4/dyna/driver.cpp:85 I[DYNAREC]: cntx // fpcb offset: -135266304 // pc offset: -184 // pc A0000000 [libretro ERROR] 00:00:562 libretro/common.cpp:373 E[COMMON]: SIGSEGV @ 7fff99d3f7f2 ... 0x7ffe7b7d0000 -> was not in vram (dyna code 0) [libretro INFO] Fatal error : segfault in signal_handler -> core/libretro/common.cpp : 374
[libretro ERROR] 00:00:562 libretro/libretro.cpp:3223 E[COMMON]: DEBUGBREAK!
Thread 1 "retroarch" received signal SIGILL, Illegal instruction. os_DebugBreak () at core/libretro/libretro.cpp:3225 3225 __builtin_trap(); (gdb) bt #0 os_DebugBreak () at core/libretro/libretro.cpp:3225 #1 0x00007ffe73a5e2f8 in signal_handler (sn=11, si=0x7fffffffdd70, segfault_ctx=0x7fffffffdc40) at core/libretro/common.cpp:374 #2
#3 bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:46 #4 0x00007fff99d3f82f in bm_GetCodeByVAddr (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:58 #5 0x00007fff98bf8e5e in ngen_mainloop (v_cntx=0x7fff98bf8e5e <ngen_mainloop(void*)+76>) at core/rec-x64/rec_x64.cpp:165 #6 0x0000000000000001 in ?? () #7 0x0000000000000330 in ?? () #8 0x0000000000000000 in ?? () (gdb) continue Continuing. [libretro ERROR] 02:08:667 libretro/common.cpp:373 E[COMMON]: SIGSEGV @ 7ffe73a5cbd0 ... 0x7ffe73a5cbd0 -> was not in vram (dyna code 0) [libretro INFO] Fatal error : segfault in signal_handler -> core/libretro/common.cpp : 374 [libretro ERROR] 02:08:667 libretro/libretro.cpp:3223 E[COMMON]: DEBUGBREAK!
Thread 1 "retroarch" received signal SIGILL, Illegal instruction. os_DebugBreak () at core/libretro/libretro.cpp:3225 3225 __builtin_trap(); (gdb) bt #0 os_DebugBreak () at core/libretro/libretro.cpp:3225 #1 0x00007ffe73a5e2f8 in signal_handler (sn=4, si=0x7fffffffd770, segfault_ctx=0x7fffffffd640) at core/libretro/common.cpp:374 #2
#3 os_DebugBreak () at core/libretro/libretro.cpp:3225 #4 0x00007ffe73a5e2f8 in signal_handler (sn=11, si=0x7fffffffdd70, segfault_ctx=0x7fffffffdc40) at core/libretro/common.cpp:374 #5 #6 bm_GetCode (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:46 #7 0x00007fff99d3f82f in bm_GetCodeByVAddr (addr=2684354560) at core/hw/sh4/dyna/blockmanager.cpp:58 #8 0x00007fff98bf8e5e in ngen_mainloop (v_cntx=0x7fff98bf8e5e <ngen_mainloop(void*)+76>) at core/rec-x64/rec_x64.cpp:165 #9 0x0000000000000001 in ?? () #10 0x0000000000000330 in ?? () #11 0x0000000000000000 in ?? ()