diff --git a/org.ntlab.sampleAnalyzer/.classpath b/org.ntlab.sampleAnalyzer/.classpath
new file mode 100644
index 0000000..b862a29
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/org.ntlab.sampleAnalyzer/.gitignore b/org.ntlab.sampleAnalyzer/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/org.ntlab.sampleAnalyzer/.project b/org.ntlab.sampleAnalyzer/.project
new file mode 100644
index 0000000..6603cfe
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/.project
@@ -0,0 +1,28 @@
+
+
+ org.ntlab.sampleAnalyzer
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/org.ntlab.sampleAnalyzer/.settings/org.eclipse.jdt.core.prefs b/org.ntlab.sampleAnalyzer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..295926d
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.ntlab.sampleAnalyzer/META-INF/MANIFEST.MF b/org.ntlab.sampleAnalyzer/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..15c834a
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SampleAnalyzer
+Bundle-SymbolicName: org.ntlab.sampleAnalyzer;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.ntlab.sampleanalyzer.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.ntlab.traceCollector,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.debug,
+ org.eclipse.jdt.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
diff --git a/org.ntlab.sampleAnalyzer/build.properties b/org.ntlab.sampleAnalyzer/build.properties
new file mode 100644
index 0000000..6f20375
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/org.ntlab.sampleAnalyzer/plugin.xml b/org.ntlab.sampleAnalyzer/plugin.xml
new file mode 100644
index 0000000..d605104
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/plugin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
new file mode 100644
index 0000000..a94fd82
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/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.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIInstanceMethodCaller.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIInstanceMethodCaller.java
new file mode 100644
index 0000000..568e97b
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/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.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIStaticMethodCaller.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIStaticMethodCaller.java
new file mode 100644
index 0000000..0f48d30
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/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.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotDebuggedException.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotDebuggedException.java
new file mode 100644
index 0000000..efe1143
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotDebuggedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotDebuggedException extends Exception {
+
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotExecutedException.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotExecutedException.java
new file mode 100644
index 0000000..b41e88b
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotExecutedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotExecutedException extends Exception {
+
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotSuspendedException.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotSuspendedException.java
new file mode 100644
index 0000000..3909acb
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/NotSuspendedException.java
@@ -0,0 +1,5 @@
+package org.ntlab.onlineAccessor;
+
+public class NotSuspendedException extends Exception {
+
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/Activator.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/Activator.java
new file mode 100644
index 0000000..5f138ed
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/Activator.java
@@ -0,0 +1,50 @@
+package org.ntlab.sampleanalyzer;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.ntlab.sampleAnalyzer"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java
new file mode 100644
index 0000000..6dc7f0a
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java
@@ -0,0 +1,26 @@
+package org.ntlab.sampleanalyzer.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 SampleAnalyzerLaunchConfiguration implements IAdditionalLaunchConfiguration {
+ public static final String ANALYZER_PATH = "org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.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();
+ }
+}