I had a need for abcdump, which is a bytecode decompiler for ActionScript 3. Unfortunately, most of the instructions on the Web right now regarding how to compile this particular piece of software seem to refer to older versions of the Tamarin codebase and so no longer work. It took about an hour to piece together information to get the compilation process working again. So, here are some up-to-date instructions on how to compile abcdump from source. (No doubt that these instructions will become wrong too at some point in the future!)

  1. Follow the official Tamarin Build Documentation to get a working version of avmshell (formerly known as avmplus). You may need to modify the Makefile that configure.py generates, changing -fstrict-aliasing to -fno-strict-aliasing, in order to get it to compile successfully. (This is required only if you get the error “dereferencing type-punned pointer will break strict-aliasing rules”.)
  2. Get a copy of asc.jar, either by building it, or by downloading the latest version of the Flex 3 SDK. Copy it into the tamarin-central/utils directory.
  3. Re-compile the builtin library: cd tamarin-central/core; java -ea -DAS3 -Xmx200m -DAVMPLUS -classpath ../utils/asc.jar macromedia.asc.embedding.ScriptCompiler -d -builtin -out builtin builtin.as Math.as Error.as RegExp.as Date.as XML.as. Failing to do this will result in “The definition of base class Object was not found.” on the next step.
  4. Compile the ByteArray library: cd tamarin-central; java -jar utils/asc.jar -import core/builtin.abc shell/ByteArray.as
  5. Compile abcdump: cd tamarin-central; java -jar utils/asc.jar -exe objdir-release/shell/avmshell -import core/builtin.abc -import shell/ByteArray.abc utils/abcdump.as

Following these instructions, you should now have a stand-alone, executable abcdump.exe in the utils directory. One caveat to note is that you will need to pass “--” as the first argument when you try to run the stand-alone executable, since otherwise the virtual machine interprets the arguments as its own instead of passing them to the application. Happy hacking!

0 Responses to this post

There are currently no comments.