Updated frames

This commit is contained in:
SuspiciousActivity committed 2019-02-10 00:07:32 +01:00
1 parent 8c94bb4497
commit 6e1a0a26b3
4 files changed
+162 -89

No files matched your search

+60 -25
View File
@@ -15,6 +15,7 @@ import javax.swing.text.BadLocationException;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.AnnotationNode;
@@ -79,9 +80,10 @@ public class Assembler {
clazz.innerClasses = new ArrayList<>();
} else {
String split[] = s.split(" ");
clazz.innerClasses
.add(new InnerClassNode(UnicodeUtils.unescape(split[1]), split[2].equals("null") ? null : UnicodeUtils.unescape(split[2]),
split[3].equals("null") ? null : UnicodeUtils.unescape(split[3]), Integer.parseInt(split[4].substring(2), 16)));
clazz.innerClasses.add(new InnerClassNode(UnicodeUtils.unescape(split[1]),
split[2].equals("null") ? null : UnicodeUtils.unescape(split[2]),
split[3].equals("null") ? null : UnicodeUtils.unescape(split[3]),
Integer.parseInt(split[4].substring(2), 16)));
}
}
{
@@ -135,7 +137,8 @@ public class Assembler {
}
s = read.readLine();
clazz.sourceFile = s.substring(16).equals("null") ? null : UnicodeUtils.unescape(s.substring(16));
while (!(s = read.readLine()).equals("// #Fields")) {}
while (!(s = read.readLine()).equals("// #Fields")) {
}
clazz.fields = new ArrayList<>();
clazz.methods = new ArrayList<>();
String signature = null;
@@ -297,8 +300,9 @@ public class Assembler {
_end = new LabelNode(entry.getKey());
}
}
node.localVariables.add(new LocalVariableNode(sp[0], UnicodeUtils.unescape(sp[1].substring(1, sp[1].length() - 2)),
signat, _start, _end, Integer.parseInt(sp[2].substring(0, sp[2].length() - 2))));
node.localVariables.add(new LocalVariableNode(sp[0],
UnicodeUtils.unescape(sp[1].substring(1, sp[1].length() - 2)), signat, _start, _end,
Integer.parseInt(sp[2].substring(0, sp[2].length() - 2))));
}
for (String st : tryCatchBlocksToParse) {
String[] sp = st.split(" ");
@@ -319,8 +323,8 @@ public class Assembler {
_handler = new LabelNode(entry.getKey());
}
}
node.tryCatchBlocks
.add(new TryCatchBlockNode(_start, _end, _handler, sp[0].equals("null") ? null : UnicodeUtils.unescape(sp[0])));
node.tryCatchBlocks.add(new TryCatchBlockNode(_start, _end, _handler,
sp[0].equals("null") ? null : UnicodeUtils.unescape(sp[0])));
}
clazz.methods.add(node);
} else if (!s.startsWith("\t")) {
@@ -427,7 +431,8 @@ public class Assembler {
} finally {
try {
read.close();
} catch (Exception e) {}
} catch (Exception e) {
}
}
}
@@ -458,7 +463,8 @@ public class Assembler {
list.add(rofl.substring(1, index));
} else if (!rofl.startsWith("(")) {
int index = rofl.indexOf(";");
list.add(new String[] { rofl.substring(0, index) + ";", rofl.substring(index).substring(2) });
list.add(new String[] { rofl.substring(0, index) + ";",
rofl.substring(index).substring(2) });
} else {
list.add(ClassUtil.getCastedValue(rofl.split(" ")[1], rofl.split("\\) ")[0].substring(1)));
}
@@ -471,9 +477,11 @@ public class Assembler {
node.values.add(value.substring(1, index));
} else if (!value.startsWith("(")) {
int index = value.indexOf(";");
node.values.add(new String[] { value.substring(0, index) + ";", value.substring(index).substring(2) });
node.values.add(
new String[] { value.substring(0, index) + ";", value.substring(index).substring(2) });
} else {
node.values.add(ClassUtil.getCastedValue(value.split(" ")[1], value.split("\\) ")[0].substring(1)));
node.values.add(
ClassUtil.getCastedValue(value.split(" ")[1], value.split("\\) ")[0].substring(1)));
}
}
}
@@ -559,8 +567,8 @@ public class Assembler {
labels.put(l, labelNr);
return new LineNumberNode(Integer.parseInt(s.split(" ")[0]), new LabelNode(l));
} else if (s.startsWith("// frame ")) {
String str1 = s.substring(9);
String str = str1.substring(2);
String str1 = s.substring(7);
String str = str1.substring(str1.indexOf(' ', 3) + 1);
Object[] local;
Object[] stack;
ArrayList<Object> arr = new ArrayList<>();
@@ -641,8 +649,28 @@ public class Assembler {
}
}
}
return new FrameNode(Integer.parseInt(str1.split(" ")[0]), local != null ? local.length : 0, local, stack != null ? stack.length : 0,
stack);
int type = 0;
switch (str1.substring(str1.indexOf(' ', 1) + 1, str1.indexOf(' ', 3))) {
case "NEW":
type = Opcodes.F_NEW;
break;
case "FULL":
type = Opcodes.F_FULL;
break;
case "APPEND":
type = Opcodes.F_APPEND;
break;
case "CHOP":
type = Opcodes.F_CHOP;
break;
case "SAME":
type = Opcodes.F_SAME;
break;
case "SAME1":
type = Opcodes.F_SAME1;
break;
}
return new FrameNode(type, local.length, local, stack.length, stack);
} else {
String[] split = s.split(" ");
String command = split[0];
@@ -692,11 +720,12 @@ public class Assembler {
if (str.startsWith("Type: ")) {
str = str.substring(8, str.length() - 2);
String[] split2 = str.split("\n\t");
Constructor<Type> constr = Type.class.getDeclaredConstructor(int.class, String.class, int.class, int.class);
Constructor<Type> constr = Type.class.getDeclaredConstructor(int.class, String.class, int.class,
int.class);
constr.setAccessible(true);
String type = split2[0].substring(7);
val = constr.newInstance(
new Object[] { ClassUtil.getIDFromClassNameForType(type), split2[3].substring(6, split2[3].length() - 1),
val = constr.newInstance(new Object[] { ClassUtil.getIDFromClassNameForType(type),
split2[3].substring(6, split2[3].length() - 1),
Integer.parseInt(split2[1].substring(7)), Integer.parseInt(split2[2].substring(5)) });
} else if (str.startsWith("\"") && str.endsWith("\"")) {
val = UnicodeUtils.unescape(str.substring(1, str.length() - 1));
@@ -1224,7 +1253,8 @@ public class Assembler {
arr[counter] = ln;
counter++;
}
return new TableSwitchInsnNode(Integer.parseInt(split2[0].substring(5)), Integer.parseInt(split2[1].substring(5)), dflt, arr);
return new TableSwitchInsnNode(Integer.parseInt(split2[0].substring(5)),
Integer.parseInt(split2[1].substring(5)), dflt, arr);
}
case "lookupswitch": {
String str = s.substring(15, s.length() - 2).replace("\t", "");
@@ -1372,17 +1402,21 @@ public class Assembler {
if (st.equals("]")) {
if (stage == 1) {
try {
Constructor<Type> constr = Type.class.getDeclaredConstructor(int.class, String.class, int.class, int.class);
Constructor<Type> constr = Type.class.getDeclaredConstructor(int.class, String.class,
int.class, int.class);
constr.setAccessible(true);
args.add(constr.newInstance(new Object[] { Integer.parseInt(vals.get(0).substring(6)),
UnicodeUtils.unescape(vals.get(3).substring(6, vals.get(3).length() - 1)),
Integer.parseInt(vals.get(1).substring(7)), Integer.parseInt(vals.get(2).substring(5)) }));
Integer.parseInt(vals.get(1).substring(7)),
Integer.parseInt(vals.get(2).substring(5)) }));
} catch (Exception e) {
throw e;
}
} else if (stage == 2) {
args.add(new Handle(Integer.parseInt(vals.get(4).substring(5)), UnicodeUtils.unescape(vals.get(1).substring(7)),
UnicodeUtils.unescape(vals.get(0).substring(6)), UnicodeUtils.unescape(vals.get(2).substring(6)),
args.add(new Handle(Integer.parseInt(vals.get(4).substring(5)),
UnicodeUtils.unescape(vals.get(1).substring(7)),
UnicodeUtils.unescape(vals.get(0).substring(6)),
UnicodeUtils.unescape(vals.get(2).substring(6)),
Boolean.parseBoolean(vals.get(3).substring(13))));
vals.clear();
}
@@ -1406,7 +1440,8 @@ public class Assembler {
_args[stage] = o;
stage++;
}
return new InvokeDynamicInsnNode(UnicodeUtils.unescape(sp[0].substring(7)), UnicodeUtils.unescape(sp[1].substring(6)),
return new InvokeDynamicInsnNode(UnicodeUtils.unescape(sp[0].substring(7)),
UnicodeUtils.unescape(sp[1].substring(6)),
new Handle(Integer.parseInt(sp[7].substring(6)), UnicodeUtils.unescape(sp[4].substring(8)),
UnicodeUtils.unescape(sp[3].substring(7)), UnicodeUtils.unescape(sp[5].substring(7)),
Boolean.parseBoolean(sp[6].substring(14))),
+88 -45
View File
@@ -139,16 +139,18 @@ public class Disassembler {
}
s += "// #Class v:" + classNode.version + "\n";
s += "// #Signature: " + UnicodeUtils.escapeWithSpaces(classNode.signature) + "\n";
s += "// #OuterMethod: "
+ (classNode.outerMethod == null ? "null"
: (UnicodeUtils.escapeWithSpaces(classNode.outerMethod) + " " + UnicodeUtils.escapeWithSpaces(classNode.outerMethodDesc)))
s += "// #OuterMethod: " + (classNode.outerMethod == null ? "null"
: (UnicodeUtils.escapeWithSpaces(classNode.outerMethod) + " "
+ UnicodeUtils.escapeWithSpaces(classNode.outerMethodDesc)))
+ "\n";
s += "// #OuterClass: " + UnicodeUtils.escapeWithSpaces(classNode.outerClass) + "\n";
s += "// #InnerClasses:\n";
if (classNode.innerClasses != null) {
for (InnerClassNode icn : classNode.innerClasses) {
s += "// " + UnicodeUtils.escapeWithSpaces(icn.name) + " " + UnicodeUtils.escapeWithSpaces(icn.outerName) + " "
+ UnicodeUtils.escapeWithSpaces(icn.innerName) + " 0x" + Integer.toHexString(icn.access) + "\n";
s += "// " + UnicodeUtils.escapeWithSpaces(icn.name) + " "
+ UnicodeUtils.escapeWithSpaces(icn.outerName) + " "
+ UnicodeUtils.escapeWithSpaces(icn.innerName) + " 0x" + Integer.toHexString(icn.access)
+ "\n";
}
}
s += ClassUtil.getAccessFlagsClass(classNode.access) + UnicodeUtils.escapeWithSpaces(classNode.name) + " ";
@@ -165,7 +167,9 @@ public class Disassembler {
if (!interfaceStr.isEmpty())
s += "implements " + interfaceStr + " ";
}
s += "{\n// #SourceFile: " + (classNode.sourceFile == null ? "null" : UnicodeUtils.escape(classNode.sourceFile)) + "\n\n// #Fields\n";
s += "{\n// #SourceFile: "
+ (classNode.sourceFile == null ? "null" : UnicodeUtils.escape(classNode.sourceFile))
+ "\n\n// #Fields\n";
for (FieldNode fn : classNode.fields) {
if (fn.signature != null)
s += "\t// #Signature: " + UnicodeUtils.escapeWithSpaces(fn.signature) + "\n";
@@ -231,8 +235,8 @@ public class Disassembler {
if (fn.equals(nodeToFind)) {
lineFound = s.split("\\n").length;
}
s += "\t" + ClassUtil.getAccessFlagsFull(fn.access).replace("varargs", "transient") + UnicodeUtils.escapeWithSpaces(fn.desc) + " "
+ UnicodeUtils.escapeWithSpaces(fn.name);
s += "\t" + ClassUtil.getAccessFlagsFull(fn.access).replace("varargs", "transient")
+ UnicodeUtils.escapeWithSpaces(fn.desc) + " " + UnicodeUtils.escapeWithSpaces(fn.name);
if (fn.value != null) {
s += " = " + ClassUtil.getDecompiledValue(fn.value, fn.desc, true);
}
@@ -327,16 +331,19 @@ public class Disassembler {
s += dis[0];
s += "\t}\n\n";
} catch (Exception e) {
s += "\t\t// Method couldn't be disassembled:\n\t\t// " + e.getClass().getName() + ": " + e.getMessage() + "\n"
+ Arrays.toString(e.getStackTrace()).replace(", ", "\n\t\t// \tat ").replace("[", "\t\t// \tat ").replace("]", "")
s += "\t\t// Method couldn't be disassembled:\n\t\t// "
+ e.getClass().getName() + ": " + e.getMessage() + "\n" + Arrays.toString(e.getStackTrace())
.replace(", ", "\n\t\t// \tat ").replace("[", "\t\t// \tat ").replace("]", "")
+ "\n\t}\n\n";
}
}
s += "}\n";
return new DisassembleTuple(s, lineFound);
} catch (Throwable e) {
return new DisassembleTuple("Class couldn't be decompiled:\n" + e.getClass().getName() + ": " + e.getMessage() + "\n"
+ Arrays.toString(e.getStackTrace()).replace(", ", "\n\tat ").replace("[", "\tat ").replace("]", "") + "\n");
return new DisassembleTuple("Class couldn't be decompiled:\n" + e.getClass().getName() + ": "
+ e.getMessage() + "\n"
+ Arrays.toString(e.getStackTrace()).replace(", ", "\n\tat ").replace("[", "\tat ").replace("]", "")
+ "\n");
}
}
@@ -352,15 +359,17 @@ public class Disassembler {
}
if (mn.localVariables != null) {
for (LocalVariableNode lvn : mn.localVariables) {
localVarTable += "\t// " + UnicodeUtils.escapeWithSpaces(lvn.name) + ": " + UnicodeUtils.escapeWithSpaces(lvn.desc) + " i:"
+ lvn.index + " s:" + labels.get(lvn.start.getLabel()) + " e:" + labels.get(lvn.end.getLabel()) + " sig:"
localVarTable += "\t// " + UnicodeUtils.escapeWithSpaces(lvn.name) + ": "
+ UnicodeUtils.escapeWithSpaces(lvn.desc) + " i:" + lvn.index + " s:"
+ labels.get(lvn.start.getLabel()) + " e:" + labels.get(lvn.end.getLabel()) + " sig:"
+ UnicodeUtils.escapeWithSpaces(lvn.signature) + "\n";
}
}
if (mn.tryCatchBlocks != null) {
for (TryCatchBlockNode tcbn : mn.tryCatchBlocks) {
tryCatchTable += "\t// " + UnicodeUtils.escapeWithSpaces(tcbn.type) + " s:" + labels.get(tcbn.start.getLabel()) + " e:"
+ labels.get(tcbn.end.getLabel()) + " h:" + labels.get(tcbn.handler.getLabel()) + "\n";
tryCatchTable += "\t// " + UnicodeUtils.escapeWithSpaces(tcbn.type) + " s:"
+ labels.get(tcbn.start.getLabel()) + " e:" + labels.get(tcbn.end.getLabel()) + " h:"
+ labels.get(tcbn.handler.getLabel()) + "\n";
}
}
for (AbstractInsnNode n : mn.instructions.toArray()) {
@@ -373,8 +382,9 @@ public class Disassembler {
switch (n.getClass().getSimpleName()) {
case "FieldInsnNode": {
FieldInsnNode node = (FieldInsnNode) n;
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + UnicodeUtils.escapeWithSpaces(node.desc) + " "
+ UnicodeUtils.escapeWithSpaces(node.owner) + "/" + UnicodeUtils.escapeWithSpaces(node.name).replace("/", "\\u002F") + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
+ UnicodeUtils.escapeWithSpaces(node.desc) + " " + UnicodeUtils.escapeWithSpaces(node.owner) + "/"
+ UnicodeUtils.escapeWithSpaces(node.name).replace("/", "\\u002F") + "\n";
}
case "LabelNode": {
LabelNode node = (LabelNode) n;
@@ -382,7 +392,28 @@ public class Disassembler {
}
case "FrameNode": {
FrameNode node = (FrameNode) n;
String s = "\t\t// frame " + node.type + " l:";
String type = "";
switch (node.type) {
case Opcodes.F_NEW:
type = "NEW";
break;
case Opcodes.F_FULL:
type = "FULL";
break;
case Opcodes.F_APPEND:
type = "APPEND";
break;
case Opcodes.F_CHOP:
type = "CHOP";
break;
case Opcodes.F_SAME:
type = "SAME";
break;
case Opcodes.F_SAME1:
type = "SAME1";
break;
}
String s = "\t\t// frame " + type + " l:";
ArrayList<String> arr = new ArrayList<>();
if (node.local != null) {
for (Object o : node.local) {
@@ -434,9 +465,10 @@ public class Disassembler {
String s = "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " [\n\t\t\tname: "
+ UnicodeUtils.escapeWithSpaces(node.name).replace("/", "\\u002F") + "\n\t\t\tdesc: "
+ UnicodeUtils.escapeWithSpaces(node.desc) + "\n\t\t\tHandle: [\n\t\t\t\tname: "
+ UnicodeUtils.escapeWithSpaces(node.bsm.getName()) + "\n\t\t\t\towner: " + UnicodeUtils.escapeWithSpaces(node.bsm.getOwner())
+ "\n\t\t\t\tdesc: " + UnicodeUtils.escapeWithSpaces(node.bsm.getDesc()) + "\n\t\t\t\tisInterface: " + node.bsm.isInterface()
+ "\n\t\t\t\ttag: " + node.bsm.getTag() + "\n\t\t\t]\n\t\t\targs: [\n";
+ UnicodeUtils.escapeWithSpaces(node.bsm.getName()) + "\n\t\t\t\towner: "
+ UnicodeUtils.escapeWithSpaces(node.bsm.getOwner()) + "\n\t\t\t\tdesc: "
+ UnicodeUtils.escapeWithSpaces(node.bsm.getDesc()) + "\n\t\t\t\tisInterface: "
+ node.bsm.isInterface() + "\n\t\t\t\ttag: " + node.bsm.getTag() + "\n\t\t\t]\n\t\t\targs: [\n";
for (Object l : node.bsmArgs) {
if (l.getClass().getName().equals("org.objectweb.asm.Type")) {
Type type = (Type) l;
@@ -453,16 +485,19 @@ public class Disassembler {
Field f_buf = Type.class.getDeclaredField("valueBuffer");
f_buf.setAccessible(true);
buf = (String) f_buf.get(type);
} catch (Exception e) {}
s += "\t\t\t\tType: [\n\t\t\t\t\ttype: " + ClassUtil.getClassNameFromType(type) + "\n\t\t\t\t\tstart: " + valueBegin
+ "\n\t\t\t\t\tend: " + valueEnd + "\n\t\t\t\t\tbuf: " + ClassUtil.getDecompiledValue(buf, "");
} catch (Exception e) {
}
s += "\t\t\t\tType: [\n\t\t\t\t\ttype: " + ClassUtil.getClassNameFromType(type)
+ "\n\t\t\t\t\tstart: " + valueBegin + "\n\t\t\t\t\tend: " + valueEnd + "\n\t\t\t\t\tbuf: "
+ ClassUtil.getDecompiledValue(buf, "");
s += "\n\t\t\t\t]\n";
} else if (l.getClass().getName().equals("org.objectweb.asm.Handle")) {
Handle h = (Handle) l;
s += "\t\t\t\tHandle: [\n\t\t\t\t\tname: " + UnicodeUtils.escapeWithSpaces(h.getName()).replace("/", "\\u002F")
+ "\n\t\t\t\t\towner: " + UnicodeUtils.escapeWithSpaces(h.getOwner()) + "\n\t\t\t\t\tdesc: "
+ UnicodeUtils.escapeWithSpaces(h.getDesc()) + "\n\t\t\t\t\tisInterface: " + h.isInterface() + "\n\t\t\t\t\ttag: "
+ h.getTag();
s += "\t\t\t\tHandle: [\n\t\t\t\t\tname: "
+ UnicodeUtils.escapeWithSpaces(h.getName()).replace("/", "\\u002F") + "\n\t\t\t\t\towner: "
+ UnicodeUtils.escapeWithSpaces(h.getOwner()) + "\n\t\t\t\t\tdesc: "
+ UnicodeUtils.escapeWithSpaces(h.getDesc()) + "\n\t\t\t\t\tisInterface: " + h.isInterface()
+ "\n\t\t\t\t\ttag: " + h.getTag();
s += "\n\t\t\t\t]\n";
} else {
s += "\t\t\t\t" + ClassUtil.getDecompiledValue(l, "") + "\n";
@@ -473,17 +508,19 @@ public class Disassembler {
}
case "MethodInsnNode": {
MethodInsnNode node = (MethodInsnNode) n;
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + UnicodeUtils.escapeWithSpaces(node.desc) + " "
+ UnicodeUtils.escapeWithSpaces(node.owner) + "/" + UnicodeUtils.escapeWithSpaces(node.name).replace("/", "\\u002F") + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
+ UnicodeUtils.escapeWithSpaces(node.desc) + " " + UnicodeUtils.escapeWithSpaces(node.owner) + "/"
+ UnicodeUtils.escapeWithSpaces(node.name).replace("/", "\\u002F") + "\n";
}
case "TypeInsnNode": {
TypeInsnNode node = (TypeInsnNode) n;
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + UnicodeUtils.escapeWithSpaces(node.desc) + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
+ UnicodeUtils.escapeWithSpaces(node.desc) + "\n";
}
case "MultiANewArrayInsnNode": {
MultiANewArrayInsnNode node = (MultiANewArrayInsnNode) n;
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + UnicodeUtils.escapeWithSpaces(node.desc) + " " + node.dims
+ "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
+ UnicodeUtils.escapeWithSpaces(node.desc) + " " + node.dims + "\n";
}
case "LdcInsnNode": {
LdcInsnNode node = (LdcInsnNode) n;
@@ -493,7 +530,8 @@ public class Disassembler {
case "Integer":
case "Float":
case "Long": {
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + ClassUtil.getDecompiledValue(node.cst, "") + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
+ ClassUtil.getDecompiledValue(node.cst, "") + "\n";
}
case "Type": {
Type type = (Type) node.cst;
@@ -510,10 +548,11 @@ public class Disassembler {
Field f_buf = Type.class.getDeclaredField("valueBuffer");
f_buf.setAccessible(true);
buf = (String) f_buf.get(type);
} catch (Exception e) {}
} catch (Exception e) {
}
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " Type: [\n\t\t\ttype: "
+ ClassUtil.getClassNameFromType(type) + "\n\t\t\tstart: " + valueBegin + "\n\t\t\tend: " + valueEnd + "\n\t\t\tbuf: "
+ ClassUtil.getDecompiledValue(buf, "");
+ ClassUtil.getClassNameFromType(type) + "\n\t\t\tstart: " + valueBegin + "\n\t\t\tend: "
+ valueEnd + "\n\t\t\tbuf: " + ClassUtil.getDecompiledValue(buf, "");
s += "\n\t\t]\n";
return s;
}
@@ -534,19 +573,22 @@ public class Disassembler {
case "IntInsnNode": {
IntInsnNode node = (IntInsnNode) n;
if (n.getOpcode() == Opcodes.NEWARRAY) {
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + ClassUtil.getArrayTypeByID(node.operand) + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " "
+ ClassUtil.getArrayTypeByID(node.operand) + "\n";
} else {
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + node.operand + "\n";
}
}
case "JumpInsnNode": {
JumpInsnNode node = (JumpInsnNode) n;
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + labels.get(node.label.getLabel()) + "\n";
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + labels.get(node.label.getLabel())
+ "\n";
}
case "TableSwitchInsnNode": {
TableSwitchInsnNode node = (TableSwitchInsnNode) n;
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " [\n\t\t\tmin: " + node.min + "\n\t\t\tmax: " + node.max
+ "\n\t\t\tdefault: " + labels.get(node.dflt.getLabel()) + "\n\t\t\tlabels: [\n";
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " [\n\t\t\tmin: " + node.min
+ "\n\t\t\tmax: " + node.max + "\n\t\t\tdefault: " + labels.get(node.dflt.getLabel())
+ "\n\t\t\tlabels: [\n";
for (LabelNode l : node.labels) {
s += "\t\t\t\t" + labels.get(l.getLabel()) + "\n";
}
@@ -555,8 +597,8 @@ public class Disassembler {
}
case "LookupSwitchInsnNode": {
LookupSwitchInsnNode node = (LookupSwitchInsnNode) n;
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " [\n\t\t\tdefault: " + labels.get(node.dflt.getLabel())
+ "\n\t\t\tkeys: [\n";
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " [\n\t\t\tdefault: "
+ labels.get(node.dflt.getLabel()) + "\n\t\t\tkeys: [\n";
for (Integer l : node.keys) {
s += "\t\t\t\t" + l + "\n";
}
@@ -572,7 +614,8 @@ public class Disassembler {
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + node.var + " " + node.incr + "\n";
}
default:
return "\t\tNOT HANDLED! " + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + n.getClass().getSimpleName() + "\n";
return "\t\tNOT HANDLED! " + OpcodesReverse.reverseOpcode(n.getOpcode()) + " "
+ n.getClass().getSimpleName() + "\n";
}
}
+2
View File
@@ -178,6 +178,8 @@ public class Main extends JFrame {
provider.addCompletion(new ShorthandCompletion(provider, "method",
"// #Max: l:0 s:0\n\t// #TryCatch:\n\t// #LocalVars:\n\tpublic static method ()V {\n\t\treturn\n\t}",
null, "<html><b><u>method</u></b><br>Creates an example method</html>"));
provider.addCompletion(new ShorthandCompletion(provider, "frame", "frame FULL l:[] s:[]", null,
"<html><b><u>frame</u></b><br>Creates a stack map frame</html>"));
return provider;
}
@@ -66,8 +66,8 @@ public abstract class CompletionProviderBase implements CompletionProvider {
private Segment s = new Segment();
protected static final String EMPTY_STRING = "";
/**
* Comparator used to sort completions by their relevance before sorting
* them lexicographically.
* Comparator used to sort completions by their relevance before sorting them
* lexicographically.
*/
private static final Comparator<Completion> sortByRelevanceComparator = new SortByRelevanceComparator();
@@ -116,10 +116,8 @@ public abstract class CompletionProviderBase implements CompletionProvider {
/**
* Does the dirty work of creating a list of completions.
*
* @param comp
* The text component to look in.
* @return The list of possible completions, or an empty list if there
* are none.
* @param comp The text component to look in.
* @return The list of possible completions, or an empty list if there are none.
*/
protected abstract List<Completion> getCompletionsImpl(JTextComponent comp);
@@ -189,13 +187,11 @@ public abstract class CompletionProviderBase implements CompletionProvider {
/**
* Sets the characters that auto-activation should occur after. A Java
* completion provider, for example, might want to set <code>others</code>
* to "<code>.</code>", to allow auto-activation for members of an object.
* completion provider, for example, might want to set <code>others</code> to
* "<code>.</code>", to allow auto-activation for members of an object.
*
* @param letters
* Whether auto-activation should occur after any letter.
* @param others
* A string of (non-letter) chars that auto-activation should
* @param letters Whether auto-activation should occur after any letter.
* @param others A string of (non-letter) chars that auto-activation should
* occur after. This may be <code>null</code>.
*/
public void setAutoActivationRules(boolean letters, String others) {
@@ -204,14 +200,11 @@ public abstract class CompletionProviderBase implements CompletionProvider {
}
/**
* Sets the param choices provider. This is used when a user
* code-completes a parameterized completion, such as a function or method.
* For any parameter to the function/method, this object can return
* possible completions.
* Sets the param choices provider. This is used when a user code-completes a
* parameterized completion, such as a function or method. For any parameter to
* the function/method, this object can return possible completions.
*
* @param pcp
* The parameter choices provider, or <code>null</code> for
* none.
* @param pcp The parameter choices provider, or <code>null</code> for none.
* @see #getParameterChoicesProvider()
*/
public void setParameterChoicesProvider(ParameterChoicesProvider pcp) {