summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2014-11-25 11:55:04 +0100
committermikaelpeltier <mikaelpeltier@google.com>2014-11-25 15:08:11 +0100
commit5986ee7fbd9dc5697cea5f935a066f44f2699934 (patch)
treeba066bd9ceaba8ea880f09034ab57e7383fe3788
parent54a8c6ae7a3c9ea3bff86a1d2c04dff2760ae940 (diff)
downloadtoolchain_jill-5986ee7fbd9dc5697cea5f935a066f44f2699934.zip
toolchain_jill-5986ee7fbd9dc5697cea5f935a066f44f2699934.tar.gz
toolchain_jill-5986ee7fbd9dc5697cea5f935a066f44f2699934.tar.bz2
Now --no-debug option works
Bug: 18517951 Change-Id: Ifa73716e94b6c897425fdf529023ecba162d8a73
-rw-r--r--jill/src/com/android/jill/Options.java4
-rw-r--r--jill/src/com/android/jill/frontend/java/ClassNodeWriter.java12
-rw-r--r--jill/src/com/android/jill/frontend/java/JavaTransformer.java2
-rw-r--r--jill/src/com/android/jill/frontend/java/MethodBodyWriter.java10
4 files changed, 20 insertions, 8 deletions
diff --git a/jill/src/com/android/jill/Options.java b/jill/src/com/android/jill/Options.java
index b3828f7..7b41c57 100644
--- a/jill/src/com/android/jill/Options.java
+++ b/jill/src/com/android/jill/Options.java
@@ -56,7 +56,7 @@ public class Options {
protected ContainerType container = ContainerType.ZIP;
@Option(name = "--no-debug", usage = "disable debug info emission")
- protected boolean emitDebugInfo = true;
+ protected boolean disableEmitDebugInfo = false;
public void checkValidity() throws IllegalOptionsException {
if (askForVersion() || askForHelp()) {
@@ -110,7 +110,7 @@ public class Options {
}
public boolean isEmitDebugInfo() {
- return emitDebugInfo;
+ return !disableEmitDebugInfo;
}
@Nonnull
diff --git a/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java b/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java
index 1df263b..2cab6d1 100644
--- a/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java
+++ b/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java
@@ -16,6 +16,7 @@
package com.android.jill.frontend.java;
+import com.android.jill.Options;
import com.android.jill.backend.jayce.JayceWriter;
import com.android.jill.backend.jayce.Token;
@@ -45,10 +46,15 @@ public class ClassNodeWriter extends JillWriter {
private static final int ORDINAL_UNKNOWN = -1;
+ @Nonnull
+ private final Options options;
+
public ClassNodeWriter(@Nonnull JayceWriter writer,
- @Nonnull SourceInfoWriter sourceInfoWriter) {
+ @Nonnull SourceInfoWriter sourceInfoWriter,
+ @Nonnull Options options) {
super(writer, sourceInfoWriter);
annotWriter = new AnnotationWriter(writer, sourceInfoWriter);
+ this.options = options;
}
public void write(@Nonnull ClassNode cn) throws IOException {
@@ -282,7 +288,7 @@ public class ClassNodeWriter extends JillWriter {
writer.writeOpenNodeList();
for (MethodNode mn : cn.methods) {
- new MethodBodyWriter(writer, annotWriter, cn, mn, sourceInfoWriter).write();
+ new MethodBodyWriter(writer, annotWriter, cn, mn, sourceInfoWriter, options).write();
}
writer.writeCloseNodeList();
}
@@ -291,7 +297,7 @@ public class ClassNodeWriter extends JillWriter {
writer.writeOpenNodeList();
for (MethodNode mn : cn.methods) {
- new MethodBodyWriter(writer, annotWriter, cn, mn, sourceInfoWriter).write();
+ new MethodBodyWriter(writer, annotWriter, cn, mn, sourceInfoWriter, options).write();
}
writer.writeCloseNodeList();
}
diff --git a/jill/src/com/android/jill/frontend/java/JavaTransformer.java b/jill/src/com/android/jill/frontend/java/JavaTransformer.java
index d3bc6eb..93fe27e 100644
--- a/jill/src/com/android/jill/frontend/java/JavaTransformer.java
+++ b/jill/src/com/android/jill/frontend/java/JavaTransformer.java
@@ -291,7 +291,7 @@ public class JavaTransformer {
JayceWriter writer = createWriter(os);
ClassNodeWriter asm2jayce =
- new ClassNodeWriter(writer, new SourceInfoWriter(writer));
+ new ClassNodeWriter(writer, new SourceInfoWriter(writer), options);
asm2jayce.write(cn);
diff --git a/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java b/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java
index efe9285..46f5e92 100644
--- a/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java
+++ b/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java
@@ -17,6 +17,7 @@
package com.android.jill.frontend.java;
import com.android.jill.JillException;
+import com.android.jill.Options;
import com.android.jill.backend.jayce.JayceWriter;
import com.android.jill.backend.jayce.Token;
import com.android.jill.frontend.java.analyzer.JillAnalyzer;
@@ -177,15 +178,20 @@ public class MethodBodyWriter extends JillWriter implements Opcodes {
private int endLine = -1;
@Nonnull
+ private final Options options;
+
+ @Nonnull
private final Map<TryCatchBlockNode, Variable> catchBlockToCatchedVariable =
new HashMap<TryCatchBlockNode, Variable>();
public MethodBodyWriter(@Nonnull JayceWriter writer,
@Nonnull AnnotationWriter annotWriter,
@Nonnull ClassNode cn, @Nonnull MethodNode mn,
- @Nonnull SourceInfoWriter sourceInfoWriter) {
+ @Nonnull SourceInfoWriter sourceInfoWriter,
+ @Nonnull Options options) {
super(writer, sourceInfoWriter);
this.annotWriter = annotWriter;
+ this.options = options;
currentClass = cn;
currentMethod = getMethodWithoutJSR(mn);
@@ -2285,7 +2291,7 @@ public class MethodBodyWriter extends JillWriter implements Opcodes {
@CheckForNull
private LocalVariableNode getLocalVariableNode(@Nonnegative int localIdx) {
assert localIdx >= 0;
- if (currentMethod.localVariables != null) {
+ if (options.isEmitDebugInfo() && currentMethod.localVariables != null) {
for (LocalVariableNode lvn : currentMethod.localVariables) {
int startScope = currentMethod.instructions.indexOf(lvn.start) - 1;
int endScope = currentMethod.instructions.indexOf(lvn.end);