You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/03/21 07:18:05 UTC

[royale-compiler] branch develop updated: add more diagnostics to help when SWFDump fails

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6f9109a  add more diagnostics to help when SWFDump fails
6f9109a is described below

commit 6f9109a101d1491ccc089f81f1f4520c5c680d1a
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Mar 21 00:17:52 2018 -0700

    add more diagnostics to help when SWFDump fails
---
 .../main/java/org/apache/royale/abc/ABCParser.java | 39 ++++++++++++++++++++++
 .../java/org/apache/royale/swf/io/SWFDump.java     | 12 +++++++
 2 files changed, 51 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/abc/ABCParser.java b/compiler/src/main/java/org/apache/royale/abc/ABCParser.java
index 71713b4..e9d26c5 100644
--- a/compiler/src/main/java/org/apache/royale/abc/ABCParser.java
+++ b/compiler/src/main/java/org/apache/royale/abc/ABCParser.java
@@ -41,6 +41,9 @@ import static org.apache.royale.abc.ABCConstants.*;
  */
 public class ABCParser
 {
+	public boolean verbose = false;
+	public PrintWriter output;
+	
     /**
      * The ABC as a byte array.
      */
@@ -159,6 +162,9 @@ public class ABCParser
 
         vabc.visit(major, minor);
 
+        if (verbose)
+        	output.println("parsing int pool");
+        	
         pool_size = p.readU30();
         ints = new int[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -167,6 +173,9 @@ public class ABCParser
             vabc.visitPooledInt(ints[i]);
         }
 
+        if (verbose)
+        	output.println("parsing uint pool");
+        
         pool_size = p.readU30();
         uints = new long[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -175,6 +184,9 @@ public class ABCParser
             vabc.visitPooledUInt(uints[i]);
         }
 
+        if (verbose)
+        	output.println("parsing float pool");
+        
         pool_size = p.readU30();
         doubles = new double[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -183,6 +195,9 @@ public class ABCParser
             vabc.visitPooledDouble(doubles[i]);
         }
 
+        if (verbose)
+        	output.println("parsing string pool");
+
         pool_size = p.readU30();
         strings = new String[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -201,6 +216,9 @@ public class ABCParser
             p.pos += len;
         }
 
+        if (verbose)
+        	output.println("parsing namespace pool");
+        
         pool_size = p.readU30();
         namespaces = new Namespace[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -212,6 +230,9 @@ public class ABCParser
             vabc.visitPooledNamespace(namespaces[i]);
         }
 
+        if (verbose)
+        	output.println("parsing namespace_set pool");
+        
         pool_size = p.readU30();
         namespace_sets = new Nsset[pool_size];
         for (int i = 1; i < pool_size; i++)
@@ -228,6 +249,9 @@ public class ABCParser
 
         pool_size = p.readU30();
 
+        if (verbose)
+        	output.println("parsing name pool");
+        
         names = new Name[pool_size];
         List<NameAndPos> forward_ref_names = null;
         for (int i = 1; i < pool_size; i++)
@@ -267,6 +291,9 @@ public class ABCParser
             p.pos = orig_pos;
         }
 
+        if (verbose)
+        	output.println("parsing method pool");
+        
         int n_methods = p.readU30();
         this.methodInfos = new MethodInfo[n_methods];
         this.methodVisitors = new IMethodVisitor[n_methods];
@@ -278,6 +305,9 @@ public class ABCParser
                 this.methodVisitors[i].visit();
         }
 
+        if (verbose)
+        	output.println("parsing metadata pool");
+        
         pool_size = p.readU30();
         metadata = new Metadata[pool_size];
         for (int i = 0; i < pool_size; i++)
@@ -286,6 +316,9 @@ public class ABCParser
             vabc.visitPooledMetadata(metadata[i]);
         }
 
+        if (verbose)
+        	output.println("parsing instances pool");
+        
         //  InstanceInfos and ClassInfos are stored in
         //  homogenous arrays in the ABC, but their
         //  IClassVisitor needs both in its constructor; so
@@ -323,6 +356,9 @@ public class ABCParser
             }
         }
 
+        if (verbose)
+        	output.println("parsing scripts pool");
+        
         int n_scripts = p.readU30();
         for (int i = 0; i < n_scripts; i++)
         {
@@ -339,6 +375,9 @@ public class ABCParser
             }
         }
 
+        if (verbose)
+        	output.println("parsing method bodies pool");
+        
         int n_method_bodies = p.readU30();
         for (int i = 0; i < n_method_bodies; i++)
         {
diff --git a/compiler/src/main/java/org/apache/royale/swf/io/SWFDump.java b/compiler/src/main/java/org/apache/royale/swf/io/SWFDump.java
index 228025f..4c35786 100644
--- a/compiler/src/main/java/org/apache/royale/swf/io/SWFDump.java
+++ b/compiler/src/main/java/org/apache/royale/swf/io/SWFDump.java
@@ -391,6 +391,7 @@ public final class SWFDump
     private Integer swfVersion = null;
 
     private boolean abc = false;
+    private boolean verbose = false;
     private boolean showActions = true;
     private boolean showOffset = false;
     @SuppressWarnings("unused")
@@ -2283,7 +2284,11 @@ public final class SWFDump
             open(tag);
             end();
             ABCParser parser = new ABCParser(tag.getABCData());
+            parser.verbose = verbose;
+            parser.output = out;
             PoolingABCVisitor printer = new ABCDumpVisitor(out, sortOption);
+            if (verbose)
+            	out.println("doABC for " + tag.getName());
             parser.parseABC(printer);
             close(tag);
         }
@@ -2363,6 +2368,7 @@ public final class SWFDump
 
     // options
     public static boolean abcOption = false;
+    public static boolean verboseOption = false;
     static boolean encodeOption = false;
     static boolean showActionsOption = true;
     static boolean showOffsetOption = false;
@@ -2408,6 +2414,11 @@ public final class SWFDump
                 encodeOption = true;
                 ++index;
             }
+            else if (args[index].equals("-verbose"))
+            {
+                ++index;
+                verboseOption = true;
+            }
             else if (args[index].equals("-save"))
             {
                 ++index;
@@ -2636,6 +2647,7 @@ public final class SWFDump
         //        swfDump.setExternal(externalOption, outfile);
         //        swfDump.decompile = decompileOption;
         swfDump.abc = abcOption;
+        swfDump.verbose = verboseOption;
         //        swfDump.defunc = defuncOption;
         //        swfDump.tabbedGlyphs = tabbedGlyphsOption;
 

-- 
To stop receiving notification emails like this one, please contact
aharui@apache.org.