Abcdump for Flash Player

Has anyone converted Adobe’s bytecode dumper abcdump.as (as seen here) so that it’ll work with an ActionScript compiler that targets Flash Player? The one that’s distributed in the Tamarin source is targeted at avmplus standalone. That’s fine, but I want to use it in a SWF that’s running in Flash Player. I made a conversion attempt myself just now, but it doesn’t seem to work correctly, so I was wondering if someone had already done the conversion before me.

If not, here’s my first stab at a conversion: http://temp.reclipse.net/ABCDump.as

The notable changes that I made are:
[LIST]
[]changed ‘print’ to ‘trace’
[
]moved everything out of the package block, because you’re only allowed one externally visible definition with this ASC
[]created a dummy ABCDump class that operates on a ABC file ByteArray that’s passed in
[
]renamed ‘abc-constants.as’ because Flash Builder was complaining, but I changed the include statement to reflect that change
[]removed the tail section marked “// main”, since I’m passing ABC ByteArrays directly to the ABCDump constructor and making Abc instances from there
[
]commented out most/all of the throw statements
[/LIST]

The output that I get looks something like this:

/* ABC ByteArray size:  2095 */
// magic 1000000
// Cpool numbers size 874 41 %
// Cpool strings count 28 size 829 39 %
// Cpool namespaces count 8 size 8 0 %
// Cpool nssets count 9 size 85 4 %
// Cpool names count 11 size 11 0 %

Obviously it’s not a great idea to comment out the throws, but I wasn’t getting any output other than that magic constant until I started removing them, because it didn’t like the constant. The output suggests that the parser is making sense of at least some of the ABC file, but not all of it.

Anyway, it’d be neat if someone has already done this, or wants to help convert it with me. :slight_smile: