无法使GWT函数名称进行反混淆处理

时间:2013-05-13 21:22:25

标签: gwt stack-trace deobfuscation

我们很难让堆栈跟踪反模糊处理正常工作。

每当我们遇到异常时,我们的堆栈跟踪如下所示:

2013-05-13T20:43:36.990952+00:00 stg-cardit1 hermione: PermutationStrongName: 4212E9F1A585F0854FEF253CBA77BD18 
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) 

我已将gwt.xml文件更新为以下行:

<!-- 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" />

我们遇到的第一个问题是gwtc正在创建名为“null_symbolMap0.json”的符号图文件

我们手工编写了我们的ant构建脚本,让它将permuation名称放入文件名

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

我也用

测试了它
WEB-INF/symbolMaps/${permutation_name}.sourceMap0.json 

然后在.war文件中。

当我们去打电话时,我们使用以下命令

getServletContext().getRealPath("/");

StackTraceDeobfuscator deob = new StackTraceDeobfuscator(getServletContext().getRealPath("/WEB-INF/symbolMaps")); 
StackTraceElement[] elements = deob.deobfuscateStackTrace(jsElements.toArray(new StackTraceElement[0]), gwtPermutationStrongName);

其中gwtPermutationStrongName与文件中的名称相同。

符号映射中的json如下所示:

{
"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":[]
}

查看源图,似乎“名称”字段为空。但是我不知道该怎么做,因为我已经设置了上面的标志。

构建正在ANT中进行,具体如下

<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>

我已经看到一些注释,如果你有闭包编译器启用,堆栈跟踪功能不起作用,但除非它默认启用,否则我们没有启用它。

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

您可以在此处查看这两个文件: https://www.dropbox.com/sh/h1bwe9e8jr2040x/RVlEdqrvHg

提前感谢您的时间。

亚当

1 个答案:

答案 0 :(得分:1)

尝试使用https://code.google.com/p/gwt-log/配置非常简单。