Linux - Freezes when returning from menu

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Linux - Freezes when returning from menu

Post by RedDwarf »

I think I read the bug report somewhere, but since I am not able to find it I report (again?).
Not sure if happens only with some games, I did the backtrace with Stargate USA version verified by NSRT.
The game goes fine, but if I press ESC to go to the emu menu, when returning to the game the emu freezes. If playing at full screen I must CTRL+F1 and kill it.
It's my first backtrace but:

Code: Select all

Program received signal SIGINT, Interrupt.
[Switching to Thread 1079786112 (LWP 15318)]
0x080d7a6f in sem_GetTicks () at linux/sdllink.c:1185
1185            ticks=((float)(now.tv_sec-sem_start.tv_sec))*1000.f+((float)(now.tv_usec-sem_start.tv_usec))*.001f;
(gdb) bt
#0  0x080d7a6f in sem_GetTicks () at linux/sdllink.c:1185
#1  0x080d752a in CheckTimers () at linux/sdllink.c:927
#2  0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
#3  0x08391858 in tableCc ()
#4  0x4126a0b6 in ?? ()
#5  0x083146ef in spcRam ()
#6  0xbffff48c in ?? ()
#7  0x000000be in ?? ()
#8  0x0000b130 in ?? ()
#9  0x0000183e in ?? ()
#10 0x00000001 in ?? ()
#11 0x082de7cb in cachevideo.noskip () at vcache.asm:376
#12 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
#13 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
#14 0x080d9604 in main (argc=47223995, argv=0x806895bb) at linux/zloaderw.c:353
(gdb) bt full
#0  0x080d7a6f in sem_GetTicks () at linux/sdllink.c:1185
        now = {tv_sec = 1106852720, tv_usec = 183247}
        ticks = 18318.2832
#1  0x080d752a in CheckTimers () at linux/sdllink.c:927
        i = 1093068254
#2  0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
No locals.
#3  0x08391858 in tableCc ()
No symbol table info available.
#4  0x4126a0b6 in ?? ()
No symbol table info available.
#5  0x083146ef in spcRam ()
No symbol table info available.
#6  0xbffff48c in ?? ()
No symbol table info available.
#7  0x000000be in ?? ()
No symbol table info available.
#8  0x0000b130 in ?? ()
No symbol table info available.
#9  0x0000183e in ?? ()
No symbol table info available.
#10 0x00000001 in ?? ()
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#11 0x082de7cb in cachevideo.noskip () at vcache.asm:376
No locals.
#12 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
No locals.
#13 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
No locals.
#14 0x080d9604 in main (argc=47223995, argv=0x806895bb) at linux/zloaderw.c:353
        opt = 164668916
        p = 250675048
        pp = -1510693477
        fvar = 0x8d0ff68 <Address 0x8d0ff68 out of bounds>
ZSNES v1.41

SDL support Version 1.2.7
NASM support NASM version 0.98.38 compiled on Jan 5 2005
ZLib support Version 1.2.1.1
PNG support (png screenshots) Yes, version 1.2.6
OpenGL support Yes
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

Try 1.42 and see if it still happens.
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Is 1.42, that "1.41" seems a typo in the configure script.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Your BT says you killed it, not that it froze. Not much I can do with that.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Yes, I supposed it could be not usefull. Was a freeze+"CTRL+C"+bt.
When it freezes....frezees, I can't write "bt" or do nothing. What should I do?
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Perhaps a CTRL+Z is enough?
Program received signal SIGTSTP, Stopped (user).
[Switching to Thread 1079786112 (LWP 16186)]
0xffffe410 in ?? ()
(gdb) bt
#0 0xffffe410 in ?? ()
#1 0xbffff454 in ?? ()
#2 0x000000be in ?? ()
#3 0x00000000 in ?? ()
#4 0x402fafb6 in gettimeofday () from /lib/tls/libc.so.6
#5 0x080d7a51 in sem_GetTicks () at linux/sdllink.c:1184
#6 0x080d748b in CheckTimers () at linux/sdllink.c:905
#7 0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
#8 0x08391858 in tableCc ()
#9 0x4126a0b6 in ?? ()
#10 0x083145cc in spcRam ()
#11 0xbffff48c in ?? ()
#12 0x000000be in ?? ()
#13 0x0000b130 in ?? ()
#14 0x0000183e in ?? ()
#15 0x00000001 in ?? ()
#16 0x082de7cb in cachevideo.noskip () at vcache.asm:376
#17 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
#18 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
#19 0x080d9604 in main (argc=-164707241, argv=0xbf00348)
at linux/zloaderw.c:353
(gdb) bt full
#0 0xffffe410 in ?? ()
No symbol table info available.
#1 0xbffff454 in ?? ()
No symbol table info available.
#2 0x000000be in ?? ()
No symbol table info available.
#3 0x00000000 in ?? ()
No symbol table info available.
#4 0x402fafb6 in gettimeofday () from /lib/tls/libc.so.6
No symbol table info available.
#5 0x080d7a51 in sem_GetTicks () at linux/sdllink.c:1184
now = {tv_sec = 1106860778, tv_usec = 644155}
ticks = 34902.9102
#6 0x080d748b in CheckTimers () at linux/sdllink.c:905
i = 1093068254
#7 0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
No locals.
#8 0x08391858 in tableCc ()
No symbol table info available.
#9 0x4126a0b6 in ?? ()
No symbol table info available.
#10 0x083145cc in spcRam ()
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#11 0xbffff48c in ?? ()
No symbol table info available.
#12 0x000000be in ?? ()
No symbol table info available.
#13 0x0000b130 in ?? ()
No symbol table info available.
#14 0x0000183e in ?? ()
No symbol table info available.
#15 0x00000001 in ?? ()
No symbol table info available.
#16 0x082de7cb in cachevideo.noskip () at vcache.asm:376
No locals.
#17 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
No locals.
#18 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
No locals.
#19 0x080d9604 in main (argc=-164707241, argv=0xbf00348)
at linux/zloaderw.c:353
opt = 238313219
p = -804445170
pp = -462425136
fvar = 0x10c83d3d <Address 0x10c83d3d out of bounds>
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Why can't you go into gdb and hit bt during the freeze?

