Commit b77a8b93 authored by Lukáš Marek's avatar Lukáš Marek

Added stack trace printing to the snippet exception handler

Fixed analysis runtime deployment
parent e5525e6c
......@@ -148,7 +148,7 @@
<mkdir dir="${build}"/>
<jar jarfile="${build}/${instr.jar.name}"
basedir="${bin}"
includes="${test.path}/*"
includes="${test.path}/**"
excludes="${test.path}/TargetClass*.class ${test.path}/MANIFEST.MF"
manifest="${src.test}/${test.path}/MANIFEST.MF">
</jar>
......
......@@ -12,10 +12,8 @@ fi
# to enable shared memory, remove ",ipc.socket" from the options
JBORAT_AGENT_OPTS="1234,localhost,ipc.socket"
java -XX:MaxPermSize=128m \
-Xmx2G \
-javaagent:build/dislagent-unspec.jar \
-Xbootclasspath/p:build/dislagent-unspec.jar \
-agentpath:${JBORAT_AGENT}=${JBORAT_AGENT_OPTS} \
-cp ./bin \
$*
java -agentpath:${JBORAT_AGENT}=${JBORAT_AGENT_OPTS} \
-javaagent:build/dislagent-unspec.jar \
-Xbootclasspath/a:build/dislagent-unspec.jar:build/dislinstr.jar \
-cp bin/ \
$*
......@@ -226,6 +226,7 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
// ... original code
// } finally {
// System.err.println("...");
// e.printStackTrace(); // possible here :)
// System.exit(...);
// }
......@@ -233,6 +234,7 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
Type typeSystem = Type.getType(System.class);
Type typePS = Type.getType(PrintStream.class);
Type typeString = Type.getType(String.class);
Type typeThrowable = Type.getType(Throwable.class);
// add try label at the beginning
LabelNode tryBegin = new LabelNode();
......@@ -279,6 +281,15 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
"println",
"(" + typeString.getDescriptor() + ")V"));
// duplicate exception reference on the stack
instructions.add(new InsnNode(Opcodes.DUP));
// invoke printing stack trace
instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL,
typeThrowable.getInternalName(),
"printStackTrace",
"()V"));
// add system exit
// add exit code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment