Activated bytecode-to-source mapping for all instructions
This commit is contained in:
@@ -174,7 +174,7 @@ public class AssertProcessor {
|
||||
Exprent ascond = null, retcond = null;
|
||||
if (exprres[0] != null) {
|
||||
ascond = new FunctionExprent(FunctionExprent.FUNCTION_BOOLNOT,
|
||||
Arrays.asList(new Exprent[]{(Exprent)exprres[0]}));
|
||||
Arrays.asList((Exprent)exprres[0]), throwError.bytecode);
|
||||
retcond = SecondaryFunctionsHelper.propagateBoolNot(ascond);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ClassReference14Processor {
|
||||
|
||||
bodyexprent = new ExitExprent(ExitExprent.EXIT_RETURN,
|
||||
invfor,
|
||||
VarType.VARTYPE_CLASS);
|
||||
VarType.VARTYPE_CLASS, null);
|
||||
|
||||
InvocationExprent constr = new InvocationExprent();
|
||||
constr.setName("<init>");
|
||||
@@ -65,7 +65,7 @@ public class ClassReference14Processor {
|
||||
constr.setDescriptor(MethodDescriptor.parseDescriptor("()V"));
|
||||
|
||||
NewExprent newexpr =
|
||||
new NewExprent(new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/NoClassDefFoundError"), new ArrayList<Exprent>());
|
||||
new NewExprent(new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/NoClassDefFoundError"), new ArrayList<Exprent>(), null);
|
||||
newexpr.setConstructor(constr);
|
||||
|
||||
InvocationExprent invcause = new InvocationExprent();
|
||||
@@ -79,7 +79,7 @@ public class ClassReference14Processor {
|
||||
|
||||
handlerexprent = new ExitExprent(ExitExprent.EXIT_THROW,
|
||||
invcause,
|
||||
null);
|
||||
null, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ClassReference14Processor {
|
||||
|
||||
String cl = isClass14Invocation(exprent, ent.getKey(), ent.getValue());
|
||||
if (cl != null) {
|
||||
initializers.set(i, new ConstExprent(VarType.VARTYPE_CLASS, cl.replace('.', '/')));
|
||||
initializers.set(i, new ConstExprent(VarType.VARTYPE_CLASS, cl.replace('.', '/'), exprent.bytecode));
|
||||
setFound.add(ent.getKey());
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class ClassReference14Processor {
|
||||
for (Exprent expr : exprent.getAllExprents()) {
|
||||
String cl = isClass14Invocation(expr, wrapper, meth);
|
||||
if (cl != null) {
|
||||
exprent.replaceExprent(expr, new ConstExprent(VarType.VARTYPE_CLASS, cl.replace('.', '/')));
|
||||
exprent.replaceExprent(expr, new ConstExprent(VarType.VARTYPE_CLASS, cl.replace('.', '/'), expr.bytecode));
|
||||
found = true;
|
||||
res = true;
|
||||
break;
|
||||
|
||||
@@ -462,7 +462,7 @@ public class ClassWriter {
|
||||
if (attr != null) {
|
||||
PrimitiveConstant constant = cl.getPool().getPrimitiveConstant(attr.getIndex());
|
||||
buffer.append(" = ");
|
||||
buffer.append(new ConstExprent(fieldType, constant.value).toJava(indent, tracer));
|
||||
buffer.append(new ConstExprent(fieldType, constant.value, null).toJava(indent, tracer));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ public class ClassesProcessor {
|
||||
mapper.addTotalOffset(total_offset_lines);
|
||||
|
||||
buffer.append(lineSeparator);
|
||||
mapper.dumpMapping(buffer);
|
||||
mapper.dumpMapping(buffer, true);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.jetbrains.java.decompiler.main.collectors;
|
||||
|
||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||
import org.jetbrains.java.decompiler.main.TextBuffer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||
import org.jetbrains.java.decompiler.main.TextBuffer;
|
||||
|
||||
public class BytecodeSourceMapper {
|
||||
|
||||
private int offset_total;
|
||||
@@ -37,7 +37,7 @@ public class BytecodeSourceMapper {
|
||||
}
|
||||
}
|
||||
|
||||
public void dumpMapping(TextBuffer buffer) {
|
||||
public void dumpMapping(TextBuffer buffer, boolean offsetsToHex) {
|
||||
|
||||
String lineSeparator = DecompilerContext.getNewLineSeparator();
|
||||
|
||||
@@ -56,7 +56,8 @@ public class BytecodeSourceMapper {
|
||||
buffer.appendIndent(1).append("method " + method_entry.getKey() + "{" + lineSeparator);
|
||||
|
||||
for(Entry<Integer, Integer> line : method_mapping.entrySet()) {
|
||||
buffer.appendIndent(2).append(line.getKey().toString()).appendIndent(2).append((line.getValue() + offset_total) + lineSeparator);
|
||||
String strOffset = offsetsToHex ? Integer.toHexString(line.getKey()): line.getKey().toString();
|
||||
buffer.appendIndent(2).append(strOffset).appendIndent(2).append((line.getValue() + offset_total) + lineSeparator);
|
||||
}
|
||||
buffer.appendIndent(1).append("}").appendLineSeparator();
|
||||
is_first_method = false;
|
||||
|
||||
Reference in New Issue
Block a user