dump does not export bytecode

44 views
Skip to first unread message

Devboy

unread,
Jun 7, 2011, 2:46:23 PM6/7/11
to apparat-framework
I was trying to export abc-files with the dump tool. And i thought the
option "-bc raw" would allow me to do so.

But running this:

dump -i lib.swc -bc raw

results in:

[INFO] Apparat -- http://apparat.googlecode.com/
[INFO] Launching tool: Dump
[WARNING] Nothing specified to export. Try the -h option for help.
[INFO] Completed in 232ms.

Does -bc mean something else, or is it a little bug.
ABC Info and SWF Info output works fine.

Cheers

Joa Ebert

unread,
Jun 7, 2011, 3:38:15 PM6/7/11
to apparat-...@googlegroups.com
The -bc option must be used with -abc.

dump -i lib.swc -abc -bc raw

This should work.


Best,

Joa

Dominic Graefen

unread,
Jun 7, 2011, 5:18:09 PM6/7/11
to apparat-...@googlegroups.com
I still only get the info textfiles and no abc file.

-- 
Dominic Graefen

pleclech

unread,
Jun 8, 2011, 6:00:07 PM6/8/11
to apparat-framework
Hi Dominic,

Dump will export txt file it will not extract abc one. 'raw' option
only
show in the dump the bytecode as an hexadecimal dump.

Best,
Patrick.

On Jun 7, 11:18 pm, Dominic Graefen <dominic.grae...@gmail.com> wrote:
> I still only get the info textfiles and no abc file.
>
> --
> Dominic Graefen
>
>
>
>
>
>
>
> On Tuesday, June 7, 2011 at 9:38 PM, Joa Ebert wrote:
> > The -bc option must be used with -abc.
>
> > dump -i lib.swc -abc -bc raw
>
> > This should work.
>
> > Best,
>
> > Joa
>
> > Am 07.06.2011 20:46, schrieb Devboy:
> > > I was trying to export abc-files with the dump tool. And i thought the
> > > option "-bc raw" would allow me to do so.
>
> > > But running this:
>
> > > dump -i lib.swc -bc raw
>
> > > results in:
>
> > > [INFO] Apparat --http://apparat.googlecode.com/

Dominic Graefen

unread,
Jun 9, 2011, 2:12:08 AM6/9/11
to apparat-...@googlegroups.com
Hi Patric,

thanks for the answer!
I was just looking for a way to skip the step of extracting the swf in a swc, but that isn't much work anyway :)

Best,

-- 
Dominic Graefen

Joa Ebert

unread,
Jun 9, 2011, 4:28:39 AM6/9/11
to apparat-...@googlegroups.com

Use apparat :)

Swf fromFile "foo.swc"

Sent from my Google Nexus One.

Am 09.06.2011 08:12 schrieb "Dominic Graefen" <dominic...@gmail.com>:
> Hi Patric,
>
> thanks for the answer!
> I was just looking for a way to skip the step of extracting the swf in a swc, but that isn't much work anyway :)
>
> Best,
>
> --
> Dominic Graefen
>
>
> On Thursday, June 9, 2011 at 12:00 AM, pleclech wrote:
>
>> Hi Dominic,
>>
>> Dump will export txt file it will not extract abc one. 'raw' option
>> only
>> show in the dump the bytecode as an hexadecimal dump.
>>
>> Best,
>> Patrick.
>>

Dominic Graefen

unread,
Jun 9, 2011, 4:31:19 AM6/9/11
to apparat-...@googlegroups.com
True, gotta pimp my Scala skills anyway.

-- 
Dominic Graefen

pleclech

unread,
Jun 9, 2011, 5:23:26 PM6/9/11
to apparat-framework
:)

On Jun 9, 10:28 am, Joa Ebert <joaeb...@googlemail.com> wrote:
> Use apparat :)
>
> Swf fromFile "foo.swc"
>
> Sent from my Google Nexus One.
> Am 09.06.2011 08:12 schrieb "Dominic Graefen" <dominic.grae...@gmail.com>:> Hi Patric,

Dominic Graefen

