diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reversedebugger/CallStackMethodExecutions.java b/org.ntlab.reverseDebugger/src/org/ntlab/reversedebugger/CallStackMethodExecutions.java deleted file mode 100644 index b711506..0000000 --- a/org.ntlab.reverseDebugger/src/org/ntlab/reversedebugger/CallStackMethodExecutions.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.ntlab.reversedebugger; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.TreeNode; -import org.ntlab.debuggingControl.MethodCaller; - -import com.sun.jdi.ClassNotLoadedException; -import com.sun.jdi.IncompatibleThreadStateException; -import com.sun.jdi.IntegerValue; -import com.sun.jdi.InvalidTypeException; -import com.sun.jdi.InvocationException; -import com.sun.jdi.ObjectReference; -import com.sun.jdi.ThreadReference; -import com.sun.jdi.Value; -import com.sun.jdi.VirtualMachine; -import com.sun.jdi.event.MethodEntryEvent; - -public class CallStackMethodExecutions { - private List callStackMethodExecutions = new ArrayList<>(); - - public List getCallStackMethodExecutions() { - return callStackMethodExecutions; - } - - public TreeNode[] getCallStackMethodExecutionsTreeNode() { - TreeNode[] roots = new TreeNode[1]; - if (callStackMethodExecutions.isEmpty()) { - return roots; - } - CallStackModel callStackModel = callStackMethodExecutions.get(0); - roots[0] = new TreeNode(new MethodCaller(callStackModel.getVm(), callStackModel.getThread())); - TreeNode parentNode = roots[0]; - TreeNode[] childrenNode = new TreeNode[callStackMethodExecutions.size()]; - parentNode.setChildren(childrenNode); - for (int i = 0; i < callStackMethodExecutions.size(); i++) { - TreeNode childNode = new TreeNode(callStackMethodExecutions.get(i)); - childNode.setParent(parentNode); - childrenNode[i] = childNode; - } - return roots; - } - - public void reset() { - callStackMethodExecutions.clear(); - } - - public void updateByDebuggerStopMethodExecution(MethodCaller me) { - if (me == null) { - return; - } - try { - VirtualMachine vm = me.getVm(); - ThreadReference thread = me.getThread(); - int lineNo = thread.frame(0).location().lineNumber(); - update(vm, thread, me.getObj(), lineNo); - } catch (InvalidTypeException | ClassNotLoadedException - | InvocationException | IncompatibleThreadStateException e) { - e.printStackTrace(); - } - } - - public void updateByAlias(MethodCaller alias) { - if (alias == null) { - return; - } - VirtualMachine vm = alias.getVm(); - ThreadReference thread = alias.getThread(); - try { - ObjectReference me = (ObjectReference)alias.callInstanceMethod("getMethodExecution"); - int lineNo = ((IntegerValue)alias.callInstanceMethod("getLineNo")).value(); - update(vm, thread, me, lineNo); - } catch (InvalidTypeException | ClassNotLoadedException - | InvocationException | IncompatibleThreadStateException e) { - e.printStackTrace(); - } - } - - private void update(VirtualMachine vm, ThreadReference thread, ObjectReference me, int topMethodCallLineNo) - throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException { - callStackMethodExecutions.clear(); - ObjectReference childMe = null; - int callLineNo = topMethodCallLineNo; - while (me != null) { - CallStackModel callStackModel = new CallStackModel(vm, thread, me, callLineNo); - callStackMethodExecutions.add(callStackModel); - childMe = me; - me = (ObjectReference)callStackModel.callInstanceMethod("getParent"); - if (me != null) { - MethodCaller mc = new MethodCaller(vm, thread, me); - ObjectReference callStatement = (ObjectReference)mc.callInstanceMethod("getMethodInvocation", childMe); - callLineNo = ((IntegerValue)mc.setObj(callStatement).callInstanceMethod("getLineNo")).value(); - } - } - } -}