Build jump graph
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Instruction
|
||||
{
|
||||
private Instructions instructions;
|
||||
private InstructionType type;
|
||||
private int pc;
|
||||
protected int length = 1;
|
||||
|
||||
private int pc; // offset into method this instructions resides at
|
||||
protected int length = 1; // length of this instruction
|
||||
|
||||
private ArrayList<Instruction> jump = new ArrayList<Instruction>(); // instructions which this instruction jumps to
|
||||
private ArrayList<Instruction> from = new ArrayList<Instruction>(); // instructions which jump to this instruction
|
||||
|
||||
public Instruction(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
@@ -14,8 +20,27 @@ public class Instruction
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
public int getPc()
|
||||
{
|
||||
return pc;
|
||||
}
|
||||
|
||||
public int getLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
protected void addJump(int offset)
|
||||
{
|
||||
Instruction other = instructions.findInstruction(pc + offset);
|
||||
assert other != null;
|
||||
assert other != this;
|
||||
|
||||
this.jump.add(other);
|
||||
other.from.add(this);
|
||||
}
|
||||
|
||||
public void buildJumpGraph()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user