unread,
Jun 15, 2011, 11:45:13 AM6/15/11
to apparat-...@googlegroups.com
I am just getting my feet wet with Scala and Apparat.
I'm trying to get the Bytecode from a swc or swf, merge the bytecode and then save the abc file.
I didn't get very far:

package org.devboy.apparat

import apparat.swf.Swf
import apparat.swc.Swc

object ABCDump
{
  def main(args: Array[String])
  {
    val swc: Swc = Swc fromFile "foo.swc"
    val swf: Swf = Swf fromSwc swc
  }
}


Throws me the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/runtime/AbstractFunction0$mcL$sp
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at apparat.swf.SwfInputStream.readUI32(SwfInputStream.scala:123)
at apparat.swf.Swf.read(Swf.scala:124)
at apparat.swf.Swf.read(Swf.scala:107)
at apparat.swf.Swf$.fromSwc(Swf.scala:73)
at org.devboy.apparat.ABCDump$.main(ABCDump.scala:13)
at org.devboy.apparat.ABCDump.main(ABCDump.scala)
Caused by: java.lang.ClassNotFoundException: scala.runtime.AbstractFunction0$mcL$sp
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 18 more


Am I missing dependencies in the classpath, or am I doing something else wrong?

-- 
Dominic Graefen

Joa Ebert

unread,
Jun 15, 2011, 12:01:09 PM6/15/11
to apparat-...@googlegroups.com

Which scala Version?

Sent from my Google Nexus One.

Dominic Graefen

unread,
Jun 15, 2011, 12:04:53 PM6/15/11
to apparat-...@googlegroups.com
Right now with: scala-2.9.0.1

I'll give it a go with 2.8.1 now.

-- 
Dominic Graefen

Joa Ebert

unread,
Jun 15, 2011, 12:07:44 PM6/15/11
to apparat-...@googlegroups.com

2.9.0.1 if you build from latest src

Sent from my Google Nexus One.

Am 15.06.2011 18:04 schrieb "Dominic Graefen" <dominic...@gmail.com>:
> Right now with: scala-2.9.0.1
>
> I'll give it a go with 2.8.1 now.
>
> --
> Dominic Graefen
>
>
> On Wednesday, June 15, 2011 at 6:01 PM, Joa Ebert wrote:
>
>> Which scala Version?
>> Sent from my Google Nexus One.
>> >>> Am 09.06.2011 08:12 schrieb "Dominic Graefen" <dominic.grae...@gmail.com (mailto:dominic.grae...@gmail.com)>:> Hi Patric,

Dominic Graefen

unread,
Jun 15, 2011, 12:10:42 PM6/15/11
to apparat-...@googlegroups.com
I was linking to the RC9 jars.
Will build them from source then.

Thanks

-- 
Dominic Graefen

On Wednesday, June 15, 2011 at 6:08 PM, Dominic Graefen wrote:

And I am linking

-- 
Dominic Graefen

Dominic Graefen

unread,
Jun 15, 2011, 3:36:11 PM6/15/11
to apparat-...@googlegroups.com
So, 100 pages further in that Scala book :P

I built the jars from source and linking against them solves my earlier issue,
now I am just curious about the API.

As said before my goal is to load the bytecode from a swc/swf merge it into a single ABC file and save it to disk.

Current approach:

val swc: Swc = Swc fromFile "foo.swc"
val swf: Swf = Swf fromSwc swc
val abc: Abc = Abc.fromSwf(swf).get
if (!abc.bytecodeAvailable)
   abc.loadBytecode()
println(abc.dump())
abc.write("foo.abc");

Current problems:
1. The dump just dumps 1 interface of all the classes & interfaces in my swc.
2. The saved file foo.abc seems to only include that interfaces too.

Questions:
How can i get the whole bytecode of that swf? Multiple Abc blocks.

Is there a (simple) way to run the reducer tool to merge those Abc blocks into one?

Thanks,

-- 
Dominic Graefen

Dominic Graefen

unread,
Jun 15, 2011, 6:22:57 PM6/15/11
to apparat-...@googlegroups.com
Hi there.

I took a look at the ReducerTool, but Scala still reads like Egyptian Glyphs to me, so I didn't come to good solution yet.
But I finally got something that does the job:

