x64 crashes with -cartcrt on command line
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
The current version (2.4.7 from tarball) crashes when starting a cartridge from command-line with a Segmentation fault: 11.
How I build (10.9 on x86_64) and launched it:
./configure --with-cocoa make all bindist ./vice-macosx-cocoa-x86_64-2.4.7/x64.app/Contents/MacOS/x64 -cartcrt /tmp/choplifter.crt
I've also tested it with an EasyFlash cartridge - same result. x64sc has also the same bug.
It works well when I start x64 from command line without the -cartcrt option and then add the cartridge via menu.
Older versions do work fine, e.g. 2.4 releae:
/Volumes/vice-macosx-cocoa-i386+x86_64-10.6-gcc42-2.4/x64.app/Contents/MacOS/x64 -cartcrt /tmp/choplifter.crt
could you provide some more info on what compiler exactly you used and what your setup looks like? it doesnt do that in linux, so it must be some OSX specific issue. can you do a gdb backtrace?
I've attached the configure output - hope that helps.
I can launch prg's via cmdline fine - it's not an general cmdline problem. But specifying arguments to options, e.g.
-chdir /tmp/
also crashes. Options without arguments, e.g.-sound
also works fine.Here is the lldb output:
Last edit: ALeX Kazik 2014-07-31
I've compiled a brunch of vice (development) releases:
2.4 and 2.4.1 work with the command line, 2.4.2 and 2.4.3 do crash.
mmmh, please try with r28194, maybe that fixes it...
if not, it would help if you could do the following:
x64 -cartcrt yourcart.crt
x64 -cartcrt yourcart.crt foo
x64 -cartcrt yourcart.crt foo bar
That didn't fix it.
With foo as an extra argument I get one of three resuts, without and with foo bar it crashes always.
x64 -cartcrt yourcart.crt:
x64 -cartcrt yourcart.crt foo: (works)
x64 -cartcrt yourcart.crt foo: (crashes)
x64 -cartcrt yourcart.crt foo: (hangs)
x64 -cartcrt yourcart.crt foo bar:
The bug is at the end of
cmdline_parse()
. When the remaining arguments are moved to the beginning ofargv[]
,*argc
is compared toj
, in order to see where to stop. But,*argc
is the size of the oldargv[]
, whilej
is the subscript into the newargv[]
. Therefore, the Macintosh-built code sometimes copies more stuff (garbage) than it should copy.I have attached a patch that should fix the problem.
Last edit: Greg King 2014-08-04
That did the trick. Thanks!
well spotted - applied in r28219
thanks for the patch!