Debugging Flash on Linux

February 27th, 2007

While the standalone Flash Player on Linux is pretty good, but it kept crashing on me the other day when I tried to use fdb with it. I thought up another solution, and it works surprisingly well. It uses wine with the Windows version of the standalone player as an alternative player for Linux.

First, make sure wine is installed. If you’re using Ubuntu, you’ll need to enable the community maintained (universe) repository in Synaptic in order for it to become available. You should already have the Flex SDK, if not I have more on this in my guide to Flash development on Linux. Create a file called gflashplayer in Flex’s bin folder unless it already exists. If that’s the case then it’s probably your regular debug player. Rename the old one flashplayer-debug and then create the empty file gflashplayer. Open gflashplayer as a text file and write this…

if $USEWINE; then
wine $(dirname "$0")/../player/debug/SAFlashPlayer.exe $*
$(dirname "$0")/flashplayer-debug $*

Now whenever gflashplayer is run, it will redirect it to the wine-powered instance of SAFlashPlayer.exe. It works for debugging too, at least on my computer (Ubuntu 6.10, wine 0.9.30-0). You may need to configure wine first, try typing winecfg in the terminal and adjust the settings.

I still like the Linux version better, but it’s good to have the alternative ready when you need it. If you want to switch back, change USEWINE=true to USEWINE=false. You’ll need to have the Linux debug player (available here) named flashplayer-debug and located in Flex’s bin folder.

Update: How strange, the wine-powered standalone player is the most stable Flash player I’ve used yet. On Windows it would occasionally be unable to connect to the debugger until I restarted Eclipse, usually related to having to many players open at the same time. On Linux it will crash unexpectedly. Now I can have a dozen debuggers open at the same time with no crashes yet.

Leave a Reply