----

    val swc_input = "foo.swc"
    val abc_output = "foo.abc"
    val swc_temp = "foo_temp.swc"

    val reducer: ReducerTool = new ReducerTool();
    reducer.configure(new ReducerConfiguration {
      def quality: Float = 0.99f

      def lzma: Boolean = false

      def sortCPool: Boolean = false

      def deblock: Float = 0.0f

      def matryoshka: Option[File] = None

      def mergeABC: Boolean = true

      def matryoshkaType: Int = MatryoshkaType.QUIET

      def mergeCF: Boolean = false

      def output: File = new File(swc_temp)

      def input: File = new File(swc_input)
    })
    reducer.run()

    val swc: Swc = Swc fromFile swc_temp
    val swf: Swf = Swf fromSwc swc
    val abc: Abc = Abc.fromSwf(swf).get
    abc.write(abc_output);

---

I know that this can probably be done in a smarter way,
but like I said I couldn't decipher how to merge the bytecode.

I would appreciate any hint and advise I can get to improve it so I can get rid of the reducer call and the creation of that temp-file.
In the meanwhile i'll dig deeper into that scala book.

Thanks,

-- 
Dominic Graefen

pleclech

unread,
Jun 16, 2011, 5:19:36 AM6/16/11
to apparat-framework
Hi Dominic,

Here just an adaptation of merge function included in reducer :
http://pastebin.com/UiQPx1FJ

Best,
Patrick

On Jun 16, 12:22 am, Dominic Graefen <dominic.grae...@gmail.com>
wrote:
> > > > > > >> On Jun 9, 10:28 am, Joa Ebert <joaeb...@googlemail.com (mailto:joaeb...@googlemail.com)> wrote:
>
> > > > > > >>> Use apparat :)
>
> > > > > > >>> Swf fromFile "foo.swc"
>
> > > > > > >>> Sent from my Google Nexus One.
> > > > > > >>> Am 09.06.2011 08:12 schrieb "Dominic Graefen" <dominic.grae...@gmail.com (mailto:dominic.grae...@gmail.com)>:> Hi Patric,
>
> > > > > > >>>> thanks for the answer!
> > > > > > >>>> I was just looking for a way to skip the step of extracting the swf in a
>
> > > > > > >>> swc, but that isn't much work anyway :)
>
> > > > > > >>>> Best,
>
> > > > > > >>>> --
> > > > > > >>>> Dominic Graefen
>
> > > > > > >>>> On Thursday, June 9, 2011 at 12:00 AM, pleclech wrote:
>
> > > > > > >>>>> Hi Dominic,
>
> > > > > > >>>>> Dump will export txt file it will not extract abc one. 'raw' option
> > > > > > >>>>> only
> > > > > > >>>>> show in the dump the bytecode as an hexadecimal dump.
>
> > > > > > >>>>> Best,
> > > > > > >>>>> Patrick.
>

Dominic Graefen

unread,
Jun 16, 2011, 5:26:04 AM6/16/11
to apparat-...@googlegroups.com
Hi Patrick,

great! I will check it out later today.

Many thanks,

-- 
Dominic Graefen

Dominic Graefen

unread,
Jun 16, 2011, 3:43:01 PM6/16/11
to apparat-...@googlegroups.com
Thanks Patrick,

finally got around to test it, works like a charm!

Best,

-- 
Dominic Graefen

pleclech

unread,
Jun 16, 2011, 5:37:37 PM6/16/11
to apparat-framework
You 're welcome.

Patrick.

