package org.ntlab.reverseDebugger; import org.ntlab.onlineAccessor.JDIInstanceMethodCaller; import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.IncompatibleThreadStateException; import com.sun.jdi.InvalidTypeException; import com.sun.jdi.InvocationException; import com.sun.jdi.ObjectReference; import com.sun.jdi.StringReference; import com.sun.jdi.ThreadReference; import com.sun.jdi.Value; import com.sun.jdi.VirtualMachine; @SuppressWarnings("restriction") public class CallStackModel { private JDIInstanceMethodCaller methodExecutionMc; private int callLineNo; public CallStackModel(VirtualMachine vm, ThreadReference thread, ObjectReference methodExecution, int callLineNo) { methodExecutionMc = new JDIInstanceMethodCaller(vm, thread, methodExecution); this.callLineNo = callLineNo; } public VirtualMachine getVm() { return methodExecutionMc.getVm(); } public ThreadReference getThread() { return methodExecutionMc.getThread(); } public JDIInstanceMethodCaller getMethodCaller() { return methodExecutionMc; } public int getCallLineNo() { return callLineNo; } public String getSignature() { String signature = ""; try { signature = ((StringReference)methodExecutionMc.callInstanceMethod("getSignature")).value(); } catch (InvalidTypeException | ClassNotLoadedException | InvocationException | IncompatibleThreadStateException e) { e.printStackTrace(); } return signature; } public Value callInstanceMethod(String methodName, Value... args) throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException { return methodExecutionMc.callInstanceMethod(methodName, args); } }