Add field references, only for getstatic currently
This commit is contained in:
@@ -38,4 +38,9 @@ public class Code extends Attribute
|
||||
{
|
||||
return maxLocals;
|
||||
}
|
||||
|
||||
public void buildInstructionGraph()
|
||||
{
|
||||
instructions.buildInstructionGraph();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ public class Instruction
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
public Instructions getInstructions()
|
||||
{
|
||||
return instructions;
|
||||
}
|
||||
|
||||
public int getPc()
|
||||
{
|
||||
return pc;
|
||||
@@ -46,6 +51,10 @@ public class Instruction
|
||||
{
|
||||
}
|
||||
|
||||
public void buildInstructionGraph()
|
||||
{
|
||||
}
|
||||
|
||||
public void execute(Execution e)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,6 +53,12 @@ public class Instructions
|
||||
i.buildJumpGraph();
|
||||
}
|
||||
|
||||
public void buildInstructionGraph()
|
||||
{
|
||||
for (Instruction i : instructions)
|
||||
i.buildInstructionGraph();
|
||||
}
|
||||
|
||||
public Code getCode()
|
||||
{
|
||||
return code;
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ConstantPool;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Field;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -20,4 +25,23 @@ public class GetStatic extends Instruction
|
||||
length += 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildInstructionGraph()
|
||||
{
|
||||
ConstantPool pool = this.getInstructions().getCode().getAttributes().getClassFile().getPool();
|
||||
Field entry = (Field) pool.getEntry(index);
|
||||
|
||||
Class clazz = entry.getClassEntry();
|
||||
NameAndType nat = entry.getNameAndType();
|
||||
|
||||
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
info.sigterm.deob.Field f = cf.findField(nat);
|
||||
assert f != null;
|
||||
|
||||
f.addReference(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user