Monday, May 13, 2013

Stack trace deobfuscation problem - missing function names

We are having a real hard time getting our stack trace deobfuscation to work correctly.

Whenever we have an exception, our stack trace looks like this:

2013-05-13T20:43:36.998257+00:00 stg-cardit1 hermione: ERROR:Unhandled client exception[0]java.lang.RuntimeException: Crash 
2013-05-13T20:43:36.998386+00:00 stg-cardit1 hermione: Caused by: 
2013-05-13T20:43:36.998479+00:00 stg-cardit1 hermione: EXCEPTION: Crash(java.lang.RuntimeException) 
2013-05-13T20:43:36.998567+00:00 stg-cardit1 hermione: Unknown.Pp(StackTraceCreator.java:174) 
2013-05-13T20:43:36.998653+00:00 stg-cardit1 hermione: Unknown.qd(StackTraceCreator.java:508) 
2013-05-13T20:43:36.998739+00:00 stg-cardit1 hermione: Unknown.td(Exception.java:29) 
2013-05-13T20:43:36.998824+00:00 stg-cardit1 hermione: Unknown.wo(RuntimeException.java:29) 
2013-05-13T20:43:36.998910+00:00 stg-cardit1 hermione: Unknown.Mid(CardServiceImpl.java:207) 
2013-05-13T20:43:36.998996+00:00 stg-cardit1 hermione: Unknown.u4c(MasterActivity.java:404) 
2013-05-13T20:43:36.999136+00:00 stg-cardit1 hermione: Unknown.m5c(MasterActivity.java:368) 
2013-05-13T20:43:36.999241+00:00 stg-cardit1 hermione: Unknown.p5c(MasterActivity.java:367) 
2013-05-13T20:43:36.999332+00:00 stg-cardit1 hermione: Unknown.Xjd(FlickrServiceImpl.java:79) 
2013-05-13T20:43:36.999418+00:00 stg-cardit1 hermione: Unknown.dkd(FlickrServiceImpl.java:92) 
2013-05-13T20:43:36.999503+00:00 stg-cardit1 hermione: Unknown.akd(FlickrServiceImpl.java:49) 
2013-05-13T20:43:36.999588+00:00 stg-cardit1 hermione: Unknown.rBd(SevogleRequestBuilder.java:29) 
2013-05-13T20:43:36.999673+00:00 stg-cardit1 hermione: Unknown.uE(Request.java:258) 
2013-05-13T20:43:36.999797+00:00 stg-cardit1 hermione: Unknown.gF(RequestBuilder.java:412) 
2013-05-13T20:43:36.999893+00:00 stg-cardit1 hermione: Unknown.anonymous(XMLHttpRequest.java:351) 
2013-05-13T20:43:36.999980+00:00 stg-cardit1 hermione: Unknown.hp(Impl.java:189) 
2013-05-13T20:43:37.000065+00:00 stg-cardit1 hermione: Unknown.kp(Impl.java:242) 
2013-05-13T20:43:37.000150+00:00 stg-cardit1 hermione: Unknown.anonymous(Impl.java:70) 

I have updated our gwt.xml file to have the following lines:

<!-- Stack track info -->

<set-property name="compiler.stackMode" value="emulated" />

<set-property name="compiler.useSourceMaps" value="true" />

<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />

<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />


The first problem we ran into is that gwtc was creating the symbolmap file with the name "null_symbolMap0.json"

We hand coded our ant build script to have it put the permuation name into the file name

WEB-INF/symbolMaps/${permutation_name}_sourceMap0.json

I also tested it with
WEB-INF/symbolMaps/${permutation_name}.sourceMap0.json 

and this is then inside the .war file.

When we go to call this, we use the following commands

        getServletContext().getRealPath("/");

        StackTraceDeobfuscator deob = new StackTraceDeobfuscator(getServletContext().getRealPath("/WEB-INF/symbolMaps")); 

 

StackTraceElement[] elements = deob.deobfuscateStackTrace(jsElements.toArray(new StackTraceElement[0]),

                                                                  gwtPermutationStrongName);

 
Where gwtPermutationStrongName is identical to the name in the file. 

The json in the symbol map looks like this:
{
"version":3,
"file":"sourceMap0",
"lineCount":8439,
"mappings":"A;AAwCA,aAAA,CAAA,CAAA......AA,IAAA;",
"sources":["com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/SeedUtil.java","com/google/gwt/emul/java/lang/Object.java",...,"com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java"],
"names":[]
}

Looking at the sourcemap, it appears that the "names" field is empty.  But I'm not sure what to do about that, since I've got the flags set above.

The build is happening in ANT, with the following 


<property name="gwt.args" value="-localWorkers 8 -extra war/WEB-INF/classes/" />
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="war/WEB-INF/classes/*.jar" />
<pathelement location="war/WEB-INF/lib/*.jar" />
<pathelement location="src" />
<pathelement location="gen" />
<path refid="project.class.path" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx2524M" />
            <!-- <arg line="-compileReport" />
            <arg line="-XsoycDetailed" /> -->
<arg line="-war" />
<arg value="war" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="com.sevogle.hermione.Hermione" />
</java>

I've seen some comments that if you have the closure compiler enable, that the stack trace functionality doesn't work, but unless it's enable by default, we don't have it enabled.

https://code.google.com/p/google-web-toolkit/issues/detail?id=7803


You can see the two files here:
https://www.dropbox.com/sh/h1bwe9e8jr2040x/RVlEdqrvHg

Thanks in advance for your time.

Adam

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment