August 22 WIP (symptoms also appear in 1.42)
P4 3.4 Ghz
Linux-SDL zsnes
Built from source w/ --enable-debug, with cflags undef
Running in a window in an R mode (but I've had it happen in fullscreen too, it's just more annoying when it's fullscreen)
The problem is: zsnes locks up hard and requires a kill -9.
Reproduced by:
1) Load any rom (I'm pretty sure it's rom-independent)
2) hit esc to bring up the menu
3) click into another window, causing zsnes to lose focus.
4) click back into the zsnes window
5) hit esc to resume the rom
It rarely happens on the very first try (though I have had it happen), but repeat for a while and it will always happen in the first thirty tries or so.
With the debug build, I tracked down more information. The problem is sem_GetTicks() is returning NaN.
I added code to the function, making it:
»···ticks=((float)(now.tv_sec-sem_start.tv_sec))*1000.f+((float)(now.tv_usec-sem_start.tv_usec))*.001f;
»···fprintf(stderr, "Now: %li.%li. Start: %li.%li. Ticks: %f\n",·
now.tv_sec, now.tv_usec, sem_start.tv_sec, sem_start.tv_usec, ticks);
assert(ticks == ticks);
»···return(ticks);
and here is what I see:
[snip]
Now: 1125265114.90439. Start: 1125265094.514740. Ticks: 19575.699219
Now: 1125265114.91710. Start: 1125265094.514740. Ticks: nan
zsnesd: linux/sdllink.c
W/o the assertion, it continue running (and the debug output above will be showing normal values again) but zsnes itself will cease to display anything but a black screen, and requires a kill -9 to make it go away.
One suspicious thing I noticed: I removed -fomit-frame-pointer (should --enable-debug leave that in? It seems like it shouldn't..) and got a backtrace- sem_GetTicks is called in quite a few places, but the backtrace is always the same when it crashes:
[snip]
#5 0x402afe9d in __assert_fail () from /lib/libc.so.6
#6 0x080f1d3b in sem_GetTicks () at sdllink.c:1188
#7 0x080f16f1 in CheckTimers () at sdllink.c:914
#8 0x080f1a22 in UpdateVFrame () at sdllink.c:1043
#9 0x080f292a in gl_drawwin () at gl_draw.c:269
#10 0x080f1b4b in drawscreenwin () at sdllink.c:1100
#11 0x080efc84 in DrawScreen.skipconv ()
[snip]
I can't figure out why the ticks math is resulting in a NaN- it doesn't look like an over/underflow or anything. If anyone has any suggestions for what else I can do to debug this, let me know and I'll give it a try.