Edit: are you using a debug version?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Yes, I compiled with "--enable-debug" and the file I'm using is named "zsnesd".

And well, I have no idea of using gdb. I execute "gdb zsnesd", then a prompt "(gdb)" appears and I make "run". While running there in no "(gdb)" prompt and anything I write in Konsole is ignored. Since during the freeze is still "running" I can't do nothing until it stops.
There is a alternative to "run" that makes me able to use gdb while the program is running or something?
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

This is quite delicate. To isolate freezes which do not crash zsnes, you can add breakpoints in the code. Gdb will catch these breakpoints and allow you to continue as usual, or to try a step-by-step debugging process.
Add a breakpoint before and after a suspicious function. If it freezes after two breaks, the fault is located after your second breakpoint. Remove both BPs, then do the same with next func.
If it freezes without any breaks, the fault is before your first BP. Remove them, and do it for the previous function.
Doing so, you'll end up focusing on the faulty function, when it freezes after one and only one BP is encountered.

However the source is vast, and if you have no idea of where to put the first breakpoints, you're in for some years of trial and error.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

You can, instead, specify a process ID as a second argu-
ment, if you want to debug a running process:

gdb program 1234


would attach GDB to process 1234 (unless you also have a
file named `1234'; GDB does check for a core file first).
This last way would be usefull? I tried and I can retrieve a bt from the frozed emu, but not sure if usefull.
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Well, anyway here you have.
[reddwarf@Primero src]$ gdb zsnesd 7408
GNU gdb 6.2-2mdk (Mandrakelinux)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i586-mandrake-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

Attaching to program: /home/reddwarf/zsnes_1_42/src/zsnesd, process 7408
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /usr/lib/libSDL-1.2.so.0...done.
Loaded symbols for /usr/lib/libSDL-1.2.so.0
Reading symbols from /lib/tls/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 1079786112 (LWP 7408)]
[New Thread 1210059696 (LWP 7411)]
[New Thread 1201130416 (LWP 7410)]
[New Thread 1107803056 (LWP 7409)]
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /usr/lib/libpng.so.3...done.
Loaded symbols for /usr/lib/libpng.so.3
Reading symbols from /usr/X11R6/lib/libGL.so.1...done.
Loaded symbols for /usr/X11R6/lib/libGL.so.1
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /usr/lib/libasound.so.2...done.
Loaded symbols for /usr/lib/libasound.so.2
Reading symbols from /usr/X11R6/lib/libaudio.so.2...done.
Loaded symbols for /usr/X11R6/lib/libaudio.so.2
Reading symbols from /usr/X11R6/lib/libXt.so.6...done.
Loaded symbols for /usr/X11R6/lib/libXt.so.6
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Loaded symbols for /usr/X11R6/lib/libX11.so.6
Reading symbols from /usr/X11R6/lib/libXext.so.6...done.
Loaded symbols for /usr/X11R6/lib/libXext.so.6
Reading symbols from /usr/lib/libltdl.so.3...done.
Loaded symbols for /usr/lib/libltdl.so.3
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/X11R6/lib/libXxf86vm.so.1...done.
Loaded symbols for /usr/X11R6/lib/libXxf86vm.so.1
Reading symbols from /usr/X11R6/lib/libSM.so.6...done.
Loaded symbols for /usr/X11R6/lib/libSM.so.6
Reading symbols from /usr/X11R6/lib/libICE.so.6...done.
Loaded symbols for /usr/X11R6/lib/libICE.so.6
Reading symbols from /usr/X11R6/lib/libXcursor.so.1...done.
Loaded symbols for /usr/X11R6/lib/libXcursor.so.1
Reading symbols from /usr/X11R6/lib/libXrender.so.1...done.
Loaded symbols for /usr/X11R6/lib/libXrender.so.1
Reading symbols from /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2...done.
Loaded symbols for /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
Reading symbols from /usr/X11R6/lib/modules/dri/r200_dri.so...done.
Loaded symbols for /usr/X11R6/lib/modules/dri/r200_dri.so
0xffffe410 in ?? ()
(gdb) bt
#0 0xffffe410 in ?? ()
#1 0xbffff494 in ?? ()
#2 0x000000be in ?? ()
#3 0x00000000 in ?? ()
#4 0x402fafb6 in gettimeofday () from /lib/tls/libc.so.6
#5 0x080d7a51 in sem_GetTicks () at linux/sdllink.c:1184
#6 0x080d748b in CheckTimers () at linux/sdllink.c:905
#7 0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
#8 0x0838f858 in tableCb ()
#9 0x4126a0b6 in ?? ()
#10 0x083144ad in spcRam ()
#11 0xbffff4cc in ?? ()
#12 0x000000be in ?? ()
#13 0x0000b230 in ?? ()
#14 0x0000183e in ?? ()
#15 0x00000001 in ?? ()
#16 0x082de7cb in cachevideo.noskip () at vcache.asm:376
#17 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
#18 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
#19 0x080d9604 in main (argc=-2074080208, argv=0x7826c426)
at linux/zloaderw.c:353
(gdb) bt full
#0 0xffffe410 in ?? ()
No symbol table info available.
#1 0xbffff494 in ?? ()
No symbol table info available.
#2 0x000000be in ?? ()
No symbol table info available.
#3 0x00000000 in ?? ()
No symbol table info available.
#4 0x402fafb6 in gettimeofday () from /lib/tls/libc.so.6
No symbol table info available.
#5 0x080d7a51 in sem_GetTicks () at linux/sdllink.c:1184
now = {tv_sec = 1107009024, tv_usec = 501425}
ticks = 85310.9766
#6 0x080d748b in CheckTimers () at linux/sdllink.c:905
i = 1093068254
#7 0x080d5837 in Check60hz () at linux/sdlintrf.asm:1248
No locals.
#8 0x0838f858 in tableCb ()
No symbol table info available.
#9 0x4126a0b6 in ?? ()
No symbol table info available.
#10 0x083144ad in spcRam ()
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#11 0xbffff4cc in ?? ()
No symbol table info available.
#12 0x000000be in ?? ()
No symbol table info available.
#13 0x0000b230 in ?? ()
No symbol table info available.
#14 0x0000183e in ?? ()
No symbol table info available.
#15 0x00000001 in ?? ()
No symbol table info available.
#16 0x082de7cb in cachevideo.noskip () at vcache.asm:376
No locals.
#17 0x08081888 in cpuover.nodohdma () at cpu/execute.asm:2438
No locals.
#18 0x08080581 in reexecuteb2.nomovie () at cpu/execute.asm:1005
No locals.
#19 0x080d9604 in main (argc=-2074080208, argv=0x7826c426)
at linux/zloaderw.c:353
opt = -1888488508
p = 1710551748
pp = 50896691
fvar = 0xe4f3c464 <Address 0xe4f3c464 out of bounds>
DarkStarSword
New Member
Posts: 4
Joined: Sun Sep 09, 2012 3:21 am

Re: Linux - Freezes when returning from menu

Post by DarkStarSword »

I've been digging into this a little on 1.51b code (also confirmed on 1.52
built from SVN as well as the Debian 1.510+bz2-4 package.

It seems that sem_GetTicks sometimes returns NAN. If this happens when resuming
the game (i.e. from Start60HZ), than the start variable can be set to NAN,
which causes this test in CheckTimers to never succeed:
while ((end - start) >= update_ticks_pc)

So it never runs Game60hzcall and therefore appears to freeze.

Using gdb to change start to a real number less than end allows zsnes to
continue.

Here's some examples stopped at a breakpoint just before sem_GetTicks returned:

(gdb) p ticks
$61 = -nan(0x400000)
(gdb) p now
$62 = {tv_sec = 1347209802, tv_usec = 938231}
(gdb) p sem_start
$63 = {tv_sec = 1347207006, tv_usec = 723535}

(gdb) p ticks
$64 = 2898023.75
(gdb) p now
$65 = {tv_sec = 1347209904, tv_usec = 747225}
(gdb) p sem_start
$66 = {tv_sec = 1347207006, tv_usec = 723535}

(gdb) p ticks
$68 = -nan(0x400000)
(gdb) p now
$69 = {tv_sec = 1347210066, tv_usec = 145221}
(gdb) p sem_start
$70 = {tv_sec = 1347207006, tv_usec = 723535}


Side note: Isn't start2 useless since revision 2397?
DarkStarSword
New Member
Posts: 4
Joined: Sun Sep 09, 2012 3:21 am

Re: Linux - Freezes when returning from menu

Post by DarkStarSword »

And here's a patch to fix it by replacing the floating point arithmetic with 64bit integer arithmetic:
https://raw.github.com/DarkStarSword/ju ... -fix.patch
Post Reply