LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.58k stars 205 forks source link

Hang when starting a ROM in a non-writable dir #546

Open clbr opened 1 year ago

clbr commented 1 year ago

"sameboy path/to/rom.gb" where the dir is non-writable hangs Sameboy. This is on today's git master, SDL build on Linux. It prints the "Could not open battery save" error before hanging.

LIJI32 commented 1 year ago

I don't seem to be able to reproduce this, but it seems that SDL_ShowSimpleMessageBox is buggy on Linux. Can you try attaching lldb/gdb to SameBoy when it's hanging and print the backtrace (bt)?

clbr commented 1 year ago
(gdb) thread apply all bt full

Thread 6 (Thread 0x42014950 (LWP 1789)):
#0  0x00007ffff1c01cf3 in mix_areas_32_smp () from /usr/lib/libasound.so.2
No symbol table info available.
#1  0x00007ffff1c03176 in snd_pcm_dmix_sync_area () from /usr/lib/libasound.so.2
No symbol table info available.
#2  0x00007ffff1c03447 in snd_pcm_dmix_mmap_commit () from /usr/lib/libasound.so.2
No symbol table info available.
#3  0x00007ffff1be1950 in snd_pcm_plugin_mmap_commit () from /usr/lib/libasound.so.2
No symbol table info available.
#4  0x00007ffff1bebde9 in snd_pcm_rate_commit_area () from /usr/lib/libasound.so.2
No symbol table info available.
#5  0x00007ffff1bece13 in snd_pcm_rate_mmap_commit () from /usr/lib/libasound.so.2
No symbol table info available.
#6  0x00007ffff1be0af3 in snd_pcm_mmap_write_areas () from /usr/lib/libasound.so.2
No symbol table info available.
#7  0x00007ffff1bd4ee3 in snd1_pcm_write_areas () from /usr/lib/libasound.so.2
No symbol table info available.
#8  0x00007ffff1bdfe42 in snd_pcm_mmap_writei () from /usr/lib/libasound.so.2
No symbol table info available.
#9  0x00007ffff738ef31 in ALSA_PlayDevice () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#10 0x00007ffff72a9c96 in SDL_RunAudio () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#11 0x00007ffff73259f0 in SDL_RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#12 0x00007ffff73b3889 in RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#13 0x00007ffff7077feb in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#14 0x00007ffff7b6194d in clone () from /lib/libc.so.6
No symbol table info available.

Thread 5 (Thread 0x42003950 (LWP 1788)):
#0  0x00007ffff7b34bb1 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#1  0x00007ffff73b99f4 in SDL_Delay_REAL () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#2  0x00007ffff738fd3c in ALSA_HotplugThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#3  0x00007ffff73259f0 in SDL_RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#4  0x00007ffff73b3889 in RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#5  0x00007ffff7077feb in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0x00007ffff7b6194d in clone () from /lib/libc.so.6
No symbol table info available.

---Type <return> to continue, or q <return> to quit---
Thread 4 (Thread 0x41802950 (LWP 1787)):
#0  0x00007ffff707c779 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
No symbol table info available.
#1  0x00007ffff2984bec in radeon_drm_cs_emit_ioctl ()
   from /usr/X11R7/lib/X11/modules/dri/r600_dri.so
No symbol table info available.
#2  0x00007ffff2984789 in impl_thrd_routine () from /usr/X11R7/lib/X11/modules/dri/r600_dri.so
No symbol table info available.
#3  0x00007ffff7077feb in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#4  0x00007ffff7b6194d in clone () from /lib/libc.so.6
No symbol table info available.

Thread 3 (Thread 0x41001950 (LWP 1786)):
#0  0x00007ffff7b5558b in read () from /lib/libc.so.6
No symbol table info available.
#1  0x000000000043957f in mainloop.lto_priv ()
No symbol table info available.
#2  0x00007ffff7077feb in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#3  0x00007ffff7b6194d in clone () from /lib/libc.so.6
No symbol table info available.

Thread 2 (Thread 0x40800950 (LWP 1785)):
#0  0x00007ffff707e411 in sem_wait () from /lib/libpthread.so.0
No symbol table info available.
#1  0x00007ffff73b3b0b in SDL_SemWaitTimeout_REAL () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#2  0x00007ffff7326028 in SDL_TimerThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#3  0x00007ffff73259f0 in SDL_RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#4  0x00007ffff73b3889 in RunThread () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#5  0x00007ffff7077feb in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0x00007ffff7b6194d in clone () from /lib/libc.so.6
No symbol table info available.

Thread 1 (Thread 0x7ffff7fde900 (LWP 1781)):
#0  0x00007ffff7b347bf in waitpid () from /lib/libc.so.6
No symbol table info available.
#1  0x00007ffff7399450 in X11_ShowMessageBox () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#2  0x00007ffff7368d54 in SDL_ShowMessageBox_REAL () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#3  0x00007ffff7368ef2 in SDL_ShowSimpleMessageBox_REAL () from /usr/lib/libSDL2-2.0.so.0
No symbol table info available.
#4  0x0000000000405162 in main ()

Yes indeed, looks like either a SDL bug or an interaction with SDL.

LIJI32 commented 1 year ago

Might be the best to report this to SDL's maintainer. I'll keep this issue open, if they don't fix it I'll have to implement a message box on non-Mac/Windows myself.