tomm / fab-agon-emulator

Agon Light, Agon Light 2, Agon Console8 Emulator for Linux, Windows, any system with libSDL
GNU General Public License v3.0
82 stars 19 forks source link

Badapple demo crashes emulator after a while #32

Closed tomm closed 6 months ago

tomm commented 9 months ago

Demo: https://movievertigo.github.io/downloads/agonlight/badapple/

Thread 4 "fab-agon-emulat" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff63fd6c0 (LWP 379763)]
std::_Sp_counted_ptr_inplace<BufferStream, psram_allocator<BufferStream>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<unsigned int> (
    __a=..., this=0x0) at /usr/include/c++/12/bits/shared_ptr_base.h:600
600     : _M_impl(__a)
(gdb) bt
#0  std::_Sp_counted_ptr_inplace<BufferStream, psram_allocator<BufferStream>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<unsigned int> (
    __a=..., this=0x0) at /usr/include/c++/12/bits/shared_ptr_base.h:600
#1  std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<BufferStream, psram_allocator<BufferStream>, unsigned int> (__a=..., 
    __p=@0x7ffff63fcbc0: 0x0, this=0x7ffff63fcbc8) at /usr/include/c++/12/bits/shared_ptr_base.h:971
#2  std::__shared_ptr<BufferStream, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<psram_allocator<BufferStream>, unsigned int> (__tag=..., 
    this=0x7ffff63fcbc0) at /usr/include/c++/12/bits/shared_ptr_base.h:1712
#3  std::shared_ptr<BufferStream>::shared_ptr<psram_allocator<BufferStream>, unsigned int> (__tag=..., this=0x7ffff63fcbc0)
    at /usr/include/c++/12/bits/shared_ptr.h:464
#4  std::allocate_shared<BufferStream, psram_allocator<BufferStream>, unsigned int> (__a=...) at /usr/include/c++/12/bits/shared_ptr.h:993
#5  make_shared_psram<BufferStream, unsigned int> () at vdp-console8/video/types.h:162
#6  VDUStreamProcessor::bufferCopy (this=this@entry=0x7fffec000ca0, bufferId=<optimized out>, bufferId@entry=65534, 
    sourceBufferIds=std::vector of length 215, capacity 215 = {...}) at vdp-console8/video/vdu_buffered.h:684
#7  0x00007ffff6b54fdc in VDUStreamProcessor::vdu_sys_buffered (this=0x7fffec000ca0) at vdp-console8/video/vdu_buffered.h:92
#8  0x00007ffff6b56f55 in loop () at vdp-console8/video/video.ino:119
#9  0x000055555557e648 in std::sys_common::backtrace::__rust_begin_short_backtrace::hbc09caaeaffdead6 ()
#10 0x000055555557b4bf in core::ops::function::FnOnce::call_once{{vtable.shim}}::h8d6de8e14216241d ()
#11 0x0000555555641995 in alloc::boxed::{impl#47}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:1993
#12 alloc::boxed::{impl#47}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at library/alloc/src/boxed.rs:1993
#13 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#14 0x00007ffff7c4e044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#15 0x00007ffff7cce61c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) 
movievertigo commented 9 months ago

Things that Bad Apple is doing every frame (which may help you concentrate your investigation)...

On the VDP... Buffered Command 13: Copy blocks from multiple buffers into a single buffer Buffered Command 1: Call a buffer (Those buffers only contain characters to be output, move text cursor commands, or occasional clear screens and rectangle draws)

On the ez80... Reading from sysvar_time (To keep in sync on the ez80 side) MOSCALL ffs_fread (To load the next chunk from the SD card) rst.lis 18h (To push the chunk to the VDP)