diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java index cc7f4cf..f92b30f 100644 --- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java +++ b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java @@ -153,14 +153,68 @@ // threadId�ɑΉ�����ThreadInstance���擾 className = "TraceJSON"; - methodName = "getThreadInstanceForDebuggingControl"; + methodName = "getThreadInstance"; Value threadInstance = callStaticMethod(vm, thread, packageName, className, methodName, threadId); // threadInstance�̌Ăяo���X�^�b�N��̃��\�b�h�ɂ‚��Ă̊e��f�[�^���擾���ĕ\������ // printStackData(vm, thread, threadInstance); // threadInstance�̃��\�b�h�Ăяo���؂̑S���\�b�h�ɂ‚��Ă̊e��f�[�^���擾���ĕ\������ - printCallTreeDataFromRoot(vm, thread, threadInstance); +// printCallTreeDataFromRoot(vm, thread, threadInstance); + + printObjectFlow(vm, thread, threadInstance); + } + + private void printObjectFlow(VirtualMachine vm, ThreadReference thread, Value threadInstance) throws InvalidTypeException, + ClassNotLoadedException, InvocationException, IncompatibleThreadStateException { + // ThreadInstance������curMethodExecution���擾 + String methodName = "getCurrentMethodExecution"; + Value methodExecution = callInstanceMethod(vm, thread, methodName, (ObjectReference)threadInstance); +// System.out.println(methodExecution); + + methodName = "getStatements"; + Value statements = callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecution); +// System.out.println(statements); + methodName = "size"; + int statementsSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)statements)).value(); +// System.out.println(statementsSize); + Value lastIndex = vm.mirrorOf(statementsSize - 1); + methodName = "get"; + Value lastStatement = callInstanceMethod(vm, thread, methodName, (ObjectReference)statements, lastIndex); +// System.out.println(lastStatement); + + methodName = "getCalledMethodExecution"; + Value calledMethodExecution = callInstanceMethod(vm, thread, methodName, (ObjectReference)lastStatement); +// System.out.println(calledMethodExecution); + methodName = "getReturnValue"; + Value returnValue = callInstanceMethod(vm, thread, methodName, (ObjectReference)calledMethodExecution); +// System.out.println(returnValue); + methodName = "getId"; + Value valueObjId = callInstanceMethod(vm, thread, methodName, (ObjectReference)returnValue); +// System.out.println(valueObjId); + + +// methodName = "getValueObjId"; +// Value valueObjId = callInstanceMethod(vm, thread, methodName, (ObjectReference)lastStatement); +// System.out.println(valueObjId); + methodName = "getTracePoint"; + Value tp = callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecution, lastIndex); +// System.out.println(tp); + Value occurrenceEXP = vm.mirrorOf(1); + methodName = "getAlias"; + String packageName = "org.ntlab.traceCollector.tracer.trace"; + String className = "TraceJSON"; + Value alias = callStaticMethod(vm, thread, packageName, className, methodName, valueObjId, tp, occurrenceEXP); +// System.out.println(alias); + methodName = "toString"; + Value str = callInstanceMethod(vm, thread, methodName, (ObjectReference)alias); + printValue("", "", str, true); + System.out.println(); + + methodName = "getObjectFlow"; + Value result = callStaticMethod(vm, thread, packageName, className, methodName, alias); + System.out.println(); + System.out.println(result); } /** @@ -229,17 +283,17 @@ return; } String methodName = "size"; - final int METHOD_EXECUTION_SIZE = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecutions)).value(); - if (METHOD_EXECUTION_SIZE == 0) { + final int METHOD_EXECUTIONS_SIZE = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecutions)).value(); + if (METHOD_EXECUTIONS_SIZE == 0) { return; } final String DEEP_SPACE_INDENT = indent.replace("-", " ") + " "; // ���\�b�h�V�O�l�`���ȊO�ł̕\���p - for (int i = 0; i < METHOD_EXECUTION_SIZE; i++) { + for (int i = 0; i < METHOD_EXECUTIONS_SIZE; i++) { IntegerValue index = vm.mirrorOf(i); methodName = "get"; Value methodExecution = callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecutions, index); - Value lineNo = (parent != null) ? getMethodExecutionLineNo(vm, thread, parent, methodExecution) : vm.mirrorOf(0); + Value lineNo = (parent != null) ? getMethodExecutionLineNo(vm, thread, parent, methodExecution) : vm.mirrorOf(0); // �f�[�^�̎擾�ƕ\���֘A Value methodSignature = getMethodExecutionSignature(vm, thread, methodExecution); @@ -333,7 +387,7 @@ System.out.print(indent + fieldName); // ���̃t�B�[���h�ɂ‚��Ă̍ŐV�̍X�V�����擾(FieldUpdate) - methodName = "getRecentlyFieldUpdateForDebuggingControl"; + methodName = "getRecentlyFieldUpdate"; ObjectReference fieldUpdate = (ObjectReference)callStaticMethod(vm, thread, packageName, className, methodName, thisObjId, vm.mirrorOf(fieldName), thread); if (fieldUpdate == null) { System.out.println(" id = null����!" + " type = null����!"); @@ -402,7 +456,7 @@ for (int i = 0;; i++){ // ���̔z��v�f�ɂ‚��Ă̍ŐV�̍X�V�����擾(ArrayUpdate) - methodName = "getRecentlyArrayUpdateForDebuggingControl"; + methodName = "getRecentlyArrayUpdate"; IntegerValue index = vm.mirrorOf(i); ObjectReference arrayUpdate = (ObjectReference)callStaticMethod(vm, thread, packageName, className, methodName, arrayObjId, index, thread); if (arrayUpdate == null) { @@ -602,13 +656,14 @@ private boolean checkMethodSignature(IType type, IMethod method, String methodSignature) { String fqcn = type.getFullyQualifiedName(); try { - String jdiMethodSignature = (method.isConstructor()) ? (fqcn + "(") : (fqcn + "." + method.getElementName() + "("); - System.out.println(jdiMethodSignature); - if (methodSignature.contains(jdiMethodSignature)) { + StringBuilder jdtMethodSignature = new StringBuilder(); + jdtMethodSignature.append((method.isConstructor()) ? (fqcn + "(") : (fqcn + "." + method.getElementName() + "(")); + System.out.println(jdtMethodSignature); + if (methodSignature.contains(jdtMethodSignature)) { // ������v���Ă����ꍇ�Ɍ���A�������X�g����������ł���v���邩�ǂ����𔻒� (�I�[�o�[���[�h�ɂ��딻��������) - jdiMethodSignature += String.join(",", parseFQCNParameters(type, method)) + ")"; // �S�����̃V�O�l�`�������S���薼�ɕϊ�����,�ŋ�؂��������� - System.out.println(jdiMethodSignature); - return methodSignature.contains(jdiMethodSignature); + jdtMethodSignature.append(String.join(",", parseFQCNParameters(type, method)) + ")"); // �S�����̃V�O�l�`�������S���薼�ɕϊ�����,�ŋ�؂��������� + System.out.println(jdtMethodSignature); + return methodSignature.contains(jdtMethodSignature); } } catch (JavaModelException e) { e.printStackTrace();