Debugging stuff.
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Block
|
||||
{
|
||||
public Instruction begin, end;
|
||||
public List<Instruction> instructions = new ArrayList<>();
|
||||
public List<Exception> exceptions = new ArrayList<>(); // is an instruction in the handlers try { }
|
||||
public List<Exception> handlers = new ArrayList<>(); // first ins is a handler for exception
|
||||
}
|
||||
@@ -35,13 +35,6 @@ public class Exception
|
||||
assert start != null;
|
||||
assert end != null;
|
||||
assert handler != null;
|
||||
|
||||
handler.exce.add(this);
|
||||
}
|
||||
|
||||
protected void remove()
|
||||
{
|
||||
handler.exce.remove(this);
|
||||
}
|
||||
|
||||
public void write(DataOutputStream out) throws IOException
|
||||
@@ -83,11 +76,7 @@ public class Exception
|
||||
end = newi;
|
||||
|
||||
if (handler == oldi)
|
||||
{
|
||||
handler.exce.remove(this);
|
||||
handler = newi;
|
||||
handler.exce.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Class getCatchType()
|
||||
|
||||
@@ -28,7 +28,6 @@ public class Exceptions
|
||||
|
||||
public void remove(Exception e)
|
||||
{
|
||||
e.remove();
|
||||
exceptions.remove(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ConstantPool;
|
||||
import info.sigterm.deob.Field;
|
||||
import info.sigterm.deob.Method;
|
||||
import info.sigterm.deob.block.Block;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
@@ -22,7 +23,6 @@ public abstract class Instruction
|
||||
|
||||
public List<Instruction> jump = new ArrayList<>(), // instructions which this instruction jumps to
|
||||
from = new ArrayList<>(); // instructions which jump to this instruction
|
||||
public List<Exception> exce = new ArrayList<>(); // exception handlers which start here
|
||||
|
||||
public Instruction(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
@@ -48,7 +48,6 @@ public abstract class Instruction
|
||||
}
|
||||
|
||||
assert from.isEmpty(); // because this is empty no jumping instructions point here
|
||||
assert exce.isEmpty();
|
||||
}
|
||||
|
||||
public void replace(Instruction other)
|
||||
@@ -97,7 +96,6 @@ public abstract class Instruction
|
||||
{
|
||||
e.replace(this, other);
|
||||
}
|
||||
assert exce.isEmpty();
|
||||
|
||||
// replace ins
|
||||
int index = ins.indexOf(this);
|
||||
|
||||
@@ -5,6 +5,7 @@ import info.sigterm.deob.Field;
|
||||
import info.sigterm.deob.Method;
|
||||
import info.sigterm.deob.attributes.Code;
|
||||
import info.sigterm.deob.attributes.code.instruction.types.JumpingInstruction;
|
||||
import info.sigterm.deob.block.Block;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
||||
@@ -66,16 +66,25 @@ public class GetField extends Instruction implements GetFieldInstruction
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
|
||||
if (field.getNameAndType().getDescriptorType().getType().equals("L" + cf.getName() + ";"))
|
||||
field = new Field(field.getClassEntry(), new NameAndType(field.getNameAndType().getName(), new info.sigterm.deob.signature.Type("L" + name + ";", field.getNameAndType().getDescriptorType().getArrayDims())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameField(info.sigterm.deob.Field f, String name)
|
||||
{
|
||||
if (field.getNameAndType().getName().equals(f.getName()) && field.getClassEntry().getName().equals(f.getFields().getClassFile().getName()))
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
info.sigterm.deob.Field f2 = cf.findFieldDeep(nat);
|
||||
|
||||
if (f2 == f)
|
||||
{
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
NameAndType newNat = new NameAndType(name, nat.getDescriptorType());
|
||||
field = new Field(clazz, newNat);
|
||||
}
|
||||
|
||||
@@ -79,16 +79,25 @@ public class GetStatic extends Instruction implements GetFieldInstruction
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
|
||||
if (field.getNameAndType().getDescriptorType().getType().equals("L" + cf.getName() + ";"))
|
||||
field = new Field(field.getClassEntry(), new NameAndType(field.getNameAndType().getName(), new info.sigterm.deob.signature.Type("L" + name + ";", field.getNameAndType().getDescriptorType().getArrayDims())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameField(info.sigterm.deob.Field f, String name)
|
||||
{
|
||||
if (field.getNameAndType().getName().equals(f.getName()) && field.getClassEntry().getName().equals(f.getFields().getClassFile().getName()))
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
info.sigterm.deob.Field f2 = cf.findFieldDeep(nat);
|
||||
|
||||
if (f2 == f)
|
||||
{
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
NameAndType newNat = new NameAndType(name, nat.getDescriptorType());
|
||||
field = new Field(clazz, newNat);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ public class MultiANewArray extends Instruction
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
// class is an array type, ugh.
|
||||
info.sigterm.deob.signature.Type t = new info.sigterm.deob.signature.Type(cf.getName());
|
||||
if (t.getType().equals(cf.getName()))
|
||||
clazz = new Class(name, t.getArrayDims());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,16 +61,25 @@ public class PutField extends Instruction implements SetFieldInstruction
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
|
||||
if (field.getNameAndType().getDescriptorType().getType().equals("L" + cf.getName() + ";"))
|
||||
field = new Field(field.getClassEntry(), new NameAndType(field.getNameAndType().getName(), new info.sigterm.deob.signature.Type("L" + name + ";", field.getNameAndType().getDescriptorType().getArrayDims())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameField(info.sigterm.deob.Field f, String name)
|
||||
{
|
||||
if (field.getNameAndType().getName().equals(f.getName()) && field.getClassEntry().getName().equals(f.getFields().getClassFile().getName()))
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
info.sigterm.deob.Field f2 = cf.findFieldDeep(nat);
|
||||
|
||||
if (f2 == f)
|
||||
{
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
NameAndType newNat = new NameAndType(name, nat.getDescriptorType());
|
||||
field = new Field(clazz, newNat);
|
||||
}
|
||||
|
||||
@@ -60,16 +60,25 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
|
||||
if (field.getNameAndType().getDescriptorType().getType().equals("L" + cf.getName() + ";"))
|
||||
field = new Field(field.getClassEntry(), new NameAndType(field.getNameAndType().getName(), new info.sigterm.deob.signature.Type("L" + name + ";", field.getNameAndType().getDescriptorType().getArrayDims())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameField(info.sigterm.deob.Field f, String name)
|
||||
{
|
||||
if (field.getNameAndType().getName().equals(f.getName()) && field.getClassEntry().getName().equals(f.getFields().getClassFile().getName()))
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
info.sigterm.deob.Field f2 = cf.findFieldDeep(nat);
|
||||
|
||||
if (f2 == f)
|
||||
{
|
||||
Class clazz = field.getClassEntry();
|
||||
NameAndType nat = field.getNameAndType();
|
||||
|
||||
NameAndType newNat = new NameAndType(name, nat.getDescriptorType());
|
||||
field = new Field(clazz, newNat);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user