diff --git a/org.ntlab.reverseDebugger/META-INF/MANIFEST.MF b/org.ntlab.reverseDebugger/META-INF/MANIFEST.MF
index 0221e87..d9af2e3 100644
--- a/org.ntlab.reverseDebugger/META-INF/MANIFEST.MF
+++ b/org.ntlab.reverseDebugger/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DebuggingControl
-Bundle-SymbolicName: org.ntlab.reverseDebugger2;singleton:=true
+Bundle-SymbolicName: org.ntlab.reverseDebugger;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.ntlab.debuggingControl.Activator
Require-Bundle: org.eclipse.ui,
diff --git a/org.ntlab.reverseDebugger/plugin.xml b/org.ntlab.reverseDebugger/plugin.xml
index ebd68a0..b10e8f3 100644
--- a/org.ntlab.reverseDebugger/plugin.xml
+++ b/org.ntlab.reverseDebugger/plugin.xml
@@ -54,7 +54,7 @@
+ class="org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerLaunchConfiguration">
diff --git a/org.ntlab.reverseDebugger/speedResult.csv b/org.ntlab.reverseDebugger/speedResult.csv
index 06a88c1..50b73de 100644
--- a/org.ntlab.reverseDebugger/speedResult.csv
+++ b/org.ntlab.reverseDebugger/speedResult.csv
@@ -1,4 +1,4 @@
-!SESSION 2018-09-21 14:34:47.545 -----------------------------------------------
+!SESSION 2018-09-21 18:10:10.406 -----------------------------------------------
eclipse.buildId=4.4.2.M20150204-1700
java.version=1.8.0_144
java.vendor=Oracle Corporation
@@ -6,10 +6,10 @@
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data C:\Users\student\workspace/../runtime-EclipseApplication -dev file:C:/Users/student/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog
-!ENTRY org.eclipse.core.resources 2 10035 2018-09-21 14:34:50.118
+!ENTRY org.eclipse.core.resources 2 10035 2018-09-21 18:10:13.700
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
-!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.050
+!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 18:10:23.074
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
@@ -17,7 +17,7 @@
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
-!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.066
+!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 18:10:23.090
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\student'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
@@ -34,31 +34,10 @@
classpath[1] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\bin\
classpath[2] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\javassist.jar
classpath[3] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.reverseDebugger\org.ntlab.reverseDebugger\bin\
-Main (2):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@3ed15147
-threadId = "1"
-targetSignature: void Stream.print(Account)
-
-ReverseDebugger:
-Exp (RD),36943787
-Exp (RD),26401389
-Exp (RD),25245539
-Exp (RD),18481762
-Exp (RD),21961946
-Exp (RD),24472604
-Exp (RD),22119848
-Exp (RD),19258645
-Exp (RD),25412917
-Exp (RD),20806885
-
-TraceCollector:
-Exp (TC),27179852
-Exp (TC),2595136
-Exp (TC),2990684
-Exp (TC),2403285
-Exp (TC),2804359
-Exp (TC),2524870
-Exp (TC),2853308
-Exp (TC),3163588
-Exp (TC),3174641
-Exp (TC),3058582
-
+callStackView�N���X���������ꂽ��
+CallStackView#createPartControl(Composite)���Ăꂽ��!
+Main (2):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@75ce37f6SeedAliasView�N���X���������ꂽ��!
+SeedAliasView#createPartControl(Composite)���Ăꂽ��!
+ObjectFlowView�N���X���������ꂽ��!
+ObjectFlowView#createPartControl(Composite)���Ăꂽ��!
+Main (2):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@75ce37f6
\ No newline at end of file
diff --git a/org.ntlab.reverseDebugger/speedResultTmp.csv b/org.ntlab.reverseDebugger/speedResultTmp.csv
new file mode 100644
index 0000000..5b47f70
--- /dev/null
+++ b/org.ntlab.reverseDebugger/speedResultTmp.csv
@@ -0,0 +1,63 @@
+9,!ENTRY org.eclipse.core.resources 2 10035 2018-09-21 14:34:50.118,,,
+12,!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.050,,,
+20,!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.066,,,
+10,!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.,,,
+13,"!MESSAGE Warning: EGit couldn't detect the installation path ""gitPrefix"" of native Git. Hence EGit can't respect system level",,,
+21,!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git,,,
+1,!SESSION 2018-09-21 14:34:47.545 -----------------------------------------------,,,
+5,BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ja_JP
+26,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Account,,,
+27,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Bank,,,
+28,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Company,,,
+29,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Main,,,
+30,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Money,,,
+31,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Person,,,
+32,C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Stream,,,
+33,classpath[0] = C:\Users\student\runtime-EclipseApplication\ObjectFlowTest\bin,,,
+34,classpath[1] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\bin\,,,
+35,classpath[2] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\javassist.jar,,,
+36,classpath[3] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.reverseDebugger\org.ntlab.reverseDebugger\bin\,,,
+7,Command-line arguments: -product org.eclipse.platform.ide -data C:\Users\student\workspace/../runtime-EclipseApplication -dev file:C:/Users/student/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog,,,
+2,eclipse.buildId=4.4.2.M20150204-1700,,,
+24,EGit might behave differently since they see different configuration options.,,,
+42,Exp (RD),36943787,,
+43,Exp (RD),26401389,,
+44,Exp (RD),25245539,,
+45,Exp (RD),18481762,,
+46,Exp (RD),21961946,,
+47,Exp (RD),24472604,,
+48,Exp (RD),22119848,,
+49,Exp (RD),19258645,,
+50,Exp (RD),25412917,,
+51,Exp (RD),20806885,,
+54,Exp (TC),27179852,,
+55,Exp (TC),2595136,,
+56,Exp (TC),2990684,,
+57,Exp (TC),2403285,,
+58,Exp (TC),2804359,,
+59,Exp (TC),2524870,,
+60,Exp (TC),2853308,,
+61,Exp (TC),3163588,,
+62,Exp (TC),3174641,,
+63,Exp (TC),3058582,,
+6,Framework arguments: -product org.eclipse.platform.ide,,,
+14,Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.,,,
+4,java.vendor=Oracle Corporation,,,
+3,java.version=1.8.0_144,,,
+37,Main (2):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@3ed15147,,,
+23,not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and,,,
+41,ReverseDebugger:,,,
+39,targetSignature: void Stream.print(Account),,,
+17,Team > Git > Configuration preference page's 'System Settings' tab.,,,
+15,The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in,,,
+16,this system level configuration. The Git installation location can be configured on the,,,
+18,This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.,,,
+25,This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.,,,
+38,"threadId = ""1""",,,
+53,TraceCollector:,,,
+22,user global configuration and to define the default location to store repositories: 'C:\Users\student'. If this is,,,
+8,,,,
+11,,,,
+19,,,,
+40,,,,
+52,,,,
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java
index a63c5c4..ed58908 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/DebuggingControlAction.java
@@ -33,8 +33,8 @@
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PartInitException;
import org.ntlab.reverseDebugger.ObjectFlowAliases;
-import org.ntlab.reverseDebugger.OnlineTraceAnalyzer;
-import org.ntlab.reverseDebugger.OnlineTraceAnalyzerCallTester;
+import org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerAnalyzer;
+import org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerAnalyzerCallTester;
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.BooleanValue;
@@ -178,100 +178,100 @@
// analyzerCallTester.test1(vm, thread);
}
- /**
- * �I�����C����͒���traceCollector��TraceJSON#getObjectFlow()���Ăяo�����̃R�[�h
- * 2018/9/16�NjL �����炩��objectFlow���Ăяo���K�v�͂Ȃ��Ȃ������߂����s�v�ȃR�[�h�ƍl���Ă悢
- * �v�ύX���s�������ߌĂяo���ƃG���[���������邩������Ȃ�(�����s�v�ȃR�[�h�̂��߃e�X�g���Ă��Ȃ�)
- * @param vm
- * @param thread
- * @param threadInstance
- */
- private void printObjectFlow(VirtualMachine vm, ThreadReference thread, Value threadInstance) throws InvalidTypeException,
- ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
- // ThreadInstance������curMethodExecution��, ����statement���X�g���擾
- String methodName = "getCurrentMethodExecution";
- Value methodExecution = callInstanceMethod(vm, thread, methodName, (ObjectReference)threadInstance);
- Scanner scanner = new Scanner(System.in);
- methodName = "getStatements";
- Value statements = callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecution);
- methodName = "size";
- int statementsSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)statements)).value();
-
- // �f�o�b�K�Ŏ~�߂Ă���n�_�ɊY�����郁�\�b�h���s����, �X�^�[�g�ƂȂ���̃G�C���A�X�̃��X�g���擾���ĕ\������
-// String packageName = "org.ntlab.traceCollector.tracer.trace";
-// String className = "TraceJSON";
- String packageName = "org.ntlab.reverseDebugger";
- String className = "OnlineTraceAnalyzer";
- methodName = "findAllStartAlias";
- Value startAliasList = callStaticMethod(vm, thread, packageName, className, methodName, methodExecution);
- methodName = "size";
- int startAliasListSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList)).value();
- System.out.println("-----------------------------------------------------");
- for (int i = 0; i < startAliasListSize; i++) {
- methodName = "get";
- Value startAlias = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList, vm.mirrorOf(i));
- StringBuilder sb = new StringBuilder(String.format("%2d%s", i, ": "));
- methodName = "getObjectId";
- sb.append(String.format("%12s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
- methodName = "getLineNo";
- sb.append(String.format("%4s", ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
- methodName = "getStatementType";
- sb.append(String.format("%-16s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value()));
- sb.append(" -> ");
- methodName = "getStatementSignature";
- sb.append(String.format("%-30s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
- methodName = "getOccurrenceExp";
- sb.append(String.format("%3d%s", ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value(), " "));
- methodName = "getClassName";
- sb.append(String.format("%-20s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
- System.out.println(sb);
- }
- System.out.println("-----------------------------------------------------");
-
- // �I�������G�C���A�X���N�_�ɃI�u�W�F�N�g�t���[���Ăяo���Č��ʂ����X�g�Ŏ��
- System.out.print("(input)aliasNo? -> ");
- int aliasNo = scanner.nextInt();
- methodName = "get";
- Value startAlias = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList, vm.mirrorOf(aliasNo));
-
-// // DebuggingControl������GUI�֘A�̃N���X�̕��ɖ�����V�[�h�G�C���A�X��n���ăI�u�W�F�N�g�t���[�����s���Ă݂�
-// // �ꎞ�I�Ȃ��̂�, �ŏI�I�ɂ͂����ł�鏈���ł͂Ȃ��Ȃ�̂ŕs�v�ɂȂ�͂�
-// ObjectFlowAliases.getInstance().getObjectFlow(new MethodCaller(vm, thread, (ObjectReference)startAlias));
-
- // �ȉ��͈ꎞ�I�ɃR�����g�A�E�g���Ă���
-// methodName = "toString";
-// Value str = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias);
-// printValue("", "", str, true);
-// methodName = "getObjectFlow";
-// Value aliasLists = callStaticMethod(vm, thread, packageName, className, methodName, startAlias);
-// System.out.println();
-//
-// // �擾�������X�g�̒��g�����[�v�ʼnȂ���m�F��, ���łɓ��Y�\�[�X�t�@�C����Ώ�Eclipse�ŊJ�����Ă݂�
+// /**
+// * �I�����C����͒���traceCollector��TraceJSON#getObjectFlow()���Ăяo�����̃R�[�h
+// * 2018/9/16�NjL �����炩��objectFlow���Ăяo���K�v�͂Ȃ��Ȃ������߂����s�v�ȃR�[�h�ƍl���Ă悢
+// * �v�ύX���s�������ߌĂяo���ƃG���[���������邩������Ȃ�(�����s�v�ȃR�[�h�̂��߃e�X�g���Ă��Ȃ�)
+// * @param vm
+// * @param thread
+// * @param threadInstance
+// */
+// private void printObjectFlow(VirtualMachine vm, ThreadReference thread, Value threadInstance) throws InvalidTypeException,
+// ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+// // ThreadInstance������curMethodExecution��, ����statement���X�g���擾
+// String methodName = "getCurrentMethodExecution";
+// Value methodExecution = callInstanceMethod(vm, thread, methodName, (ObjectReference)threadInstance);
+// Scanner scanner = new Scanner(System.in);
+// methodName = "getStatements";
+// Value statements = callInstanceMethod(vm, thread, methodName, (ObjectReference)methodExecution);
// methodName = "size";
-// int aliasListsSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasLists)).value();
-// List> objectFlowAliasLists = new ArrayList<>();
-// for (int i = 0; i < aliasListsSize; i++) {
-// List objectFlowAliasList = new ArrayList<>();
-// objectFlowAliasLists.add(objectFlowAliasList);
-// System.out.println("---------------------------------------------");
-// System.out.println("���X�g" + i);
+// int statementsSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)statements)).value();
+//
+// // �f�o�b�K�Ŏ~�߂Ă���n�_�ɊY�����郁�\�b�h���s����, �X�^�[�g�ƂȂ���̃G�C���A�X�̃��X�g���擾���ĕ\������
+//// String packageName = "org.ntlab.traceCollector.tracer.trace";
+//// String className = "TraceJSON";
+// String packageName = "org.ntlab.reverseDebugger";
+// String className = "OnlineTraceAnalyzer";
+// methodName = "findAllStartAlias";
+// Value startAliasList = callStaticMethod(vm, thread, packageName, className, methodName, methodExecution);
+// methodName = "size";
+// int startAliasListSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList)).value();
+// System.out.println("-----------------------------------------------------");
+// for (int i = 0; i < startAliasListSize; i++) {
// methodName = "get";
-// Value aliasList = callInstanceMethod(vm, thread, methodName,(ObjectReference)aliasLists, vm.mirrorOf(i));
-// methodName = "size";
-// int aliasListSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasList)).value();
-// for (int j = 0; j < aliasListSize; j++) {
-// methodName = "get";
-// Value alias = callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasList, vm.mirrorOf(j));
-// methodName = "toString";
-// Value str2 = callInstanceMethod(vm, thread, methodName, (ObjectReference)alias);
-// printValue("", "", str2, true);
-// methodName = "getMethodExecution";
-// Value aliasMethodExecution = callInstanceMethod(vm ,thread, methodName, (ObjectReference)alias);
-// openSrcFileOfMethodExecution(vm, thread, aliasMethodExecution);
-// objectFlowAliasList.add(new MethodCaller(vm, thread, (ObjectReference)alias));
-// }
+// Value startAlias = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList, vm.mirrorOf(i));
+// StringBuilder sb = new StringBuilder(String.format("%2d%s", i, ": "));
+// methodName = "getObjectId";
+// sb.append(String.format("%12s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
+// methodName = "getLineNo";
+// sb.append(String.format("%4s", ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
+// methodName = "getStatementType";
+// sb.append(String.format("%-16s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value()));
+// sb.append(" -> ");
+// methodName = "getStatementSignature";
+// sb.append(String.format("%-30s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
+// methodName = "getOccurrenceExp";
+// sb.append(String.format("%3d%s", ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value(), " "));
+// methodName = "getClassName";
+// sb.append(String.format("%-20s", ((StringReference)callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias)).value() + " "));
+// System.out.println(sb);
// }
- }
+// System.out.println("-----------------------------------------------------");
+//
+// // �I�������G�C���A�X���N�_�ɃI�u�W�F�N�g�t���[���Ăяo���Č��ʂ����X�g�Ŏ��
+// System.out.print("(input)aliasNo? -> ");
+// int aliasNo = scanner.nextInt();
+// methodName = "get";
+// Value startAlias = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAliasList, vm.mirrorOf(aliasNo));
+//
+//// // DebuggingControl������GUI�֘A�̃N���X�̕��ɖ�����V�[�h�G�C���A�X��n���ăI�u�W�F�N�g�t���[�����s���Ă݂�
+//// // �ꎞ�I�Ȃ��̂�, �ŏI�I�ɂ͂����ł�鏈���ł͂Ȃ��Ȃ�̂ŕs�v�ɂȂ�͂�
+//// ObjectFlowAliases.getInstance().getObjectFlow(new MethodCaller(vm, thread, (ObjectReference)startAlias));
+//
+// // �ȉ��͈ꎞ�I�ɃR�����g�A�E�g���Ă���
+//// methodName = "toString";
+//// Value str = callInstanceMethod(vm, thread, methodName, (ObjectReference)startAlias);
+//// printValue("", "", str, true);
+//// methodName = "getObjectFlow";
+//// Value aliasLists = callStaticMethod(vm, thread, packageName, className, methodName, startAlias);
+//// System.out.println();
+////
+//// // �擾�������X�g�̒��g�����[�v�ʼnȂ���m�F��, ���łɓ��Y�\�[�X�t�@�C����Ώ�Eclipse�ŊJ�����Ă݂�
+//// methodName = "size";
+//// int aliasListsSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasLists)).value();
+//// List> objectFlowAliasLists = new ArrayList<>();
+//// for (int i = 0; i < aliasListsSize; i++) {
+//// List objectFlowAliasList = new ArrayList<>();
+//// objectFlowAliasLists.add(objectFlowAliasList);
+//// System.out.println("---------------------------------------------");
+//// System.out.println("���X�g" + i);
+//// methodName = "get";
+//// Value aliasList = callInstanceMethod(vm, thread, methodName,(ObjectReference)aliasLists, vm.mirrorOf(i));
+//// methodName = "size";
+//// int aliasListSize = ((IntegerValue)callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasList)).value();
+//// for (int j = 0; j < aliasListSize; j++) {
+//// methodName = "get";
+//// Value alias = callInstanceMethod(vm, thread, methodName, (ObjectReference)aliasList, vm.mirrorOf(j));
+//// methodName = "toString";
+//// Value str2 = callInstanceMethod(vm, thread, methodName, (ObjectReference)alias);
+//// printValue("", "", str2, true);
+//// methodName = "getMethodExecution";
+//// Value aliasMethodExecution = callInstanceMethod(vm ,thread, methodName, (ObjectReference)alias);
+//// openSrcFileOfMethodExecution(vm, thread, aliasMethodExecution);
+//// objectFlowAliasList.add(new MethodCaller(vm, thread, (ObjectReference)alias));
+//// }
+//// }
+// }
/**
* �����œn����threadInstance�̌Ăяo���X�^�b�N��̃��\�b�h�ɂ��Ă̊e��f�[�^���擾���ĕ\������
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java
deleted file mode 100644
index 3e9e5cf..0000000
--- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.ntlab.debuggingControl;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdi.TimeoutException;
-import org.eclipse.jdt.core.Signature;
-
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.LongValue;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachine;
-
-public class MethodCaller {
- private VirtualMachine vm;
- private ThreadReference thread;
- private ObjectReference obj;
-
- public MethodCaller(VirtualMachine vm, ThreadReference thread) {
- this.vm = vm;
- this.thread = thread;
- }
-
- public MethodCaller(VirtualMachine vm, ThreadReference thread, ObjectReference obj) {
- this(vm, thread);
- this.obj = obj;
- }
-
- public VirtualMachine getVm() {
- return vm;
- }
-
- public ThreadReference getThread() {
- return thread;
- }
-
- public ObjectReference getObj() {
- return obj;
- }
-
- public long getThreadId() {
- MethodCaller mc = new MethodCaller(vm, thread, thread);
- try {
- return ((LongValue)mc.callInstanceMethod("getId")).value();
- } catch (InvalidTypeException | ClassNotLoadedException
- | InvocationException | IncompatibleThreadStateException e) {
- e.printStackTrace();
- }
- throw new IllegalStateException();
- }
-
- public MethodCaller setObj(ObjectReference obj) {
- this.obj = obj;
- return this;
- }
-
- /**
- * �p�b�P�[�W���ƃN���X���ƃ��\�b�h���ƈ������w�肵�Ă��̃N���X���\�b�h���Ăяo��
- * @param packageName �Ăт����������\�b�h������N���X�̃p�b�P�[�W��
- * @param className �Ăяo���������\�b�h������N���X��
- * @param methodName �Ăяo���������\�b�h�� (static)
- * @param args �Ăяo���������\�b�h�ɓn������(Value �̃N���X�^�ʼnϒ�)
- * @return �Ăяo�������\�b�h����̖߂�l(Value)
- */
- public Value callStaticMethod(String packageName, String className, String methodName, Value... args)
- throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
- String fqcn = packageName + "." + className;
- List classes = vm.classesByName(fqcn); // �N���X�� (���S����N���X��)
-
- // ���Y�N���X���^�[�Q�b�gVM��Ń��[�h����Ă��Ȃ��ꍇ��, JDI��p���ă^�[�Q�b�gJVM��Ń��t���N�V�����ɂ�铖�Y�N���X�̃��[�h�����s����
- if (classes.isEmpty()) {
- List list = vm.classesByName("java.lang.Class");
- ClassType type = (ClassType)list.get(0);
- List methodsByName = type.methodsByName("forName");
- List argList = new ArrayList<>();
- argList.add(vm.mirrorOf(fqcn));
- type.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED);
- classes = vm.classesByName(fqcn); // �N���X�� (���S����N���X��)
- }
- ClassType type = (ClassType)classes.get(0);
- List methodsByName = type.methodsByName(methodName);
- List argList = Arrays.asList(args); // ���\�b�h�ɓn�������̃��X�g
- return type.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED); // �f�o�b�O���̃v���O�������̃��\�b�h���Ăяo��
- }
-
- /**
- * ���\�b�h����ObjectReference�ƈ������w�肵�Ă��̃I�u�W�F�N�g�̃C���X�^���X���\�b�h���Ăяo��
- * @param methodName �Ăяo���������\�b�h��
- * @param args �Ăяo���������\�b�h�ɓn������(Value �̃N���X�^�ʼnϒ�)
- * @return �Ăяo�������\�b�h����̖߂�l(Value)
- */
- public Value callInstanceMethod(String methodName, Value... args)
- throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
- ClassType type = (ClassType)obj.type();
- List methodsByName = type.methodsByName(methodName);
- List argList = Arrays.asList(args); // ���\�b�h�ɓn�������̃��X�g
- return obj.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED); // �f�o�b�O���̃v���O�������̃��\�b�h���Ăяo��
- }
-}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java
index 44be243..4cd8c8b 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java
@@ -1,5 +1,8 @@
package org.ntlab.debuggingControl;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerLaunchConfiguration;
+
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
import com.sun.jdi.IntegerValue;
@@ -14,16 +17,15 @@
public class SpeedTester {
private static final String TRACE = "org.ntlab.traceCollector.tracer.trace";
- private static final String ANALYZER = "org.ntlab.reverseDebugger";
public void countMethodExecutionTest(VirtualMachine vm, ThreadReference thread) {
- MethodCaller mc = new MethodCaller(vm, thread);
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(vm, thread, null);
try {
StringReference threadId = mc.getVm().mirrorOf(String.valueOf(mc.getThreadId()));
ObjectReference threadInstance = (ObjectReference)mc.callStaticMethod(TRACE, "TraceJSON", "getThreadInstance", threadId);
- ObjectReference roots = (ObjectReference)mc.setObj(threadInstance).callInstanceMethod("getRoot");
+ ObjectReference roots = (ObjectReference)mc.changeReceiver(threadInstance).callInstanceMethod("getRoot");
ObjectReference currentMe = (ObjectReference)mc.callInstanceMethod("getCurrentMethodExecution");
- String targetSignature = ((StringReference)mc.setObj(currentMe).callInstanceMethod("getSignature")).value();
+ String targetSignature = ((StringReference)mc.changeReceiver(currentMe).callInstanceMethod("getSignature")).value();
System.out.println("targetSignature: " + targetSignature);
final int LOOP = 10;
@@ -40,12 +42,12 @@
}
}
- private void test(MethodCaller mc, ObjectReference roots, String targetSignature, SpeedTestType type, final int LOOP)
+ private void test(JDIInstanceMethodCaller mc, ObjectReference roots, String targetSignature, SpeedTestType type, final int LOOP)
throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
int count = 0;
long beforeTime = 0, afterTime = 0;
for (int i = 0; i < LOOP; i++) {
- mc.setObj(roots);
+ mc.changeReceiver(roots);
switch (type) {
case REVERSE_DEBUGGER:
beforeTime = System.nanoTime();
@@ -62,20 +64,18 @@
}
}
- private int countMethodExecutionInTraceCollector(MethodCaller mc, String targetSignture, int count, String indent)
+ private int countMethodExecutionInTraceCollector(JDIInstanceMethodCaller mc, String targetSignture, int count, String indent)
throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
VirtualMachine vm = mc.getVm();
String methodName = "countMethodExecutionInTraceCollector";
-// return ((IntegerValue)mc.callStaticMethod(TRACE, "TraceJSON", methodName, mc.getObj(),
-// vm.mirrorOf(targetSignture), vm.mirrorOf(count), vm.mirrorOf(indent))).value();
- return ((IntegerValue)mc.callStaticMethod(ANALYZER, "OnlineTraceAnalyzer", methodName, mc.getObj(),
+ return ((IntegerValue)mc.callStaticMethod(ReverseDebuggerLaunchConfiguration.ANALYZER_PACKAGE, ReverseDebuggerLaunchConfiguration.ANALYZER_CLASS, methodName, mc.getReceiver(),
vm.mirrorOf(targetSignture), vm.mirrorOf(count), vm.mirrorOf(indent))).value();
}
- private int countMethodExecutionInReverseDebugger(MethodCaller mc, String targetSignature, int count, String indent)
+ private int countMethodExecutionInReverseDebugger(JDIInstanceMethodCaller mc, String targetSignature, int count, String indent)
throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
VirtualMachine vm = mc.getVm();
- ObjectReference methodExecutions = mc.getObj();
+ ObjectReference methodExecutions = mc.getReceiver();
if (methodExecutions == null) {
return count;
}
@@ -85,14 +85,14 @@
}
for (int i = 0; i < methodExecutionsSize; i++) {
IntegerValue index = vm.mirrorOf(i);
- ObjectReference methodExecution = (ObjectReference)mc.setObj(methodExecutions).callInstanceMethod("get", index);
- String signature = ((StringReference)mc.setObj(methodExecution).callInstanceMethod("getSignature")).value();
+ ObjectReference methodExecution = (ObjectReference)mc.changeReceiver(methodExecutions).callInstanceMethod("get", index);
+ String signature = ((StringReference)mc.changeReceiver(methodExecution).callInstanceMethod("getSignature")).value();
// System.out.println(indent + signature);
if (targetSignature.equals(signature)) {
count++;
}
ObjectReference children = (ObjectReference)mc.callInstanceMethod("getChildren");
- count = countMethodExecutionInReverseDebugger(mc.setObj(children), targetSignature, count, indent + "--------");
+ count = countMethodExecutionInReverseDebugger(mc.changeReceiver(children), targetSignature, count, indent + "--------");
}
return count;
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
new file mode 100644
index 0000000..a94fd82
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
@@ -0,0 +1,41 @@
+package org.ntlab.onlineAccessor;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.internal.core.LaunchManager;
+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
+
+import com.sun.jdi.VirtualMachine;
+
+public class JDIDebuggingVirtualMachine {
+
+ public static VirtualMachine getDebuggineVirtualMachine()
+ throws NotExecutedException, NotSuspendedException, NotDebuggedException {
+ LaunchManager lm = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches = lm.getLaunches();
+ if (launches.length == 0) {
+ throw new NotExecutedException(); // ��x��Java�v���O���������s���Ă��Ȃ��Ƃ�
+ } else {
+ ILaunch debugLaunch = null;
+ for (int i = 0; i < launches.length; i++) {
+ System.out.print(launches[i].getLaunchConfiguration().getName() + ":");
+ System.out.print(launches[i].getDebugTarget());
+ if (launches[i].getDebugTarget() != null) {
+ debugLaunch = launches[i];
+ break;
+ }
+ }
+ if (debugLaunch != null) {
+ JDIDebugTarget debugTarget = ((JDIDebugTarget)debugLaunch.getDebugTarget());
+ VirtualMachine vm = debugTarget.getVM();
+ if (vm != null) {
+ return vm;
+ } else {
+ throw new NotSuspendedException(); // Java�v���O�������f�o�b�O���s���̒�~��Ԃɂ��Ă��Ȃ��Ƃ�
+ }
+ } else {
+ throw new NotDebuggedException(); // Java�v���O�������f�o�b�O���s���Ă��Ȃ��Ƃ�
+ }
+ }
+ }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIInstanceMethodCaller.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIInstanceMethodCaller.java
new file mode 100644
index 0000000..568e97b
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIInstanceMethodCaller.java
@@ -0,0 +1,55 @@
+package org.ntlab.onlineAccessor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdi.TimeoutException;
+import org.eclipse.jdt.core.Signature;
+
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.LongValue;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+
+public class JDIInstanceMethodCaller extends JDIStaticMethodCaller {
+ private ObjectReference receiver;
+
+ public JDIInstanceMethodCaller(VirtualMachine vm, ThreadReference thread, ObjectReference receiver) {
+ super(vm, thread);
+ this.receiver = receiver;
+ }
+
+ public ObjectReference getReceiver() {
+ return receiver;
+ }
+
+ public JDIInstanceMethodCaller changeReceiver(ObjectReference receiver) {
+ this.receiver = receiver;
+ return this;
+ }
+
+ /**
+ * ���\�b�h����ObjectReference�ƈ������w�肵�Ă��̃I�u�W�F�N�g�̃C���X�^���X���\�b�h���Ăяo��
+ * @param methodName �Ăяo���������\�b�h��
+ * @param args �Ăяo���������\�b�h�ɓn������(Value �̃N���X�^�ʼnϒ�)
+ * @return �Ăяo�������\�b�h����̖߂�l(Value)
+ */
+ public Value callInstanceMethod(String methodName, Value... args)
+ throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+ ClassType type = (ClassType)receiver.type();
+ List methodsByName = type.methodsByName(methodName);
+ List argList = Arrays.asList(args); // ���\�b�h�ɓn�������̃��X�g
+ return receiver.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED); // �f�o�b�O���̃v���O�������̃��\�b�h���Ăяo��
+ }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIStaticMethodCaller.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIStaticMethodCaller.java
new file mode 100644
index 0000000..0f48d30
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/JDIStaticMethodCaller.java
@@ -0,0 +1,77 @@
+package org.ntlab.onlineAccessor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.LongValue;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+
+public class JDIStaticMethodCaller {
+ protected VirtualMachine vm;
+ protected ThreadReference thread;
+
+ public JDIStaticMethodCaller(VirtualMachine vm, ThreadReference thread) {
+ this.vm = vm;
+ this.thread = thread;
+ }
+
+ public VirtualMachine getVm() {
+ return vm;
+ }
+
+ public ThreadReference getThread() {
+ return thread;
+ }
+
+ public long getThreadId() {
+ ClassType type = (ClassType)thread.type();
+ List methodsByName = type.methodsByName("getId");
+ List argList = new ArrayList<>();
+ try {
+ return ((LongValue)thread.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED)).value();
+ } catch (InvalidTypeException | ClassNotLoadedException
+ | IncompatibleThreadStateException | InvocationException e) {
+ e.printStackTrace();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * �p�b�P�[�W���ƃN���X���ƃ��\�b�h���ƈ������w�肵�Ă��̃N���X���\�b�h���Ăяo��
+ * @param packageName �Ăт����������\�b�h������N���X�̃p�b�P�[�W��
+ * @param className �Ăяo���������\�b�h������N���X��
+ * @param methodName �Ăяo���������\�b�h�� (static)
+ * @param args �Ăяo���������\�b�h�ɓn������(Value �̃N���X�^�ʼnϒ�)
+ * @return �Ăяo�������\�b�h����̖߂�l(Value)
+ */
+ public Value callStaticMethod(String packageName, String className, String methodName, Value... args)
+ throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+ String fqcn = packageName + "." + className;
+ List classes = vm.classesByName(fqcn); // �N���X�� (���S����N���X��)
+
+ // ���Y�N���X���^�[�Q�b�gVM��Ń��[�h����Ă��Ȃ��ꍇ��, JDI��p���ă^�[�Q�b�gJVM��Ń��t���N�V�����ɂ�铖�Y�N���X�̃��[�h�����s����
+ if (classes.isEmpty()) {
+ List list = vm.classesByName("java.lang.Class");
+ ClassType type = (ClassType)list.get(0);
+ List methodsByName = type.methodsByName("forName");
+ List argList = new ArrayList<>();
+ argList.add(vm.mirrorOf(fqcn));
+ type.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED);
+ classes = vm.classesByName(fqcn); // �N���X�� (���S����N���X��)
+ }
+ ClassType type = (ClassType)classes.get(0);
+ List methodsByName = type.methodsByName(methodName);
+ List argList = Arrays.asList(args); // ���\�b�h�ɓn�������̃��X�g
+ return type.invokeMethod(thread, methodsByName.get(0), argList, thread.INVOKE_SINGLE_THREADED); // �f�o�b�O���̃v���O�������̃��\�b�h���Ăяo��
+ }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotDebuggedException.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotDebuggedException.java
new file mode 100644
index 0000000..efe1143
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotDebuggedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotDebuggedException extends Exception {
+
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotExecutedException.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotExecutedException.java
new file mode 100644
index 0000000..b41e88b
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotExecutedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotExecutedException extends Exception {
+
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotSuspendedException.java b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotSuspendedException.java
new file mode 100644
index 0000000..3909acb
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/onlineAccessor/NotSuspendedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotSuspendedException extends Exception {
+
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/Alias.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/Alias.java
deleted file mode 100644
index b50e6a9..0000000
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/Alias.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.ntlab.reverseDebugger;
-
-import java.util.ArrayList;
-
-import org.ntlab.traceCollector.tracer.trace.ArrayAccess;
-import org.ntlab.traceCollector.tracer.trace.ArrayCreate;
-import org.ntlab.traceCollector.tracer.trace.ArrayUpdate;
-import org.ntlab.traceCollector.tracer.trace.FieldAccess;
-import org.ntlab.traceCollector.tracer.trace.FieldUpdate;
-import org.ntlab.traceCollector.tracer.trace.MethodExecution;
-import org.ntlab.traceCollector.tracer.trace.MethodInvocation;
-import org.ntlab.traceCollector.tracer.trace.ObjectReference;
-import org.ntlab.traceCollector.tracer.trace.Statement;
-import org.ntlab.traceCollector.tracer.trace.Trace;
-import org.ntlab.traceCollector.tracer.trace.TracePoint;
-
-/**
- * �I�u�W�F�N�g�̎Q�Ə��(�G�C���A�X)��\���N���X
- * @author Isitani
- *
- */
-public class Alias {
- private String objectId;
- private TracePoint occurrencePoint; // ���Y�I�u�W�F�N�g�̎Q�Ƃ��s���Ă�����s�ӏ��ɑΉ�����TracePoint
- /**
- * ���Y�I�u�W�F�N�g�̎Q�Ƃ�TracePoint�ɂ����Ăǂ��Ɍ���Ă��邩��\��
- * 0 �t�B�[���h�A�N�Z�X���̃R���e�i �������� ���\�b�h�Ăяo�����̃��V�[�o
- * 1, 2, 3 �c�c n �t�B�[���h�A�N�Z�X���̃t�B�[���h(1) �������� ���\�b�h�Ăяo������n�Ԗڂ̎����� (1���珇�Ԃ�)
- * -1 ���\�b�h�Ăяo�����̖߂�l
- *
- * ��1: d = a.m(b, c);
- *
- * ��1�̎��s���ɂ�����, a�̓��\�b�h�Ăяo���̃��V�[�o�Ȃ̂�0, b�̓��\�b�h�Ăяo����1�Ԗڂ̎������Ȃ̂�1,
- * c�̓��\�b�h�Ăяo����2�Ԗڂ̎������Ȃ̂�2, a.m(b, c)�̖߂�l��-1 �ƂȂ�.
- *
- * ��2: d = a.f;
- * ��2�̎��s���ɂ�����, a�̓t�B�[���h�̃R���e�i�Ȃ̂�0, b�̓t�B�[���h�Ȃ̂�1 �ƂȂ�.
- *
- */
- private int occurrenceExp;
- public static final int OCCURRENCE_EXP_CONTAINER = 0;
- public static final int OCCURRENCE_EXP_RECEIVER = 0;
- public static final int OCCURRENCE_EXP_FIELD = 1;
- public static final int OCCURRENCE_EXP_ARRAY = 1;
- public static final int OCCURRENCE_EXP_FIRST_ARG = 1;
- public static final int OCCURRENCE_EXP_RETURN = -1;
-
- public Alias(String objectId, TracePoint occurrencePoint, int occurrenceExp) {
- this.objectId = objectId;
- this.occurrencePoint = occurrencePoint;
- this.occurrenceExp = occurrenceExp;
- }
-
- public String getObjectId() {
- return objectId;
- }
-
- public TracePoint getOccurrencePoint() {
- return occurrencePoint;
- }
-
- public int getOccurrenceExp() {
- return occurrenceExp;
- }
-
- public MethodExecution getMethodExecution() {
- return occurrencePoint.getMethodExecution();
- }
-
- public String getMethodExecutionClassName() {
- MethodExecution methodExecution = occurrencePoint.getMethodExecution();
- return Trace.getDeclaringType(methodExecution.getSignature(), methodExecution.isConstructor());
- }
-
- public String getMethodSignature() {
- return occurrencePoint.getMethodExecution().getCallerSideSignature();
- }
-
- public int getLineNo() {
- Statement statement = occurrencePoint.getStatement();
- return statement.getLineNo();
- }
-
- public String getStatementType() {
- Statement statement = occurrencePoint.getStatement();
- String statementType = "";
- if (statement instanceof FieldAccess) {
- FieldAccess fa = (FieldAccess)statement;
- statementType = "FieldAccess";
- } else if (statement instanceof FieldUpdate) {
- FieldUpdate fu = (FieldUpdate)statement;
- statementType = "FieldUpdate";
- } else if (statement instanceof ArrayAccess) {
- ArrayAccess aa = (ArrayAccess)statement;
- statementType = "ArrayAccess";
- } else if (statement instanceof ArrayUpdate) {
- ArrayUpdate au = (ArrayUpdate)statement;
- statementType = "ArrayUpdate";
- } else if (statement instanceof ArrayCreate) {
- ArrayCreate ac = (ArrayCreate)statement;
- statementType = "ArrayCreate";
- } else if (statement instanceof MethodInvocation) {
- MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
- statementType = "MethodInvocation";
- }
- return statementType;
- }
-
- public String getStatementSignature() {
- Statement statement = occurrencePoint.getStatement();
- String statementSignature = "";
- if (statement instanceof FieldAccess) {
- FieldAccess fa = (FieldAccess)statement;
- statementSignature = fa.getFieldName();
- } else if (statement instanceof FieldUpdate) {
- FieldUpdate fu = (FieldUpdate)statement;
- statementSignature = fu.getFieldName();
- } else if (statement instanceof ArrayAccess) {
- ArrayAccess aa = (ArrayAccess)statement;
- statementSignature = aa.getArrayClassName() + "[" + aa.getIndex() + "]";
- } else if (statement instanceof ArrayUpdate) {
- ArrayUpdate au = (ArrayUpdate)statement;
- statementSignature = au.getArrayClassName() + "[" + au.getIndex() + "]";
- } else if (statement instanceof ArrayCreate) {
- ArrayCreate ac = (ArrayCreate)statement;
- statementSignature = ac.getArrayClassName();
- } else if (statement instanceof MethodInvocation) {
- MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
- statementSignature = me.getCallerSideSignature();
- }
- return statementSignature;
- }
-
- public String getClassName() {
- Statement statement = occurrencePoint.getStatement();
- String className = "";
- if (statement instanceof FieldAccess) {
- if (occurrenceExp == OCCURRENCE_EXP_CONTAINER) {
- className = ((FieldAccess) statement).getContainerClassName();
- } else if (occurrenceExp == OCCURRENCE_EXP_FIELD) {
- className = ((FieldAccess) statement).getValueClassName();
- }
- } else if (statement instanceof FieldUpdate) {
- if (occurrenceExp == OCCURRENCE_EXP_CONTAINER) {
- className = ((FieldUpdate) statement).getContainerClassName();
- } else if (occurrenceExp == OCCURRENCE_EXP_FIELD) {
- className = ((FieldUpdate) statement).getValueClassName();
- }
- } else if (statement instanceof ArrayAccess) {
- className = ((ArrayAccess) statement).getValueClassName();
- } else if (statement instanceof ArrayUpdate) {
- className = ((ArrayUpdate) statement).getValueClassName();
- } else if (statement instanceof ArrayCreate) {
- className = ((ArrayCreate) statement).getArrayClassName();
- } else if (statement instanceof MethodInvocation) {
- MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
- if (occurrenceExp == OCCURRENCE_EXP_RETURN) {
- className = me.getReturnValue().getActualType();
- } else if (occurrenceExp == OCCURRENCE_EXP_RECEIVER) {
- className = me.getThisClassName();
- } else {
- int index = occurrenceExp - OCCURRENCE_EXP_FIRST_ARG;
- ArrayList args = me.getArguments();
- if (index >= 0 && index < args.size()) {
- className = me.getArguments().get(index).getActualType();
- }
- }
- }
- return className;
- }
-
- public String getOccurrenceText() {
- String statementType = getStatementType();
- switch (statementType) {
- case "FieldAccess":
- case "FieldUpdate":
- return (occurrenceExp == 0) ? "container" : "field";
- case "ArrayAccess":
- case "ArrayUpdate":
- return (occurrenceExp == 0) ? "arrayObject" : "arrayValue";
- case "ArrayCreate":
- return "return";
- case "MethodInvocation":
- if (occurrenceExp <= 0) {
- return (occurrenceExp == 0) ? "receiver" : "return";
- }
- final String[] ORDER_TEXT = {"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th"}; // 0-13�ɑΉ�
- final String ARG = " arg";
- if (occurrenceExp % 100 >= ORDER_TEXT.length) {
- return occurrenceExp + ORDER_TEXT[occurrenceExp % 10] + ARG; // ��2����14�ȏ�Ȃ�, ��1���̐����ɑΉ�������
- } else if (occurrenceExp % 100 >= 0) {
- return occurrenceExp + ORDER_TEXT[occurrenceExp % 100] + ARG; // ��2����0�ȏ�13�ȉ��Ȃ�, ��2���̐����ɑΉ�������
- }
- }
- return String.valueOf(occurrenceExp);
- }
-
-// @Override
-// public String toString() {
-// Statement statement = occurrencePoint.getStatement();
-// String className = getClassName();
-// String methodSignature = getMethodSignature();
-// String statementType = getStatementType();
-// String statementSigunarure = getStatementSignature();
-// String indent = " ";
-// StringBuilder str = new StringBuilder();
-// str.append("objId: " + objectId + " (class = " + className + ")" + "\n");
-// str.append("tp: " + occurrencePoint + "\n");
-// str.append(indent + "signature: " + methodSignature + "\n");
-// str.append(indent + "lineNo: " + statement.getLineNo() + "\n");
-// str.append(indent + "statementType: " + statementType + " -> " + statementSigunarure + "\n");
-// str.append("occurrenceExp: " + occurrenceExp + "\n");
-// return str.toString();
-// }
-}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackLabelProvider.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackLabelProvider.java
index f6d1c89..f4092df 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackLabelProvider.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackLabelProvider.java
@@ -5,7 +5,8 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.JDIStaticMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -21,8 +22,8 @@
public String getText(Object element) {
if (element instanceof TreeNode) {
Object value = ((TreeNode)element).getValue();
- if (value instanceof MethodCaller) {
- MethodCaller mc = (MethodCaller)value;
+ if (value instanceof JDIStaticMethodCaller) {
+ JDIStaticMethodCaller mc = (JDIStaticMethodCaller)value;
return "ThreadID: " + mc.getThreadId();
}
if (value instanceof CallStackModel) {
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModel.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModel.java
index f8428f6..67fc30a 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModel.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModel.java
@@ -1,6 +1,6 @@
package org.ntlab.reverseDebugger;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -14,11 +14,11 @@
import com.sun.jdi.VirtualMachine;
public class CallStackModel {
- private MethodCaller methodExecutionMc;
+ private JDIInstanceMethodCaller methodExecutionMc;
private int callLineNo;
public CallStackModel(VirtualMachine vm, ThreadReference thread, ObjectReference methodExecution, int callLineNo) {
- methodExecutionMc = new MethodCaller(vm, thread, methodExecution);
+ methodExecutionMc = new JDIInstanceMethodCaller(vm, thread, methodExecution);
this.callLineNo = callLineNo;
}
@@ -30,7 +30,7 @@
return methodExecutionMc.getThread();
}
- public MethodCaller getMethodCaller() {
+ public JDIInstanceMethodCaller getMethodCaller() {
return methodExecutionMc;
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModels.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModels.java
index b9c52d4..a108b10 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModels.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackModels.java
@@ -4,7 +4,8 @@
import java.util.List;
import org.eclipse.jface.viewers.TreeNode;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.JDIStaticMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -30,7 +31,7 @@
return roots;
}
CallStackModel callStackModel = callStackModels.get(0);
- roots[0] = new TreeNode(new MethodCaller(callStackModel.getVm(), callStackModel.getThread()));
+ roots[0] = new TreeNode(new JDIStaticMethodCaller(callStackModel.getVm(), callStackModel.getThread()));
TreeNode parentNode = roots[0];
TreeNode[] childrenNode = new TreeNode[callStackModels.size()];
parentNode.setChildren(childrenNode);
@@ -46,7 +47,7 @@
callStackModels.clear();
}
- public void updateByDebuggerStopMethodExecution(MethodCaller me) {
+ public void updateByDebuggerStopMethodExecution(JDIInstanceMethodCaller me) {
if (me == null) {
return;
}
@@ -54,14 +55,14 @@
VirtualMachine vm = me.getVm();
ThreadReference thread = me.getThread();
int lineNo = thread.frame(0).location().lineNumber();
- update(vm, thread, me.getObj(), lineNo);
+ update(vm, thread, me.getReceiver(), lineNo);
} catch (InvalidTypeException | ClassNotLoadedException
| InvocationException | IncompatibleThreadStateException e) {
e.printStackTrace();
}
}
- public void updateByAlias(MethodCaller alias) {
+ public void updateByAlias(JDIInstanceMethodCaller alias) {
if (alias == null) {
return;
}
@@ -88,9 +89,9 @@
childMe = me;
me = (ObjectReference)callStackModel.callInstanceMethod("getParent");
if (me != null) {
- MethodCaller mc = new MethodCaller(vm, thread, me);
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(vm, thread, me);
ObjectReference callStatement = (ObjectReference)mc.callInstanceMethod("getMethodInvocation", childMe);
- callLineNo = ((IntegerValue)mc.setObj(callStatement).callInstanceMethod("getLineNo")).value();
+ callLineNo = ((IntegerValue)mc.changeReceiver(callStatement).callInstanceMethod("getLineNo")).value();
}
}
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackView.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackView.java
index 2030df7..1fc480e 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackView.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/CallStackView.java
@@ -14,7 +14,7 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
public class CallStackView extends ViewPart {
private static TreeViewer viewer;
@@ -46,7 +46,7 @@
if (element instanceof TreeNode) {
Object value = ((TreeNode)element).getValue();
if (value instanceof CallStackModel) {
- MethodCaller methodExecution = ((CallStackModel)value).getMethodCaller();
+ JDIInstanceMethodCaller methodExecution = ((CallStackModel)value).getMethodCaller();
SeedAliasView.createSeedAliasesByMethodExecution(methodExecution);
SeedAliasView.refresh();
javaEditorOperator.openSrcFileOfMethodExecution(methodExecution);
@@ -87,13 +87,13 @@
mgr.add(refreshAction);
}
- public static void updateByAlias(MethodCaller alias) {
+ public static void updateByAlias(JDIInstanceMethodCaller alias) {
callStackModels.updateByAlias(alias);
}
public static void refresh() {
if (callStackModels.getCallStackModels().isEmpty()) {
- MethodCaller currentMe = SeedAliasView.getDebuggerStopMethodExecution();
+ JDIInstanceMethodCaller currentMe = SeedAliasView.getDebuggerStopMethodExecution();
callStackModels.updateByDebuggerStopMethodExecution(currentMe);
}
TreeNode[] nodes = callStackModels.getCallStackModelsTreeNodes();
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/JavaEditorOperator.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/JavaEditorOperator.java
index d332493..fdd0c6c 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/JavaEditorOperator.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/JavaEditorOperator.java
@@ -16,7 +16,7 @@
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -31,10 +31,10 @@
public class JavaEditorOperator {
private static final String TRACE = "org.ntlab.traceCollector.tracer.trace";
- public void openSrcFileOfAlias(MethodCaller alias) {
+ public void openSrcFileOfAlias(JDIInstanceMethodCaller alias) {
try {
ObjectReference methodExecution = (ObjectReference)alias.callInstanceMethod("getMethodExecution");
- MethodCaller meCaller = new MethodCaller(alias.getVm(), alias.getThread(), methodExecution);
+ JDIInstanceMethodCaller meCaller = new JDIInstanceMethodCaller(alias.getVm(), alias.getThread(), methodExecution);
openSrcFileOfMethodExecution(meCaller);
} catch (InvalidTypeException | ClassNotLoadedException
| InvocationException | IncompatibleThreadStateException e) {
@@ -47,7 +47,7 @@
*
* @param meCaller
*/
- public void openSrcFileOfMethodExecution(MethodCaller meCaller) {
+ public void openSrcFileOfMethodExecution(JDIInstanceMethodCaller meCaller) {
try {
IType type = findIType(meCaller);
if (type != null) {
@@ -73,7 +73,7 @@
openInJavaEditor(type, method);
}
- private IType findIType(MethodCaller meCaller) throws InvalidTypeException,
+ private IType findIType(JDIInstanceMethodCaller meCaller) throws InvalidTypeException,
ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
StringReference declaringClassName = (StringReference)meCaller.callInstanceMethod("getDeclaringClassName");
String projectPath = getLoaderPath(meCaller, declaringClassName);
@@ -92,7 +92,7 @@
return type;
}
- private String getLoaderPath(MethodCaller meCaller, StringReference declaringClassName)
+ private String getLoaderPath(JDIInstanceMethodCaller meCaller, StringReference declaringClassName)
throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
ObjectReference classInfo = (ObjectReference)meCaller.callStaticMethod(TRACE, "TraceJSON", "getClassInfo", declaringClassName);
if (classInfo == null) {
@@ -102,7 +102,7 @@
String loaderPath = null;
if (classInfo != null) {
// �Ȃ���loaderPath���擾�ł��Ă��Ȃ����߁A���ۂɏo�͂����JSON�g���[�X���Q�l�ɂ���path����^���Ă݂�
- MethodCaller classInfoMethodCaller = new MethodCaller(meCaller.getVm(), meCaller.getThread(), classInfo);
+ JDIInstanceMethodCaller classInfoMethodCaller = new JDIInstanceMethodCaller(meCaller.getVm(), meCaller.getThread(), classInfo);
String path = ((StringReference)classInfoMethodCaller.callInstanceMethod("getPath")).value();
String declaringClassNameString = declaringClassName.value().replace(".", "/");
loaderPath = path.substring(0, path.indexOf(declaringClassNameString)); // path����N���X�̊��S���薼�ȍ~��S�ĊO�������̂�projectPath�ɂ��Ă݂�
@@ -145,7 +145,7 @@
}
}
- private IMethod findIMethod(MethodCaller meCaller, IType type) throws InvalidTypeException,
+ private IMethod findIMethod(JDIInstanceMethodCaller meCaller, IType type) throws InvalidTypeException,
ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
IMethod method = null;
if (type != null) {
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasLabelProvider.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasLabelProvider.java
index 0ae2cf7..63defbb 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasLabelProvider.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasLabelProvider.java
@@ -5,7 +5,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -19,9 +19,9 @@
@Override
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof MethodCaller) {
- MethodCaller mc = (MethodCaller)element;
- if (mc.getObj() == null) {
+ if (element instanceof JDIInstanceMethodCaller) {
+ JDIInstanceMethodCaller mc = (JDIInstanceMethodCaller)element;
+ if (mc.getReceiver() == null) {
return "";
}
try {
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasView.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasView.java
index bacc21d..2225bcf 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasView.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliasView.java
@@ -24,13 +24,13 @@
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
public class ObjectFlowAliasView extends ViewPart {
private static TableViewer viewer;
private IAction refreshAction;
private IAction findSeedAliasesAction;
- private MethodCaller selectObjectFlowAlias;
+ private JDIInstanceMethodCaller selectObjectFlowAlias;
private static ObjectFlowAliases objectFlowAliases = new ObjectFlowAliases();
private JavaEditorOperator javaEditorOperator = new JavaEditorOperator();
public static final String ID = "org.ntlab.reverseDebugger.objectFlowAliasView";
@@ -84,8 +84,8 @@
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection)event.getSelection();
Object element = sel.getFirstElement();
- if (element instanceof MethodCaller) {
- selectObjectFlowAlias = (MethodCaller)element;
+ if (element instanceof JDIInstanceMethodCaller) {
+ selectObjectFlowAlias = (JDIInstanceMethodCaller)element;
javaEditorOperator.openSrcFileOfAlias(selectObjectFlowAlias);
}
}
@@ -150,7 +150,7 @@
getSite().registerContextMenu(menuMgr, viewer);
}
- public static void createObjectFlow(MethodCaller seedAlias) {
+ public static void createObjectFlow(JDIInstanceMethodCaller seedAlias) {
objectFlowAliases.createObjectFlow(seedAlias);
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliases.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliases.java
index df84f3c..a1cd883 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliases.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ObjectFlowAliases.java
@@ -3,7 +3,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.JDIStaticMethodCaller;
+import org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerLaunchConfiguration;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -15,59 +17,56 @@
import com.sun.jdi.VirtualMachine;
public class ObjectFlowAliases {
- private List> objectFlowAliases = new ArrayList<>();
- private static final String TRACE = "org.ntlab.traceCollector.tracer.trace";
- private static final String ANALYZER = "org.ntlab.reverseDebugger";
-
+ private List> objectFlowAliases = new ArrayList<>();
+
public void reset() {
objectFlowAliases.clear();
}
- public List> getObjectFlow() {
+ public List> getObjectFlow() {
return objectFlowAliases;
}
- public List> getObjectFlow(MethodCaller seedAlias) {
+ public List> getObjectFlow(JDIInstanceMethodCaller seedAlias) {
createObjectFlow(seedAlias);
return objectFlowAliases;
}
- public List getObjectFlowSingleList(boolean hasBound) {
- List list = new ArrayList<>();
+ public List getObjectFlowSingleList(boolean hasBound) {
+ List list = new ArrayList<>();
for (int i = 0; i < objectFlowAliases.size(); i++) {
for (int j = 0; j < objectFlowAliases.get(i).size(); j++) {
list.add(objectFlowAliases.get(i).get(j));
}
if (hasBound) {
- list.add(new MethodCaller(null, null)); // ���E�p�̃_�~�[�C���X�^���X�����Ēlj�
+ list.add(new JDIInstanceMethodCaller(null, null, null)); // ���E�p�̃_�~�[�C���X�^���X�����Ēlj�
}
}
return list;
}
- public List getObjectFlowSingleList(MethodCaller seedAlias, boolean hasBound) {
+ public List getObjectFlowSingleList(JDIInstanceMethodCaller seedAlias, boolean hasBound) {
createObjectFlow(seedAlias);
return getObjectFlowSingleList(hasBound);
}
- public void createObjectFlow(MethodCaller seedAlias) {
- MethodCaller mc = new MethodCaller(seedAlias.getVm(), seedAlias.getThread());
+ public void createObjectFlow(JDIInstanceMethodCaller seedAlias) {
objectFlowAliases.clear();
try {
// �I�������G�C���A�X���N�_�ɃI�u�W�F�N�g�t���[���Ăяo���Č��ʂ����X�g�Ŏ��
-// ObjectReference aliasListsReference = (ObjectReference)seedAlias.callStaticMethod(TRACE, "TraceJSON", "getObjectFlow", seedAlias.getObj());
- ObjectReference aliasListsReference = (ObjectReference)seedAlias.callStaticMethod(ANALYZER, "OnlineTraceAnalyzer", "getObjectFlow", seedAlias.getObj());
+ ObjectReference aliasListsReference = (ObjectReference)seedAlias.callStaticMethod(ReverseDebuggerLaunchConfiguration.ANALYZER_PACKAGE, ReverseDebuggerLaunchConfiguration.ANALYZER_CLASS, "getObjectFlow", seedAlias.getReceiver());
// �擾�������X�g�̒��g�����[�v�ʼnȂ�����o��, �Ǘ��p�̃��X�g�ɋl�ߒ���
- int aliasListsSize = ((IntegerValue)mc.setObj(aliasListsReference).callInstanceMethod("size")).value();
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(seedAlias.getVm(), seedAlias.getThread(), aliasListsReference);
+ int aliasListsSize = ((IntegerValue)mc.callInstanceMethod("size")).value();
for (int i = 0; i < aliasListsSize; i++) {
- List list = new ArrayList<>();
+ List list = new ArrayList<>();
objectFlowAliases.add(list);
- ObjectReference aliasListReference = (ObjectReference)mc.setObj(aliasListsReference).callInstanceMethod("get", mc.getVm().mirrorOf(i));
- int aliasListSize = ((IntegerValue)mc.setObj(aliasListReference).callInstanceMethod("size")).value();
+ ObjectReference aliasListReference = (ObjectReference)mc.changeReceiver(aliasListsReference).callInstanceMethod("get", mc.getVm().mirrorOf(i));
+ int aliasListSize = ((IntegerValue)mc.changeReceiver(aliasListReference).callInstanceMethod("size")).value();
for (int j = 0; j < aliasListSize; j++) {
- ObjectReference aliasReference = (ObjectReference)mc.setObj(aliasListReference).callInstanceMethod("get", mc.getVm().mirrorOf(j));
- list.add(new MethodCaller(seedAlias.getVm(), seedAlias.getThread(), aliasReference));
+ ObjectReference aliasReference = (ObjectReference)mc.changeReceiver(aliasListReference).callInstanceMethod("get", mc.getVm().mirrorOf(j));
+ list.add(new JDIInstanceMethodCaller(seedAlias.getVm(), seedAlias.getThread(), aliasReference));
}
}
} catch (InvalidTypeException | ClassNotLoadedException | InvocationException | IncompatibleThreadStateException e) {
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzer.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzer.java
deleted file mode 100644
index 935ab76..0000000
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzer.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.ntlab.reverseDebugger;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-// import org.ntlab.traceCollector.tracer.trace.Alias;
-import org.ntlab.traceCollector.tracer.trace.ArrayAccess;
-import org.ntlab.traceCollector.tracer.trace.ArrayCreate;
-import org.ntlab.traceCollector.tracer.trace.ArrayUpdate;
-import org.ntlab.traceCollector.tracer.trace.FieldAccess;
-import org.ntlab.traceCollector.tracer.trace.FieldUpdate;
-import org.ntlab.traceCollector.tracer.trace.MethodExecution;
-import org.ntlab.traceCollector.tracer.trace.MethodInvocation;
-import org.ntlab.traceCollector.tracer.trace.ObjectReference;
-import org.ntlab.traceCollector.tracer.trace.Statement;
-import org.ntlab.traceCollector.tracer.trace.TraceJSON;
-import org.ntlab.traceCollector.tracer.trace.TracePoint;
-
-public class OnlineTraceAnalyzer {
-
- public void test2() {
- System.out.println("OnlineTraceAnalyzer#test2()���Ăꂽ��!");
- TraceJSON.test();
- System.out.println("OnlineTraceAnalyzer#test2()���甲�����!");
- }
-
- public static ArrayList findAllStartAlias(MethodExecution me) {
- System.out.println("OnlineTraceAnalyzer#findAllStartAlias(MethodExecution)���Ăꂽ��!");
- ArrayList startAliasList = new ArrayList<>();
- List statements = me.getStatements();
- String[] primitives = {"byte", "short", "int", "long", "float", "double", "char", "boolean"};
- List primitiveList = Arrays.asList(primitives);
- for (int i = 0; i < statements.size(); i++) {
- TracePoint tp = me.getTracePoint(i);
- Statement statement = statements.get(i);
- if (statement instanceof FieldAccess) {
- FieldAccess fa = (FieldAccess)statement;
- String objId = fa.getContainerObjId();
- if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fa.getContainerClassName()))) {
- startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_CONTAINER));
- }
- objId = fa.getValueObjId();
- if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fa.getValueClassName()))) {
- startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_FIELD));
- }
- } else if (statement instanceof FieldUpdate) {
- FieldUpdate fu = (FieldUpdate)statement;
- String objId = fu.getContainerObjId();
- if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fu.getContainerClassName()))) {
- startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_CONTAINER));
- }
- objId = fu.getValueObjId();
- if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fu.getValueClassName()))) {
- startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_FIELD));
- }
- } else if (statement instanceof ArrayAccess) {
- ArrayAccess aa = (ArrayAccess)statement;
- String valueObjId = aa.getValueObjectId();
- if (valueObjId != null && !(valueObjId.equals("0")) && !(primitiveList.contains(aa.getValueClassName()))) {
- startAliasList.add(new Alias(valueObjId, tp, Alias.OCCURRENCE_EXP_ARRAY));
- }
- } else if (statement instanceof ArrayUpdate) {
- ArrayUpdate au = (ArrayUpdate)statement;
- String valueObjId = au.getValueObjectId();
- if (valueObjId != null && !(valueObjId.equals("0")) && !(primitiveList.contains(au.getValueClassName()))) {
- startAliasList.add(new Alias(valueObjId, tp, Alias.OCCURRENCE_EXP_ARRAY));
- }
- } else if (statement instanceof ArrayCreate) {
- ArrayCreate ac = (ArrayCreate)statement;
- String arrayObjId = ac.getArrayObjectId();
- if (arrayObjId != null && !(arrayObjId.equals("0")) && !(primitiveList.contains(ac.getArrayClassName()))) {
- startAliasList.add(new Alias(arrayObjId, tp, Alias.OCCURRENCE_EXP_RETURN));
- }
- } else if (statement instanceof MethodInvocation) {
- MethodExecution calledMe = ((MethodInvocation)statement).getCalledMethodExecution();
- String thisObjId = calledMe.getThisObjId();
- if (thisObjId != null && !(thisObjId.equals("0"))) {
- startAliasList.add(new Alias(thisObjId, tp, Alias.OCCURRENCE_EXP_RECEIVER));
- }
- List args = calledMe.getArguments();
- for (int j = 0; j < args.size(); j++) {
- ObjectReference arg = args.get(j);
- String argValueId = arg.getId();
- if (argValueId != null && !(argValueId.equals("0")) && !(primitiveList.contains(arg.getActualType()))) {
- startAliasList.add(new Alias(argValueId, tp, (j + Alias.OCCURRENCE_EXP_FIRST_ARG)));
- }
- }
- ObjectReference returnValue = calledMe.getReturnValue();
- if (returnValue != null) {
- String returnValueId = returnValue.getId();
- if (returnValueId != null && !(returnValueId.equals("0") && !(primitiveList.contains(returnValue.getActualType())))) {
- startAliasList.add(new Alias(returnValueId, tp, Alias.OCCURRENCE_EXP_RETURN));
- }
- }
- }
- }
- for (Alias startAlias : startAliasList) {
- System.out.println(startAlias);
- }
- return startAliasList;
- }
-
- private static TracePoint getRecentlyFieldUpdate(TracePoint tp) {
- System.out.println("OnlineTraceAnalyzer#getRecentlyFieldUpdate(TracePoint)���Ăꂽ��!");
- Statement statement = tp.getStatement();
- if (statement instanceof FieldAccess) {
- FieldAccess fa = (FieldAccess)statement;
- return TraceJSON.getFieldUpdateTracePoint(fa.getContainerObjId(), fa.getFieldName(), tp);
- }
- return null;
- }
-
- private static TracePoint getRecentlyArrayUpdate(TracePoint tp) {
- System.out.println("OnlineTraceAnalyzer#getRecentlyArrayUpdate(TracePoint)���Ăꂽ��!");
- Statement statement = tp.getStatement();
- if (statement instanceof ArrayAccess) {
- ArrayAccess aa = (ArrayAccess)statement;
- return TraceJSON.getArrayUpdateTracePoint(aa.getArrayObjectId(), aa.getIndex(), tp);
- }
- return null;
- }
-
- public static ArrayList> getObjectFlow(Alias startAlias) {
- System.out.println("OnlineTraceAnalyzer#getObjectFlow(Alias)���Ăꂽ��!");
- ArrayList> aliasLists = new ArrayList<>();
- ArrayList aliasList = new ArrayList<>();
- aliasLists.add(aliasList);
-// aliasList.add(alias);
- String objId = startAlias.getObjectId();
- TracePoint tp = startAlias.getOccurrencePoint().duplicate();
- ArrayList> resultLists = getObjectFlow(aliasLists, objId, tp, 0);
-// for (int i = 0; i < resultLists.size(); i++) {
-// ArrayList resultList = resultLists.get(i);
-// System.out.println("---------------------------------------------------------"); // �m�F�p
-// for (Alias alias : resultList) System.out.println(alias); // �m�F�p
-// int lastAliasOccurrenceEXP = resultList.get(resultList.size() - 1).getOccurrenceExp();
-// if (lastAliasOccurrenceEXP != Alias.OCCURRENCE_EXP_RETURN) {
-// resultLists.remove(resultList); // �����̃G�C���A�X���z����R���X�g���N�^�Ăяo���ł͂Ȃ����X�g���폜����
-// }
-// }
- for (List resultList : resultLists) {
- for (Alias resultAlias : resultList) {
- System.out.println(resultAlias);
- }
- }
- return resultLists;
- }
-
- private static ArrayList> getObjectFlow(ArrayList> aliasLists,
- String objId, TracePoint tp, int side) {
- System.out.println("OnlineTraceAnalyzer#getObjectFlow(ArrayList, String, TracePoint, int)���Ăꂽ��!");
- ArrayList aliasList = aliasLists.get(aliasLists.size() - 1); // ����getObjectFlow���\�b�h���s���Ō��������G�C���A�X�����Ă������X�g
- do {
- Statement statement = tp.getStatement();
- if (statement instanceof FieldAccess) {
- // �t�B�[���h�Q�Ƃ̏ꍇ
- FieldAccess fa = (FieldAccess)statement;
- if (fa.getValueObjId().equals(objId)) {
- // ���Y�n�_�ł̃G�C���A�X�����X�g�ɒlj��������, �t�B�[���h�ŏI�X�V�ɔ�ԃp�^�[���Ƃ��̂܂ܑk��p�^�[���Ƃŕ���
- aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_FIELD));
- aliasList = new ArrayList<>(aliasList); // ���X�g���̂��f�B�[�v�R�s�[���Ă���(�t�B�[���h�ŏI�X�V�ɔ�ԍċA�����I�����, ���̂܂ܑk��p�^�[���ŗp����)
- TracePoint fieldUpdateTp = getRecentlyFieldUpdate(tp);
- aliasLists = getObjectFlow(aliasLists, objId, fieldUpdateTp, 0);
- aliasLists.add(aliasList); // �ċA�����ɓ���O�Ƀf�B�[�v�R�s�[���Ă������X�g���Ō���ɒlj� (�ȍ~�̑k��ɂ���Č������G�C���A�X�͂��̃��X�g�ɓ������)
- }
- } else if (statement instanceof ArrayAccess) {
- // �z��v�f�Q�Ƃ̏ꍇ
- ArrayAccess aa = (ArrayAccess)statement;
- if (aa.getValueObjectId().equals(objId)) {
- aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_ARRAY));
- aliasList = new ArrayList<>(aliasList);
- TracePoint arrayUpdateTp = getRecentlyArrayUpdate(tp);
- aliasLists = getObjectFlow(aliasLists, objId, arrayUpdateTp, 0);
- aliasLists.add(aliasList);
- }
- } else if (statement instanceof ArrayCreate) {
- // �z���̏ꍇ
- ArrayCreate ac = (ArrayCreate)statement;
- if (ac.getArrayObjectId().equals(objId)) {
- aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_RETURN)); // �z���� new �^��[] �̖߂�l
- return aliasLists; // �z���ӏ��̓G�C���A�X�̋N���Ȃ̂ł���ȑO�ɂ͂����Ȃ��͂�
- }
- } else if (statement instanceof MethodInvocation) {
- // ���\�b�h�Ăяo���̏ꍇ
- MethodExecution calledMethodExecution = ((MethodInvocation)statement).getCalledMethodExecution();
- ObjectReference returnValue = calledMethodExecution.getReturnValue();
- if (returnValue.getId().equals(objId)) {
- // �߂�l�ɃG�C���A�X�̃I�u�W�F�N�gID����v�����ꍇ
- aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_RETURN));
- if (calledMethodExecution.isConstructor()) {
- return aliasLists; // �R���X�g���N�^�Ăяo���ӏ��̓G�C���A�X�̋N���Ȃ̂ł���ȑO�ɂ͂����Ȃ��͂�
- }
- TracePoint exitTp = calledMethodExecution.getExitPoint(); // �Ăяo�����\�b�h���s�̍ŏI�X�e�[�g�����g���w��tp���擾
- aliasLists = getObjectFlow(aliasLists, objId, exitTp, side + 1); // �Ăяo����̃��\�b�h���s�ɐ���
- aliasList = aliasLists.get(aliasLists.size() - 1);
- }
- }
- } while (tp.stepBackOver()); // �Ăяo�����ɖ߂邩����ȏ�H��Ȃ��Ȃ�܂Ń��[�v
- if (!tp.isValid()) {
- return aliasLists; // ����ȏチ�\�b�h���s��k��Ȃ��ꍇ(main���\�b�h�̂���ɑO�Ȃ�)�͂��̎��_�ŏI��
- }
- // --- ���̎��_�� tracePoint�� �Ăяo�������w���Ă��� (���O�܂ők���Ă������\�b�h���s�ɂ��Ẵ��\�b�h�Ăяo�����w���Ă���) ---
- MethodExecution calledMethodExecution = ((MethodInvocation)tp.getStatement()).getCalledMethodExecution();
- ArrayList args = calledMethodExecution.getArguments();
- for (int i = 0; i < args.size(); i++) {
- if (args.get(i).getId().equals(objId)) {
- // ���\�b�h�Ăяo���̎������ɃG�C���A�X�̃I�u�W�F�N�gID����v�����ꍇ
- aliasList.add(new Alias(objId, tp.duplicate(), (i + Alias.OCCURRENCE_EXP_FIRST_ARG)));
- if (side == 0) {
- // �T���J�n���\�b�h���s�܂��̓t�B�[���h��z��v�f�̍ŏI�X�V�T���Ŕ��̃��\�b�h���s����, �X�^�b�N�g���[�X�ł��ǂ��S���\�b�h���s�̏ꍇ
- TracePoint previousTp = tp.duplicate();
- previousTp.stepBackOver();
- aliasLists = getObjectFlow(aliasLists, objId, previousTp, 0); // �Ăяo�����̃��\�b�h���s�ɖ߂�
- }
- }
- }
- return aliasLists;
- }
-
- public static int countMethodExecutionInTraceCollector(List methodExecutions, String targetSignature, int count, String indent) {
- System.out.println("OnlineTraceAnalyzer#countMethodExecutionInTraceCollector(List, String, int, String)���Ăꂽ��!");
- if (methodExecutions == null || methodExecutions.isEmpty()) {
- return count;
- }
- for (int i = 0; i < methodExecutions.size(); i++) {
- MethodExecution me = methodExecutions.get(i);
- String signature = me.getSignature();
-// System.out.println(indent + signature);
- if (targetSignature.equals(signature)) {
- count++;
- }
- List children = me.getChildren();
- count = countMethodExecutionInTraceCollector(children, targetSignature, count, indent + "--------");
- }
- return count;
- }
-}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzerCallTester.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzerCallTester.java
deleted file mode 100644
index 8662ced..0000000
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/OnlineTraceAnalyzerCallTester.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.ntlab.reverseDebugger;
-
-import org.ntlab.debuggingControl.MethodCaller;
-
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.VirtualMachine;
-
-/**
- * �^�[�Q�b�g����VM��ɂ��邱�̃v���W�F�N�g���̃N���X�̃��\�b�h(���OnlineTraceAnalyzer�N���X�Ƃ��̃��\�b�h)��
- * reverseDebugger����VM��ɂ��邱�̃v���W�F�N�g���̃N���X�̃��\�b�h���s����Ăяo���e�X�g�p�N���X
- * @author student
- *
- */
-public class OnlineTraceAnalyzerCallTester {
-
- public void test1(VirtualMachine vm, ThreadReference thread) {
- System.out.println("OnlineTraceAnalyzerCaller#test1()���Ăꂽ��!");
- MethodCaller mc = new MethodCaller(vm, thread);
- try {
- mc.callStaticMethod("org.ntlab.reverseDebugger", "OnlineTraceAnalyzer", "test2");
- } catch (InvalidTypeException | ClassNotLoadedException
- | InvocationException | IncompatibleThreadStateException e) {
- e.printStackTrace();
- }
- System.out.println("OnlineTraceAnalyzerCaller#test1()���甲�����!");
- }
-}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ReverseDebuggerLaunchConfiguration.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ReverseDebuggerLaunchConfiguration.java
deleted file mode 100644
index e11440e..0000000
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/ReverseDebuggerLaunchConfiguration.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.ntlab.reverseDebugger;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.ntlab.traceCollector.IAdditionalLaunchConfiguration;
-
-public class ReverseDebuggerLaunchConfiguration implements IAdditionalLaunchConfiguration {
- public static final String ANALYZER_PATH = "org/ntlab/reverseDebugger/OnlineTraceAnalyzer.class";
-
- @Override
- public String[] getAdditionalClasspath() {
- try {
- List classPathList = new ArrayList<>();
- String tracerClassPath = FileLocator.resolve(this.getClass().getClassLoader().getResource(ANALYZER_PATH)).getPath();
- String classPath = tracerClassPath.substring(1, tracerClassPath.length() - ANALYZER_PATH.length());
- classPathList.add(classPath);
- return classPathList.toArray(new String[classPathList.size()]);
- } catch (IOException e) {
- e.printStackTrace();
- }
- throw new IllegalStateException();
- }
-}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasLabelProvider.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasLabelProvider.java
index 92c5a80..e72c7e3 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasLabelProvider.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasLabelProvider.java
@@ -5,7 +5,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -20,8 +20,8 @@
@Override
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof MethodCaller) {
- MethodCaller mc = (MethodCaller)element;
+ if (element instanceof JDIInstanceMethodCaller) {
+ JDIInstanceMethodCaller mc = (JDIInstanceMethodCaller)element;
try {
switch (columnIndex) {
case 0:
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasView.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasView.java
index bd11e6f..061290c 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasView.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliasView.java
@@ -21,14 +21,14 @@
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
public class SeedAliasView extends ViewPart {
private static TableViewer viewer;
private IAction refreshAction;
private IAction resetAction;
private IAction getObjectFlowAction;
- private MethodCaller selectSeedAlias;
+ private JDIInstanceMethodCaller selectSeedAlias;
private static SeedAliases seedAliases = new SeedAliases();
private static JavaEditorOperator javaEditorOperator = new JavaEditorOperator();
public static final String ID = "org.ntlab.reverseDebugger.seedAliasView";
@@ -67,8 +67,8 @@
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection)event.getSelection();
Object element = sel.getFirstElement();
- if (element instanceof MethodCaller) {
- selectSeedAlias = (MethodCaller)element;
+ if (element instanceof JDIInstanceMethodCaller) {
+ selectSeedAlias = (JDIInstanceMethodCaller)element;
javaEditorOperator.openSrcFileOfAlias(selectSeedAlias);
}
}
@@ -145,15 +145,15 @@
getSite().registerContextMenu(menuMgr, viewer);
}
- public static MethodCaller getDebuggerStopMethodExecution() {
+ public static JDIInstanceMethodCaller getDebuggerStopMethodExecution() {
return seedAliases.getDebuggerStopMethodExecution();
}
- public static void createSeedAliasesByAlias(MethodCaller alias) {
+ public static void createSeedAliasesByAlias(JDIInstanceMethodCaller alias) {
seedAliases.createSeedAliasesByAlias(alias);
}
- public static void createSeedAliasesByMethodExecution(MethodCaller methodExecution) {
+ public static void createSeedAliasesByMethodExecution(JDIInstanceMethodCaller methodExecution) {
seedAliases.createSeedAliasesByMethodExecution(methodExecution);
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliases.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliases.java
index 6157dfb..199b68e 100644
--- a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliases.java
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/SeedAliases.java
@@ -11,7 +11,13 @@
import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.ntlab.debuggingControl.MethodCaller;
+import org.ntlab.onlineAccessor.JDIDebuggingVirtualMachine;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.JDIStaticMethodCaller;
+import org.ntlab.onlineAccessor.NotDebuggedException;
+import org.ntlab.onlineAccessor.NotExecutedException;
+import org.ntlab.onlineAccessor.NotSuspendedException;
+import org.ntlab.reverseDebugger.analyzerProvider.ReverseDebuggerLaunchConfiguration;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.ClassType;
@@ -31,20 +37,19 @@
import com.sun.jdi.VirtualMachine;
public class SeedAliases {
- private MethodCaller debuggerStopMethodExecution = null;
- private List seedAliases = new ArrayList<>();
+ private JDIInstanceMethodCaller debuggerStopMethodExecution = null;
+ private List seedAliases = new ArrayList<>();
private static final String TRACER = "org.ntlab.traceCollector.tracer.trace";
- private static final String ANALYZER = "org.ntlab.reverseDebugger";
-
+
public SeedAliases() {
initSeedAliases();
}
- public MethodCaller getDebuggerStopMethodExecution() {
+ public JDIInstanceMethodCaller getDebuggerStopMethodExecution() {
return debuggerStopMethodExecution;
}
- public List getSeedAliases() {
+ public List getSeedAliases() {
return seedAliases;
}
@@ -53,53 +58,38 @@
}
public void initSeedAliases() {
- // TODO Auto-generated method stub
- LaunchManager lm = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
-
- ILaunch[] launches = lm.getLaunches();
- if (launches.length != 0) {
- ILaunch debugLaunch = null;
- for (int i = 0; i < launches.length; i++) {
- System.out.print(launches[i].getLaunchConfiguration().getName() + ":");
- System.out.print(launches[i].getDebugTarget());
- if (launches[i].getDebugTarget() != null) {
- debugLaunch = launches[i];
- break;
+ try {
+ VirtualMachine vm = JDIDebuggingVirtualMachine.getDebuggineVirtualMachine();
+ List allThreads = vm.allThreads();
+ for (int i = 0; i < allThreads.size(); i++) {
+ ThreadReference thread = allThreads.get(i);
+ if (thread.isSuspended()) {
+ createSeedAliases(vm, thread);
}
- }
- if (debugLaunch != null) {
- JDIDebugTarget debugTarget = ((JDIDebugTarget)debugLaunch.getDebugTarget());
- VirtualMachine vm = debugTarget.getVM();
- if (vm != null) {
- // �f�o�b�O���s���̏ꍇ
- List allThreads = vm.allThreads();
- for (int i = 0; i < allThreads.size(); i++) {
- ThreadReference thread = allThreads.get(i);
- if (thread.isSuspended()) {
- createSeedAliases(vm, thread);
- }
- }
- }
- }
+ }
+ } catch (NotExecutedException | NotSuspendedException
+ | NotDebuggedException e) {
+ e.printStackTrace();
}
}
-
+
/**
* ���݃f�o�b�K�Ŏ~�܂��Ă���n�_�ł̃��\�b�h���s���̑S�V�[�h�G�C���A�X�ꗗ���Z�b�g����
* @param vm
* @param thread
*/
private void createSeedAliases(VirtualMachine vm, ThreadReference thread) {
- MethodCaller mc = new MethodCaller(vm, thread);
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(vm, thread, thread);
try {
// threadId�̎擾��StringReference�^�ւ̕ϊ�
- Value threadIdValue = mc.setObj(thread).callInstanceMethod("getId");
+// Value threadIdValue = mc.changeReceiver(thread).callInstanceMethod("getId");
+ Value threadIdValue = vm.mirrorOf(mc.getThreadId());
StringReference threadId = vm.mirrorOf(String.valueOf(((LongValue)threadIdValue).value()));
// threadId�ɑΉ�����ThreadInstance���擾
ObjectReference threadInstance = (ObjectReference)mc.callStaticMethod(TRACER, "TraceJSON", "getThreadInstance", threadId);
- Value methodExecution = mc.setObj(threadInstance).callInstanceMethod("getCurrentMethodExecution");
- debuggerStopMethodExecution = new MethodCaller(vm, thread, (ObjectReference)methodExecution);
+ Value methodExecution = mc.changeReceiver(threadInstance).callInstanceMethod("getCurrentMethodExecution");
+ debuggerStopMethodExecution = new JDIInstanceMethodCaller(vm, thread, (ObjectReference)methodExecution);
findAllSeedAlias(vm, thread, methodExecution);
} catch (InvalidTypeException | ClassNotLoadedException | InvocationException | IncompatibleThreadStateException e) {
e.printStackTrace();
@@ -110,10 +100,9 @@
* �n���ꂽ�G�C���A�X�������Ă��郁�\�b�h���s���̑S�V�[�h�G�C���A�X�̈ꗗ���Z�b�g����
* @param alias
*/
- public void createSeedAliasesByAlias(MethodCaller alias) {
+ public void createSeedAliasesByAlias(JDIInstanceMethodCaller alias) {
VirtualMachine vm = alias.getVm();
ThreadReference thread = alias.getThread();
- MethodCaller mc = new MethodCaller(vm, thread);
try {
Value methodExecution = alias.callInstanceMethod("getMethodExecution");
findAllSeedAlias(vm, thread, methodExecution);
@@ -127,9 +116,9 @@
* �n���ꂽ���\�b�h���s���̑S�V�[�h�G�C���A�X�̈ꗗ���Z�b�g����
* @param methodExecution
*/
- public void createSeedAliasesByMethodExecution(MethodCaller methodExecution) {
+ public void createSeedAliasesByMethodExecution(JDIInstanceMethodCaller methodExecution) {
try {
- findAllSeedAlias(methodExecution.getVm(), methodExecution.getThread(), methodExecution.getObj());
+ findAllSeedAlias(methodExecution.getVm(), methodExecution.getThread(), methodExecution.getReceiver());
} catch (InvalidTypeException | ClassNotLoadedException
| InvocationException | IncompatibleThreadStateException e) {
e.printStackTrace();
@@ -144,14 +133,13 @@
*/
private void findAllSeedAlias(VirtualMachine vm, ThreadReference thread, Value methodExecution) throws InvalidTypeException,
ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
- MethodCaller mc = new MethodCaller(vm, thread);
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(vm, thread, null);
seedAliases.clear();
-// ObjectReference seedAliasList = (ObjectReference)mc.callStaticMethod(TRACER, "TraceJSON", "findAllStartAlias", methodExecution);
- ObjectReference seedAliasList = (ObjectReference)mc.callStaticMethod(ANALYZER, "OnlineTraceAnalyzer", "findAllStartAlias", methodExecution);
- int seedAliasListSize = ((IntegerValue)mc.setObj(seedAliasList).callInstanceMethod("size")).value();
+ ObjectReference seedAliasList = (ObjectReference)mc.callStaticMethod(ReverseDebuggerLaunchConfiguration.ANALYZER_PACKAGE, ReverseDebuggerLaunchConfiguration.ANALYZER_CLASS, "findAllStartAlias", methodExecution);
+ int seedAliasListSize = ((IntegerValue)mc.changeReceiver(seedAliasList).callInstanceMethod("size")).value();
for (int i = 0; i < seedAliasListSize; i++) {
- ObjectReference seedAlias = (ObjectReference)mc.setObj(seedAliasList).callInstanceMethod("get", vm.mirrorOf(i));
- seedAliases.add(new MethodCaller(vm, thread, seedAlias));
+ ObjectReference seedAlias = (ObjectReference)mc.changeReceiver(seedAliasList).callInstanceMethod("get", vm.mirrorOf(i));
+ seedAliases.add(new JDIInstanceMethodCaller(vm, thread, seedAlias));
}
}
}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/Alias.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/Alias.java
new file mode 100644
index 0000000..a485a77
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/Alias.java
@@ -0,0 +1,215 @@
+package org.ntlab.reverseDebugger.analyzerProvider;
+
+import java.util.ArrayList;
+
+import org.ntlab.traceCollector.tracer.trace.ArrayAccess;
+import org.ntlab.traceCollector.tracer.trace.ArrayCreate;
+import org.ntlab.traceCollector.tracer.trace.ArrayUpdate;
+import org.ntlab.traceCollector.tracer.trace.FieldAccess;
+import org.ntlab.traceCollector.tracer.trace.FieldUpdate;
+import org.ntlab.traceCollector.tracer.trace.MethodExecution;
+import org.ntlab.traceCollector.tracer.trace.MethodInvocation;
+import org.ntlab.traceCollector.tracer.trace.ObjectReference;
+import org.ntlab.traceCollector.tracer.trace.Statement;
+import org.ntlab.traceCollector.tracer.trace.Trace;
+import org.ntlab.traceCollector.tracer.trace.TracePoint;
+
+/**
+ * �I�u�W�F�N�g�̎Q�Ə��(�G�C���A�X)��\���N���X
+ * @author Isitani
+ *
+ */
+public class Alias {
+ private String objectId;
+ private TracePoint occurrencePoint; // ���Y�I�u�W�F�N�g�̎Q�Ƃ��s���Ă�����s�ӏ��ɑΉ�����TracePoint
+ /**
+ * ���Y�I�u�W�F�N�g�̎Q�Ƃ�TracePoint�ɂ����Ăǂ��Ɍ���Ă��邩��\��
+ * 0 �t�B�[���h�A�N�Z�X���̃R���e�i �������� ���\�b�h�Ăяo�����̃��V�[�o
+ * 1, 2, 3 �c�c n �t�B�[���h�A�N�Z�X���̃t�B�[���h(1) �������� ���\�b�h�Ăяo������n�Ԗڂ̎����� (1���珇�Ԃ�)
+ * -1 ���\�b�h�Ăяo�����̖߂�l
+ *
+ * ��1: d = a.m(b, c);
+ *
+ * ��1�̎��s���ɂ�����, a�̓��\�b�h�Ăяo���̃��V�[�o�Ȃ̂�0, b�̓��\�b�h�Ăяo����1�Ԗڂ̎������Ȃ̂�1,
+ * c�̓��\�b�h�Ăяo����2�Ԗڂ̎������Ȃ̂�2, a.m(b, c)�̖߂�l��-1 �ƂȂ�.
+ *
+ * ��2: d = a.f;
+ * ��2�̎��s���ɂ�����, a�̓t�B�[���h�̃R���e�i�Ȃ̂�0, b�̓t�B�[���h�Ȃ̂�1 �ƂȂ�.
+ *
+ */
+ private int occurrenceExp;
+ public static final int OCCURRENCE_EXP_CONTAINER = 0;
+ public static final int OCCURRENCE_EXP_RECEIVER = 0;
+ public static final int OCCURRENCE_EXP_FIELD = 1;
+ public static final int OCCURRENCE_EXP_ARRAY = 1;
+ public static final int OCCURRENCE_EXP_FIRST_ARG = 1;
+ public static final int OCCURRENCE_EXP_RETURN = -1;
+
+ public Alias(String objectId, TracePoint occurrencePoint, int occurrenceExp) {
+ this.objectId = objectId;
+ this.occurrencePoint = occurrencePoint;
+ this.occurrenceExp = occurrenceExp;
+ }
+
+ public String getObjectId() {
+ return objectId;
+ }
+
+ public TracePoint getOccurrencePoint() {
+ return occurrencePoint;
+ }
+
+ public int getOccurrenceExp() {
+ return occurrenceExp;
+ }
+
+ public MethodExecution getMethodExecution() {
+ return occurrencePoint.getMethodExecution();
+ }
+
+ public String getMethodExecutionClassName() {
+ MethodExecution methodExecution = occurrencePoint.getMethodExecution();
+ return Trace.getDeclaringType(methodExecution.getSignature(), methodExecution.isConstructor());
+ }
+
+ public String getMethodSignature() {
+ return occurrencePoint.getMethodExecution().getCallerSideSignature();
+ }
+
+ public int getLineNo() {
+ Statement statement = occurrencePoint.getStatement();
+ return statement.getLineNo();
+ }
+
+ public String getStatementType() {
+ Statement statement = occurrencePoint.getStatement();
+ String statementType = "";
+ if (statement instanceof FieldAccess) {
+ FieldAccess fa = (FieldAccess)statement;
+ statementType = "FieldAccess";
+ } else if (statement instanceof FieldUpdate) {
+ FieldUpdate fu = (FieldUpdate)statement;
+ statementType = "FieldUpdate";
+ } else if (statement instanceof ArrayAccess) {
+ ArrayAccess aa = (ArrayAccess)statement;
+ statementType = "ArrayAccess";
+ } else if (statement instanceof ArrayUpdate) {
+ ArrayUpdate au = (ArrayUpdate)statement;
+ statementType = "ArrayUpdate";
+ } else if (statement instanceof ArrayCreate) {
+ ArrayCreate ac = (ArrayCreate)statement;
+ statementType = "ArrayCreate";
+ } else if (statement instanceof MethodInvocation) {
+ MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
+ statementType = "MethodInvocation";
+ }
+ return statementType;
+ }
+
+ public String getStatementSignature() {
+ Statement statement = occurrencePoint.getStatement();
+ String statementSignature = "";
+ if (statement instanceof FieldAccess) {
+ FieldAccess fa = (FieldAccess)statement;
+ statementSignature = fa.getFieldName();
+ } else if (statement instanceof FieldUpdate) {
+ FieldUpdate fu = (FieldUpdate)statement;
+ statementSignature = fu.getFieldName();
+ } else if (statement instanceof ArrayAccess) {
+ ArrayAccess aa = (ArrayAccess)statement;
+ statementSignature = aa.getArrayClassName() + "[" + aa.getIndex() + "]";
+ } else if (statement instanceof ArrayUpdate) {
+ ArrayUpdate au = (ArrayUpdate)statement;
+ statementSignature = au.getArrayClassName() + "[" + au.getIndex() + "]";
+ } else if (statement instanceof ArrayCreate) {
+ ArrayCreate ac = (ArrayCreate)statement;
+ statementSignature = ac.getArrayClassName();
+ } else if (statement instanceof MethodInvocation) {
+ MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
+ statementSignature = me.getCallerSideSignature();
+ }
+ return statementSignature;
+ }
+
+ public String getClassName() {
+ Statement statement = occurrencePoint.getStatement();
+ String className = "";
+ if (statement instanceof FieldAccess) {
+ if (occurrenceExp == OCCURRENCE_EXP_CONTAINER) {
+ className = ((FieldAccess) statement).getContainerClassName();
+ } else if (occurrenceExp == OCCURRENCE_EXP_FIELD) {
+ className = ((FieldAccess) statement).getValueClassName();
+ }
+ } else if (statement instanceof FieldUpdate) {
+ if (occurrenceExp == OCCURRENCE_EXP_CONTAINER) {
+ className = ((FieldUpdate) statement).getContainerClassName();
+ } else if (occurrenceExp == OCCURRENCE_EXP_FIELD) {
+ className = ((FieldUpdate) statement).getValueClassName();
+ }
+ } else if (statement instanceof ArrayAccess) {
+ className = ((ArrayAccess) statement).getValueClassName();
+ } else if (statement instanceof ArrayUpdate) {
+ className = ((ArrayUpdate) statement).getValueClassName();
+ } else if (statement instanceof ArrayCreate) {
+ className = ((ArrayCreate) statement).getArrayClassName();
+ } else if (statement instanceof MethodInvocation) {
+ MethodExecution me = ((MethodInvocation)statement).getCalledMethodExecution();
+ if (occurrenceExp == OCCURRENCE_EXP_RETURN) {
+ className = me.getReturnValue().getActualType();
+ } else if (occurrenceExp == OCCURRENCE_EXP_RECEIVER) {
+ className = me.getThisClassName();
+ } else {
+ int index = occurrenceExp - OCCURRENCE_EXP_FIRST_ARG;
+ ArrayList args = me.getArguments();
+ if (index >= 0 && index < args.size()) {
+ className = me.getArguments().get(index).getActualType();
+ }
+ }
+ }
+ return className;
+ }
+
+ public String getOccurrenceText() {
+ String statementType = getStatementType();
+ switch (statementType) {
+ case "FieldAccess":
+ case "FieldUpdate":
+ return (occurrenceExp == 0) ? "container" : "field";
+ case "ArrayAccess":
+ case "ArrayUpdate":
+ return (occurrenceExp == 0) ? "arrayObject" : "arrayValue";
+ case "ArrayCreate":
+ return "return";
+ case "MethodInvocation":
+ if (occurrenceExp <= 0) {
+ return (occurrenceExp == 0) ? "receiver" : "return";
+ }
+ final String[] ORDER_TEXT = {"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th"}; // 0-13�ɑΉ�
+ final String ARG = " arg";
+ if (occurrenceExp % 100 >= ORDER_TEXT.length) {
+ return occurrenceExp + ORDER_TEXT[occurrenceExp % 10] + ARG; // ��2����14�ȏ�Ȃ�, ��1���̐����ɑΉ�������
+ } else if (occurrenceExp % 100 >= 0) {
+ return occurrenceExp + ORDER_TEXT[occurrenceExp % 100] + ARG; // ��2����0�ȏ�13�ȉ��Ȃ�, ��2���̐����ɑΉ�������
+ }
+ }
+ return String.valueOf(occurrenceExp);
+ }
+
+// @Override
+// public String toString() {
+// Statement statement = occurrencePoint.getStatement();
+// String className = getClassName();
+// String methodSignature = getMethodSignature();
+// String statementType = getStatementType();
+// String statementSigunarure = getStatementSignature();
+// String indent = " ";
+// StringBuilder str = new StringBuilder();
+// str.append("objId: " + objectId + " (class = " + className + ")" + "\n");
+// str.append("tp: " + occurrencePoint + "\n");
+// str.append(indent + "signature: " + methodSignature + "\n");
+// str.append(indent + "lineNo: " + statement.getLineNo() + "\n");
+// str.append(indent + "statementType: " + statementType + " -> " + statementSigunarure + "\n");
+// str.append("occurrenceExp: " + occurrenceExp + "\n");
+// return str.toString();
+// }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzer.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzer.java
new file mode 100644
index 0000000..6fda8d3
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzer.java
@@ -0,0 +1,240 @@
+package org.ntlab.reverseDebugger.analyzerProvider;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+
+// import org.ntlab.traceCollector.tracer.trace.Alias;
+import org.ntlab.traceCollector.tracer.trace.ArrayAccess;
+import org.ntlab.traceCollector.tracer.trace.ArrayCreate;
+import org.ntlab.traceCollector.tracer.trace.ArrayUpdate;
+import org.ntlab.traceCollector.tracer.trace.FieldAccess;
+import org.ntlab.traceCollector.tracer.trace.FieldUpdate;
+import org.ntlab.traceCollector.tracer.trace.MethodExecution;
+import org.ntlab.traceCollector.tracer.trace.MethodInvocation;
+import org.ntlab.traceCollector.tracer.trace.ObjectReference;
+import org.ntlab.traceCollector.tracer.trace.Statement;
+import org.ntlab.traceCollector.tracer.trace.TraceJSON;
+import org.ntlab.traceCollector.tracer.trace.TracePoint;
+
+public class ReverseDebuggerAnalyzer {
+
+ public void test2() {
+ System.out.println("OnlineTraceAnalyzer#test2()���Ăꂽ��!");
+ TraceJSON.test();
+ System.out.println("OnlineTraceAnalyzer#test2()���甲�����!");
+ }
+
+ public static ArrayList findAllStartAlias(MethodExecution me) {
+ System.out.println("OnlineTraceAnalyzer#findAllStartAlias(MethodExecution)���Ăꂽ��!");
+ ArrayList startAliasList = new ArrayList<>();
+ List statements = me.getStatements();
+ String[] primitives = {"byte", "short", "int", "long", "float", "double", "char", "boolean"};
+ List primitiveList = Arrays.asList(primitives);
+ for (int i = 0; i < statements.size(); i++) {
+ TracePoint tp = me.getTracePoint(i);
+ Statement statement = statements.get(i);
+ if (statement instanceof FieldAccess) {
+ FieldAccess fa = (FieldAccess)statement;
+ String objId = fa.getContainerObjId();
+ if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fa.getContainerClassName()))) {
+ startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_CONTAINER));
+ }
+ objId = fa.getValueObjId();
+ if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fa.getValueClassName()))) {
+ startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_FIELD));
+ }
+ } else if (statement instanceof FieldUpdate) {
+ FieldUpdate fu = (FieldUpdate)statement;
+ String objId = fu.getContainerObjId();
+ if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fu.getContainerClassName()))) {
+ startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_CONTAINER));
+ }
+ objId = fu.getValueObjId();
+ if (objId != null && !(objId.equals("0")) && !(primitiveList.contains(fu.getValueClassName()))) {
+ startAliasList.add(new Alias(objId, tp, Alias.OCCURRENCE_EXP_FIELD));
+ }
+ } else if (statement instanceof ArrayAccess) {
+ ArrayAccess aa = (ArrayAccess)statement;
+ String valueObjId = aa.getValueObjectId();
+ if (valueObjId != null && !(valueObjId.equals("0")) && !(primitiveList.contains(aa.getValueClassName()))) {
+ startAliasList.add(new Alias(valueObjId, tp, Alias.OCCURRENCE_EXP_ARRAY));
+ }
+ } else if (statement instanceof ArrayUpdate) {
+ ArrayUpdate au = (ArrayUpdate)statement;
+ String valueObjId = au.getValueObjectId();
+ if (valueObjId != null && !(valueObjId.equals("0")) && !(primitiveList.contains(au.getValueClassName()))) {
+ startAliasList.add(new Alias(valueObjId, tp, Alias.OCCURRENCE_EXP_ARRAY));
+ }
+ } else if (statement instanceof ArrayCreate) {
+ ArrayCreate ac = (ArrayCreate)statement;
+ String arrayObjId = ac.getArrayObjectId();
+ if (arrayObjId != null && !(arrayObjId.equals("0")) && !(primitiveList.contains(ac.getArrayClassName()))) {
+ startAliasList.add(new Alias(arrayObjId, tp, Alias.OCCURRENCE_EXP_RETURN));
+ }
+ } else if (statement instanceof MethodInvocation) {
+ MethodExecution calledMe = ((MethodInvocation)statement).getCalledMethodExecution();
+ String thisObjId = calledMe.getThisObjId();
+ if (thisObjId != null && !(thisObjId.equals("0"))) {
+ startAliasList.add(new Alias(thisObjId, tp, Alias.OCCURRENCE_EXP_RECEIVER));
+ }
+ List args = calledMe.getArguments();
+ for (int j = 0; j < args.size(); j++) {
+ ObjectReference arg = args.get(j);
+ String argValueId = arg.getId();
+ if (argValueId != null && !(argValueId.equals("0")) && !(primitiveList.contains(arg.getActualType()))) {
+ startAliasList.add(new Alias(argValueId, tp, (j + Alias.OCCURRENCE_EXP_FIRST_ARG)));
+ }
+ }
+ ObjectReference returnValue = calledMe.getReturnValue();
+ if (returnValue != null) {
+ String returnValueId = returnValue.getId();
+ if (returnValueId != null && !(returnValueId.equals("0") && !(primitiveList.contains(returnValue.getActualType())))) {
+ startAliasList.add(new Alias(returnValueId, tp, Alias.OCCURRENCE_EXP_RETURN));
+ }
+ }
+ }
+ }
+ for (Alias startAlias : startAliasList) {
+ System.out.println(startAlias);
+ }
+ return startAliasList;
+ }
+
+ private static TracePoint getRecentlyFieldUpdate(TracePoint tp) {
+ System.out.println("OnlineTraceAnalyzer#getRecentlyFieldUpdate(TracePoint)���Ăꂽ��!");
+ Statement statement = tp.getStatement();
+ if (statement instanceof FieldAccess) {
+ FieldAccess fa = (FieldAccess)statement;
+ return TraceJSON.getFieldUpdateTracePoint(fa.getContainerObjId(), fa.getFieldName(), tp);
+ }
+ return null;
+ }
+
+ private static TracePoint getRecentlyArrayUpdate(TracePoint tp) {
+ System.out.println("OnlineTraceAnalyzer#getRecentlyArrayUpdate(TracePoint)���Ăꂽ��!");
+ Statement statement = tp.getStatement();
+ if (statement instanceof ArrayAccess) {
+ ArrayAccess aa = (ArrayAccess)statement;
+ return TraceJSON.getArrayUpdateTracePoint(aa.getArrayObjectId(), aa.getIndex(), tp);
+ }
+ return null;
+ }
+
+ public static ArrayList> getObjectFlow(Alias startAlias) {
+ System.out.println("OnlineTraceAnalyzer#getObjectFlow(Alias)���Ăꂽ��!");
+ ArrayList> aliasLists = new ArrayList<>();
+ ArrayList aliasList = new ArrayList<>();
+ aliasLists.add(aliasList);
+// aliasList.add(alias);
+ String objId = startAlias.getObjectId();
+ TracePoint tp = startAlias.getOccurrencePoint().duplicate();
+ ArrayList> resultLists = getObjectFlow(aliasLists, objId, tp, 0);
+// for (int i = 0; i < resultLists.size(); i++) {
+// ArrayList resultList = resultLists.get(i);
+// System.out.println("---------------------------------------------------------"); // �m�F�p
+// for (Alias alias : resultList) System.out.println(alias); // �m�F�p
+// int lastAliasOccurrenceEXP = resultList.get(resultList.size() - 1).getOccurrenceExp();
+// if (lastAliasOccurrenceEXP != Alias.OCCURRENCE_EXP_RETURN) {
+// resultLists.remove(resultList); // �����̃G�C���A�X���z����R���X�g���N�^�Ăяo���ł͂Ȃ����X�g���폜����
+// }
+// }
+ for (List resultList : resultLists) {
+ for (Alias resultAlias : resultList) {
+ System.out.println(resultAlias);
+ }
+ }
+ return resultLists;
+ }
+
+ private static ArrayList> getObjectFlow(ArrayList> aliasLists,
+ String objId, TracePoint tp, int side) {
+ System.out.println("OnlineTraceAnalyzer#getObjectFlow(ArrayList, String, TracePoint, int)���Ăꂽ��!");
+ ArrayList aliasList = aliasLists.get(aliasLists.size() - 1); // ����getObjectFlow���\�b�h���s���Ō��������G�C���A�X�����Ă������X�g
+ do {
+ Statement statement = tp.getStatement();
+ if (statement instanceof FieldAccess) {
+ // �t�B�[���h�Q�Ƃ̏ꍇ
+ FieldAccess fa = (FieldAccess)statement;
+ if (fa.getValueObjId().equals(objId)) {
+ // ���Y�n�_�ł̃G�C���A�X�����X�g�ɒlj��������, �t�B�[���h�ŏI�X�V�ɔ�ԃp�^�[���Ƃ��̂܂ܑk��p�^�[���Ƃŕ���
+ aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_FIELD));
+ aliasList = new ArrayList<>(aliasList); // ���X�g���̂��f�B�[�v�R�s�[���Ă���(�t�B�[���h�ŏI�X�V�ɔ�ԍċA�����I�����, ���̂܂ܑk��p�^�[���ŗp����)
+ TracePoint fieldUpdateTp = getRecentlyFieldUpdate(tp);
+ aliasLists = getObjectFlow(aliasLists, objId, fieldUpdateTp, 0);
+ aliasLists.add(aliasList); // �ċA�����ɓ���O�Ƀf�B�[�v�R�s�[���Ă������X�g���Ō���ɒlj� (�ȍ~�̑k��ɂ���Č������G�C���A�X�͂��̃��X�g�ɓ������)
+ }
+ } else if (statement instanceof ArrayAccess) {
+ // �z��v�f�Q�Ƃ̏ꍇ
+ ArrayAccess aa = (ArrayAccess)statement;
+ if (aa.getValueObjectId().equals(objId)) {
+ aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_ARRAY));
+ aliasList = new ArrayList<>(aliasList);
+ TracePoint arrayUpdateTp = getRecentlyArrayUpdate(tp);
+ aliasLists = getObjectFlow(aliasLists, objId, arrayUpdateTp, 0);
+ aliasLists.add(aliasList);
+ }
+ } else if (statement instanceof ArrayCreate) {
+ // �z���̏ꍇ
+ ArrayCreate ac = (ArrayCreate)statement;
+ if (ac.getArrayObjectId().equals(objId)) {
+ aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_RETURN)); // �z���� new �^��[] �̖߂�l
+ return aliasLists; // �z���ӏ��̓G�C���A�X�̋N���Ȃ̂ł���ȑO�ɂ͂����Ȃ��͂�
+ }
+ } else if (statement instanceof MethodInvocation) {
+ // ���\�b�h�Ăяo���̏ꍇ
+ MethodExecution calledMethodExecution = ((MethodInvocation)statement).getCalledMethodExecution();
+ ObjectReference returnValue = calledMethodExecution.getReturnValue();
+ if (returnValue.getId().equals(objId)) {
+ // �߂�l�ɃG�C���A�X�̃I�u�W�F�N�gID����v�����ꍇ
+ aliasList.add(new Alias(objId, tp.duplicate(), Alias.OCCURRENCE_EXP_RETURN));
+ if (calledMethodExecution.isConstructor()) {
+ return aliasLists; // �R���X�g���N�^�Ăяo���ӏ��̓G�C���A�X�̋N���Ȃ̂ł���ȑO�ɂ͂����Ȃ��͂�
+ }
+ TracePoint exitTp = calledMethodExecution.getExitPoint(); // �Ăяo�����\�b�h���s�̍ŏI�X�e�[�g�����g���w��tp���擾
+ aliasLists = getObjectFlow(aliasLists, objId, exitTp, side + 1); // �Ăяo����̃��\�b�h���s�ɐ���
+ aliasList = aliasLists.get(aliasLists.size() - 1);
+ }
+ }
+ } while (tp.stepBackOver()); // �Ăяo�����ɖ߂邩����ȏ�H��Ȃ��Ȃ�܂Ń��[�v
+ if (!tp.isValid()) {
+ return aliasLists; // ����ȏチ�\�b�h���s��k��Ȃ��ꍇ(main���\�b�h�̂���ɑO�Ȃ�)�͂��̎��_�ŏI��
+ }
+ // --- ���̎��_�� tracePoint�� �Ăяo�������w���Ă��� (���O�܂ők���Ă������\�b�h���s�ɂ��Ẵ��\�b�h�Ăяo�����w���Ă���) ---
+ MethodExecution calledMethodExecution = ((MethodInvocation)tp.getStatement()).getCalledMethodExecution();
+ ArrayList args = calledMethodExecution.getArguments();
+ for (int i = 0; i < args.size(); i++) {
+ if (args.get(i).getId().equals(objId)) {
+ // ���\�b�h�Ăяo���̎������ɃG�C���A�X�̃I�u�W�F�N�gID����v�����ꍇ
+ aliasList.add(new Alias(objId, tp.duplicate(), (i + Alias.OCCURRENCE_EXP_FIRST_ARG)));
+ if (side == 0) {
+ // �T���J�n���\�b�h���s�܂��̓t�B�[���h��z��v�f�̍ŏI�X�V�T���Ŕ��̃��\�b�h���s����, �X�^�b�N�g���[�X�ł��ǂ��S���\�b�h���s�̏ꍇ
+ TracePoint previousTp = tp.duplicate();
+ previousTp.stepBackOver();
+ aliasLists = getObjectFlow(aliasLists, objId, previousTp, 0); // �Ăяo�����̃��\�b�h���s�ɖ߂�
+ }
+ }
+ }
+ return aliasLists;
+ }
+
+ public static int countMethodExecutionInTraceCollector(List methodExecutions, String targetSignature, int count, String indent) {
+ System.out.println("OnlineTraceAnalyzer#countMethodExecutionInTraceCollector(List, String, int, String)���Ăꂽ��!");
+ if (methodExecutions == null || methodExecutions.isEmpty()) {
+ return count;
+ }
+ for (int i = 0; i < methodExecutions.size(); i++) {
+ MethodExecution me = methodExecutions.get(i);
+ String signature = me.getSignature();
+// System.out.println(indent + signature);
+ if (targetSignature.equals(signature)) {
+ count++;
+ }
+ List children = me.getChildren();
+ count = countMethodExecutionInTraceCollector(children, targetSignature, count, indent + "--------");
+ }
+ return count;
+ }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzerCallTester.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzerCallTester.java
new file mode 100644
index 0000000..0159bd0
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzerCallTester.java
@@ -0,0 +1,32 @@
+package org.ntlab.reverseDebugger.analyzerProvider;
+
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.JDIStaticMethodCaller;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+
+/**
+ * �^�[�Q�b�g����VM��ɂ��邱�̃v���W�F�N�g���̃N���X�̃��\�b�h(���OnlineTraceAnalyzer�N���X�Ƃ��̃��\�b�h)��
+ * reverseDebugger����VM��ɂ��邱�̃v���W�F�N�g���̃N���X�̃��\�b�h���s����Ăяo���e�X�g�p�N���X
+ * @author student
+ *
+ */
+public class ReverseDebuggerAnalyzerCallTester {
+
+ public void test1(VirtualMachine vm, ThreadReference thread) {
+ System.out.println("ReverseDebuggerAnalyzerCaller#test1()���Ăꂽ��!");
+ JDIStaticMethodCaller mc = new JDIStaticMethodCaller(vm, thread);
+ try {
+ mc.callStaticMethod(ReverseDebuggerLaunchConfiguration.ANALYZER_PACKAGE, ReverseDebuggerLaunchConfiguration.ANALYZER_CLASS, "test2");
+ } catch (InvalidTypeException | ClassNotLoadedException
+ | InvocationException | IncompatibleThreadStateException e) {
+ e.printStackTrace();
+ }
+ System.out.println("ReverseDebuggerAnalyzerCaller#test1()���甲�����!");
+ }
+}
diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerLaunchConfiguration.java b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerLaunchConfiguration.java
new file mode 100644
index 0000000..6a519da
--- /dev/null
+++ b/org.ntlab.reverseDebugger/src/org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerLaunchConfiguration.java
@@ -0,0 +1,28 @@
+package org.ntlab.reverseDebugger.analyzerProvider;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.ntlab.traceCollector.IAdditionalLaunchConfiguration;
+
+public class ReverseDebuggerLaunchConfiguration implements IAdditionalLaunchConfiguration {
+ public static final String ANALYZER_PATH = "org/ntlab/reverseDebugger/analyzerProvider/ReverseDebuggerAnalyzer.class";
+ public static final String ANALYZER_PACKAGE = "org.ntlab.reverseDebugger.analyzerProvider";
+ public static final String ANALYZER_CLASS = "ReverseDebuggerAnalyzer";
+
+ @Override
+ public String[] getAdditionalClasspath() {
+ try {
+ List classPathList = new ArrayList<>();
+ String tracerClassPath = FileLocator.resolve(this.getClass().getClassLoader().getResource(ANALYZER_PATH)).getPath();
+ String classPath = tracerClassPath.substring(1, tracerClassPath.length() - ANALYZER_PATH.length());
+ classPathList.add(classPath);
+ return classPathList.toArray(new String[classPathList.size()]);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ throw new IllegalStateException();
+ }
+}