GNOME Bugzilla – Bug 498237
nsfdec crash with SK8ORDIE.
Last modified: 2008-03-25 15:55:53 UTC
Version: 2.20.0 What were you doing when the application crashed? Testing out the new playback support for Nes Sound Format, playing the NSF available at http://www.atarihq.com/tsr/nsf/sk8die2.zip Distribution: Debian lenny/sid Gnome Release: 2.20.1 2007-10-26 (Debian) BugBuddy Version: 2.20.1 System: Linux 2.6.22-2-amd64 #1 SMP Thu Aug 30 23:43:59 UTC 2007 x86_64 X Vendor: The X.Org Foundation X Vendor Release: 10400000 Selinux: No Accessibility: Disabled GTK+ Theme: Gorilla Icon Theme: Gorilla Memory status: size: 391299072 vsize: 391299072 resident: 35446784 share: 14872576 rss: 35446784 rss_rlim: 18446744073709551615 CPU usage: start_time: 1195492085 rtime: 87 utime: 80 stime: 7 cutime:0 cstime: 0 timeout: 0 it_real_value: 0 frequency: 100 Backtrace was generated from '/usr/bin/totem' (no debugging symbols found) Using host libthread_db library "/lib/libthread_db.so.1". (no debugging symbols found) [Thread debugging using libthread_db enabled] [New Thread 0x2afa8322c480 (LWP 25675)] [New Thread 0x44007950 (LWP 25685)] [New Thread 0x43806950 (LWP 25684)] [New Thread 0x43005950 (LWP 25683)] [New Thread 0x42804950 (LWP 25682)] [New Thread 0x42003950 (LWP 25681)] [New Thread 0x41802950 (LWP 25680)] [New Thread 0x41001950 (LWP 25679)] [New Thread 0x40800950 (LWP 25677)] 0x00002afa80869d46 in poll () from /lib/libc.so.6
+ Trace 178744
Thread 3 (Thread 0x43806950 (LWP 25684))
----------- .xsession-errors (1981 sec old) --------------------- (evolution:15766): gtkhtml-WARNING **: invalid character value: xdcbbd (evolution:15766): gtkhtml-WARNING **: invalid character value: x1e3ebbd (evolution:15766): gtkhtml-WARNING **: invalid character value: xd862d (evolution:15766): gtkhtml-WARNING **: invalid character value: x1b78a3d VLC media player 0.8.6c Janus ** (.:22994): CRITICAL **: gtk_pizza_set_size: assertion `pizza != NULL' failed [00000287] main playlist: stopping playback VLC media player 0.8.6c Janus ** (.:25328): CRITICAL **: gtk_pizza_set_size: assertion `pizza != NULL' failed [00000287] main playlist: stopping playback --------------------------------------------------
Problem not reproduced without using Totem, so reassigning to gstreamer ("plugins bad" probably means I shouldn't expect much from the plugins, but reporting the problems might be useful anyway). $ gst-launch-0.10 playbin uri=file:///tmp/SK8DIE2.NSF Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstAudioSinkClock Caught SIGSEGV accessing address 0x915
+ Trace 178748
Here's a probably more helpful backtrace: Program received signal SIGSEGV, Segmentation fault. 0x00002aec1ecda0d6 in nes6502_execute (remaining_cycles=28188) at nes6502.c:1404 1404 switch (opcode) { (gdb) bt
+ Trace 183589
$6 = 6422 I noted that PC is always 6422 and remaining_cycles always 28188 when it crashes... I also guess the segfault shows up first on the switch because of the optimization. I guess the real problem is line 1401: opcode = bank_readbyte (PC++); I though maybe this was a 64bit problem in the original (old?) code, but I've compiled http://belnet.dl.sourceforge.net/sourceforge/nosefart/nosefart-2.6-mls.tar.bz2 (which I guess is the original code for nsfdec) which plays the file without problem on my system.
Andreas, Thanks for the detailed analysis! gst-plugins-bad (which provides the gstreamer plugin nsfdec) currently ships with an included copy of nosefart. Perhaps that version is out of date and needs to be updated to be able to play skate or die. I currently don't have too much time to do this myself, but perhaps you could give it a go? If you do so, remember that there are some (minor) modifications done to the gstreamer copy of nosefart, they need to be forward ported to the new copy.
I just tried copying nes6502.{c,h} from the downloaded version of nosefart, and adding #define NES6502_MEM_ACCESS_CTRL 1 to the top of both these files (as that is defined on the command line when you build nosefart) - replacing the files in gstreamer0.10-plugins-bad in Debians package. It actually built, but it crashed with something which looks totally different but seems to be the equivalent place for the new code.... I guess trying random things won't solve this. I think the next step would be to actually try to understand the code and I don't think I have enough motivation to dig that deep.... Sorry. :( Maybe one day I'll get bored enough to have a look again...
You would need to copy over quite a few more files, all .c and .h files minus the gstnsf.[ch] pair needs to be updated.
The "boring enough" day is apparently today! Updating all *.c and *.h files from nosefart-2.7-mls, plus adding the new memguard.{c,h} does indeed solve the problem.
Created attachment 107928 [details] [review] Update files from nosefart-2.7-mls, add memguard.* and update Makefile.am. This patch is against gstreamer0.10-plugins-bad 0.10.6 (debian sid package). I've done the following: Download and extract nosefart-2.7-mls.tar.bz2 as /tmp/nosefart-2.7-mls/ Get g-plugins-bad source and cd gst/nsf/ for a in *.c *.h memguard.c memguard.h do cp $(find /tmp/nosefart-2.7-mls/ -name $a) . done Edit Makefile.am and add memguard.c and memguard.h in the lists of nosefart source files. cd ../.. ; automake Rebuilding gstreamer plugins bad from this updated source can play the sk8ordie.nsf file without problem.
2008-03-25 Sebastian Dröge <slomo@circular-chaos.org> Patch by: Andreas Henriksson <andreas at fatal dot set> * gst/nsf/Makefile.am: * gst/nsf/dis6502.h: * gst/nsf/fds_snd.c: * gst/nsf/fds_snd.h: * gst/nsf/fmopl.c: * gst/nsf/fmopl.h: * gst/nsf/gstnsf.c: * gst/nsf/log.c: * gst/nsf/log.h: * gst/nsf/memguard.c: * gst/nsf/memguard.h: * gst/nsf/mmc5_snd.c: * gst/nsf/mmc5_snd.h: * gst/nsf/nes6502.c: * gst/nsf/nes6502.h: * gst/nsf/nes_apu.c: * gst/nsf/nes_apu.h: * gst/nsf/nsf.c: * gst/nsf/nsf.h: * gst/nsf/osd.h: * gst/nsf/types.h: * gst/nsf/vrc7_snd.c: * gst/nsf/vrc7_snd.h: * gst/nsf/vrcvisnd.c: * gst/nsf/vrcvisnd.h: Update our internal nosefart to nosefart-2.7-mls to fix segfaults on some files. Fixes bug #498237. Remove some // comments, fix some compiler warnings and use pow() instead of a slow, selfmade implementation.