debugging, idr, exception handler execution support

This commit is contained in:
Adam
2015-06-13 21:51:06 -04:00
parent 6cac8c1cc9
commit db6269ba7e
13 changed files with 289 additions and 33 deletions

View File

@@ -3,6 +3,7 @@ package info.sigterm.deob.execution;
import info.sigterm.deob.ClassFile;
import info.sigterm.deob.ClassGroup;
import info.sigterm.deob.Method;
import info.sigterm.deob.attributes.code.Exceptions;
import java.util.ArrayList;
import java.util.List;
@@ -26,8 +27,10 @@ public class Execution
{
if (method.getCode() == null)
continue;
Frame f = new Frame(this, method);
frames.add(f);
fcount += this.runFrames();
++count;
}

View File

@@ -23,7 +23,7 @@ public class Frame
private Stack stack;
private Variables variables;
private List<InstructionContext> instructions = new ArrayList<>(); // instructions executed in this frame
private Map<Instruction, Instruction> visited; // shared
private Map<Instruction, List<Instruction>> visited; // shared
public Frame(Execution execution, Method method)
{
@@ -73,11 +73,6 @@ public class Frame
executing = false;
}
public void throwException(Type type)
{
executing = false; // XXX
}
public Method getMethod()
{
return method;
@@ -154,17 +149,33 @@ public class Frame
private void doJump(Instruction from, Instruction to)
{
visited.put(from, to);
List<Instruction> l = visited.get(from);
if (l == null)
{
List<Instruction> l2 = new ArrayList<>();
l2.add(to);
visited.put(from, l2);
}
else
{
l.add(to);
}
}
private boolean hasJumped(Instruction from, Instruction to)
{
Instruction i = visited.get(from);
if (from instanceof TableSwitch || from instanceof LookupSwitch) // XXX magic instructions which jump to multiple different places
if (i != null)
return true;
assert i == null || i == to;
return i == to;
List<Instruction> i = visited.get(from);
if (i != null && i.contains(to))
return true;
if (i == null)
{
i = new ArrayList<>();
visited.put(from, i);
}
i.add(to);
return false;
}
public void jump(int offset)