On Jun 16, 9:43 pm, Dominic Graefen <dominic.grae...@gmail.com> wrote:
> Thanks Patrick,
>
> finally got around to test it, works like a charm!
>
> Best,
>
> --
> Dominic Graefen
>
>
>
>
>
>
>
> On Thursday, June 16, 2011 at 11:26 AM, Dominic Graefen wrote:
> > Hi Patrick,
>
> > great! I will check it out later today.
>
> > Many thanks,
>
> > --
> > Dominic Graefen
>
> > On Thursday, June 16, 2011 at 11:19 AM, pleclech wrote:
>
> > > Hi Dominic,
>
> > > Here just an adaptation of merge function included in reducer :
> > >http://pastebin.com/UiQPx1FJ
>
> > > Best,
> > > Patrick
>
> > > On Jun 16, 12:22 am, Dominic Graefen <dominic.grae...@gmail.com (http://gmail.com)>
> > > > > > > > > > > On Jun 9, 10:28 am, Joa Ebert <joaeb...@googlemail.com (http://googlemail.com) (mailto:joaeb...@googlemail.com (http://googlemail.com))> wrote:
>
> > > > > > > > > > > > Use apparat :)
>
> > > > > > > > > > > > Swf fromFile "foo.swc"
>
> > > > > > > > > > > > Sent from my Google Nexus One.
> > > > > > > > > > > > Am 09.06.2011 08:12 schrieb "Dominic Graefen" <dominic.grae...@gmail.com (http://gmail.com) (mailto:dominic.grae...@gmail.com (http://gmail.com))>:> Hi Patric,
>
> > > > > > > > > > > > > thanks for the answer!
> > > > > > > > > > > > > I was just looking for a way to skip the step of extracting the swf in a
>
> > > > > > > > > > > > swc, but that isn't much work anyway :)
>
> > > > > > > > > > > > > Best,
>
> > > > > > > > > > > > > --
> > > > > > > > > > > > > Dominic Graefen
>
> > > > > > > > > > > > > On Thursday, June 9, 2011 at 12:00 AM, pleclech wrote:
>
> > > > > > > > > > > > > > Hi Dominic,
>
> > > > > > > > > > > > > > Dump will export txt file it will not extract abc one. 'raw' option
> > > > > > > > > > > > > > only
> > > > > > > > > > > > > > show in the dump the bytecode as an hexadecimal dump.
>
> > > > > > > > > > > > > > Best,
> > > > > > > > > > > > > > Patrick.
>
> > > > > > > > > > > > > > On Jun 7, 11:18 pm, Dominic Graefen <dominic.grae...@gmail.com (http://gmail.com) (mailto:dominic.grae...@gmail.com (http://gmail.com)) (http://gmail.com)> wrote:
>
> > > > > > > > > > > > > > > I still only get the info textfiles and no abc file.
>
> > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > Dominic Graefen
>
> > > > > > > > > > > > > > > On Tuesday, June 7, 2011 at 9:38 PM, Joa Ebert wrote:
>
> > > > > > > > > > > > > > > > The -bc option must be used with -abc.
>
> > > > > > > > > > > > > > > > dump -i lib.swc -abc -bc raw
>
> > > > > > > > > > > > > > > > This should work.
>
> > > > > > > > > > > > > > > > Best,
>
> > > > > > > > > > > > > > > > Joa
>
> > > > > > > > > > > > > > > > Am 07.06.2011 20:46, schrieb Devboy:
>
> > > > > > > > > > > > > > > > > I was trying to export abc-files with the dump tool. And i thought
>
> > > > > > > > > > > > the
>
> > > > > > > > > > > > > > > > > option "-bc raw" would allow me to do so.
>
> > > > > > > > > > > > > > > > > But running this:
>
> > > > > > > > > > > > > > > > > dump -i lib.swc -bc raw
>
> > > > > > > > > > > > > > > > > results in:
>
> > > > > > > > > > > > > > > > > [INFO] Apparat --http://apparat.googlecode.com/
> > > > > > > > > > > > > > > > > [INFO] Launching tool: Dump
> > > > > > > > > > > > > > > > > [WARNING] Nothing specified to export. Try the -h
>
> ...
>
> read more »

Dominic Graefen

unread,
Jun 16, 2011, 5:52:49 PM6/16/11
to apparat-...@googlegroups.com
Hi Patrick,

do you see any theoretical problems with merging multiple swc/swf files into a single abc files?
Would it crash if you got two swc's libraries that contain identical classes?

I am just thinking that i could create a REPL for my AS3 projects with redtamarin,
where I would have access to my project's libraries.

Cheers,

-- 
Dominic Graefen

Reply all
Reply to author
Forward
0 new messages