summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/icon/mark_interactive_profiling.pngbin0 -> 3197 bytes
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/icon/view_icon_interactive_profiling.pngbin0 -> 3183 bytes
-rwxr-xr-xorg.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml102
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java125
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java43
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java101
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java85
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java52
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java11
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties14
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java204
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java142
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java190
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/InteractiveProfileView.java36
-rw-r--r--org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java64
15 files changed, 1112 insertions, 57 deletions
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/icon/mark_interactive_profiling.png b/org.tizen.dynamicanalysis.ide.native.eplugin/icon/mark_interactive_profiling.png
new file mode 100644
index 0000000..22d6ba6
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/icon/mark_interactive_profiling.png
Binary files differ
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/icon/view_icon_interactive_profiling.png b/org.tizen.dynamicanalysis.ide.native.eplugin/icon/view_icon_interactive_profiling.png
new file mode 100644
index 0000000..92457b1
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/icon/view_icon_interactive_profiling.png
Binary files differ
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml b/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml
index f61e3eb..f1609a6 100755
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml
@@ -120,5 +120,107 @@
sourcepath="/on-demand">
</tools>
</extension>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <viewerContribution
+ id="org.tizen.dynamicanalysis.ide.eplugin.contribution"
+ targetID="#CEditorContext">
+ <action
+ class="org.tizen.dynamicanalysis.ide.eplugin.popup.actions.AddProfileVariableActionDelegate"
+ id="org.tizen.dynamicanalysis.ide.eplugin.contribution.editor.action"
+ label="Add to Checkpoint of Dynamic Analyzer"
+ menubarPath="additions">
+ </action>
+ </viewerContribution>
+ </extension>
+ <extension id="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker" point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.core.resources.marker"/>
+ <attribute name="variableName" />
+ <attribute name="sourcePath_" />
+ <attribute name="arrayCount" />
+ <persistent value="true" />
+ </extension>
+ <extension
+ point="org.eclipse.ui.ide.markerSupport">
+ <markerContentGenerator
+ id="org.tizen.dynamicanalysis.ide.eplugin.markerEventContentGenerator" name="My Marker Generator">
+ <markerTypeReference id="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker"/>
+ <markerFieldReference id="org.eclipse.ui.ide.completionField"/>
+ <markerFieldReference id="variableName"/>
+ <markerFieldReference id="org.eclipse.ui.ide.resourceField"/>
+ <markerFieldReference id="org.eclipse.ui.ide.locationField"/>
+ </markerContentGenerator>
+ <markerField
+ class="org.tizen.dynamicanalysis.ide.eplugin.views.CheckBoxField"
+ id="checkBox"
+ name="check">
+ </markerField>
+ <markerField
+ class="org.tizen.dynamicanalysis.ide.eplugin.views.VariableNameField"
+ id="variableName"
+ name="Variable Name">
+ </markerField>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.tizen.nativeapp.viewCategory"
+ class="org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView"
+ id="org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView"
+ name="CheckPoint"
+ icon="icon/view_icon_interactive_profiling.png">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <view
+ id="org.tizen.dynamicanalysis.ide.eplugin.views.SampleView"
+ ratio="0.5"
+ relationship="right"
+ relative="org.eclipse.ui.views.ProblemView">
+ </view>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="contexts.xml">
+ </contexts>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.markerAnnotationSpecification"
+ id="interactiveannotationspecification">
+ <specification
+ annotationType="interactiveannotation"
+ colorPreferenceKey="clcolor"
+ colorPreferenceValue="255,255,0"
+ highlightPreferenceKey="clhighlight"
+ highlightPreferenceValue="false"
+ icon="icon/mark_interactive_profiling.png"
+ label="CheckPoint of Dynamic Analyzer"
+ overviewRulerPreferenceKey="clruler"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="0"
+ textPreferenceKey="cltext"
+ textPreferenceValue="false"
+ textStylePreferenceKey="clstyle"
+ textStylePreferenceValue="NONE"
+ verticalRulerPreferenceKey="clvertical"
+ verticalRulerPreferenceValue="true">
+ </specification>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.editors.annotationTypes">
+ <type
+ markerSeverity="0"
+ markerType="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker"
+ name="interactiveannotation"
+ super="org.eclipse.ui.workbench.texteditor.info">
+ </type>
+ </extension>
</plugin>
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java
index 35db85c..67e01f9 100644
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java
@@ -26,16 +26,47 @@
package org.tizen.dynamicanalysis.ide.eplugin;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CDTUITools;
+import org.eclipse.cdt.ui.text.SharedASTJob;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup;
+import org.tizen.dynamicanalysis.ide.eplugin.popup.actions.InteractiveUtil;
public class Activator implements BundleActivator {
public static final String PLUGIN_ID = "org.tizen.dynamicanalyzer";//$NON-NLS-1$
public static final String PROFILE_MODE = "profile";//$NON-NLS-1$
-
+ public static final Object InteractiveValidCheckJobLock = new Object();
+
private static BundleContext context;
+ private IResourceChangeListener listener;
+
static BundleContext getContext() {
return context;
}
@@ -46,6 +77,98 @@ public class Activator implements BundleActivator {
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ listener = new IResourceChangeListener() {
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ switch (event.getType()) {
+ /*
+ * Listen Save Event
+ * This routine again check validation of Interactive Markers.
+ */
+ case IResourceChangeEvent.POST_CHANGE :
+ final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ final Map<IEditorPart, IMarker[]> editorMap = new HashMap<IEditorPart, IMarker[]>();
+ try {
+ /*
+ * Find changed resources and collect all markers contained in changed resources.
+ * Also IEditorPart is collected to get Source code parser and check isDirty.
+ */
+ event.getDelta().accept(new IResourceDeltaVisitor() {
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (delta.getKind() == IResourceDelta.CHANGED) {
+ IEditorInput editorInput = InteractiveUtil.getEditorInput(delta.getResource());
+ if (editorInput != null) {
+ for (int i = 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages = windows[i].getPages();
+ for (int j = 0; j < pages.length; j++) {
+ IEditorPart editor = pages[j].findEditor(editorInput);
+ if (editor != null) {
+ IMarker[] markers = delta.getResource().findMarkers(
+ CommonConstants.MARKER_ID, true, 1);
+ editorMap.put(editor, markers);
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+ });
+ } catch (CoreException e) {
+ DALog.printLog(e);
+ }
+
+ Iterator<IEditorPart> iter = editorMap.keySet().iterator();
+ while (iter.hasNext()) {
+ final IEditorPart editorPart = iter.next();
+ final IMarker[] markerList = editorMap.get(editorPart);
+ ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(editorPart.getEditorInput());
+ if (tu == null) {
+ continue;
+ }
+ // Check validation
+ Job job = new SharedASTJob(CommonConstants.INTERACTIVE_VALIDATION_JOB_NAME, tu) {
+ @Override
+ public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
+ IASTNodeSelector nodeSelector = ast.getNodeSelector(null);
+ synchronized(InteractiveValidCheckJobLock) {
+ // Before markers update, listener should be removed to prevent recursive event occurs.
+ workspace.removeResourceChangeListener(listener);
+ for (int i = 0; i < markerList.length; i++) {
+ IMarker marker = markerList[i];
+ Object offset = marker.getAttribute(IMarker.CHAR_START);
+ if (offset != null) {
+ IASTName name = nodeSelector.findEnclosingName((Integer)offset, 0);
+ if (editorPart.isDirty()) {
+ // user edit source file during save handling.
+ break;
+ }
+ boolean isValid = InteractiveUtil.isValidVariable(name);
+ if (isValid) {
+ marker.setAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME,
+ InteractiveUtil.makeFullVariableName(name));
+ }
+ marker.setAttribute(CommonConstants.MARKER_VALID_VARIABLE, isValid);
+ }
+ }
+ // After markers update, listener should be set again.
+ workspace.addResourceChangeListener(listener);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ };
+ workspace.addResourceChangeListener(listener);
}
/*
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java
new file mode 100644
index 0000000..d30ca95
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java
@@ -0,0 +1,43 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin;
+
+public class CommonConstants {
+ public static final String INTERACTIVE_VIEW_ID = "org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView";
+ public static final String MARKER_ID = "org.tizen.dynamicanalysis.ide.eplugin.interactivemarker";
+ public static final String MARKER_GENERATOR_ID = "org.tizen.dynamicanalysis.ide.eplugin.markerEventContentGenerator";
+ public static final String MARKER_ATTR_VARIABLE_NAME = "variableName";
+ public static final String MARKER_ATTR_SOURCE_PATH = "sourcePath";
+ public static final String MARKER_ATTR_ARRAY_COUNT = "arrayCount";
+ public static final String MARKER_ATTR_CHECK_LOCATION = "checkLocation";
+ public static final String MARKER_VALID_VARIABLE = "isValid";
+ public static final String INTERACTIVE_VALIDATION_JOB_NAME = "Check validation of interactive checkpoint";
+
+ public static final int INTERACTIVE_CHECKPOINT_LOCATION_INVALID = 0;
+ public static final int INTERACTIVE_CHECKPOINT_LOCATION_BEFORE = 1;
+ public static final int INTERACTIVE_CHECKPOINT_LOCATION_AFTER = 2;
+ public static final int INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_AFTER = 3;
+} \ No newline at end of file
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java
index d8fbb33..c024f5f 100644
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java
@@ -40,11 +40,14 @@ import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.dynamicanalysis.ide.eplugin.DALog;
+import org.tizen.dynamicanalysis.ide.eplugin.launch.CheckPointInfo;
import org.tizen.dynamicanalysis.ide.eplugin.launch.ProjectType;
import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;
@@ -65,6 +68,8 @@ public class DAServerManager extends Thread {
private List<String> reservedLocalPackagePathList; //$NON-NLS-1$
private String LOCAL_HOST = "127.0.0.1";
+ private Set<CheckPointInfo> reservedInteractiveInfoSet; //$NON-NLS-1$
+ private String reservedDebugBinaryPath; //$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_1 = "STATUS"; //$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_2 = "RUN"; //$NON-NLS-1$
@@ -81,7 +86,7 @@ public class DAServerManager extends Thread {
private final String CURRENT_ACTIVE_IDE_PORT = "current_active_ide_port"; //$NON-NLS-1$
private static boolean recvDAReadyStatus = false;
-
+
public synchronized static DAServerManager getInstance() {
if (instance == null) {
instance = new DAServerManager();
@@ -95,15 +100,18 @@ public class DAServerManager extends Thread {
public Socket getClientSocket() {
return ideClientSocket;
}
-
- public void reserveTraceApplication(String deviceName, ProjectType projectType,
- String binaryOfTarget, String executablePath, List<String> localPackagePathList) {
+
+ public void reserveTraceApplication(String deviceName, ProjectType projectType, String binaryOfTarget,
+ String executablePath, List<String> localPackagePathList, Set<CheckPointInfo> interactiveInfoSet,
+ String debugBinaryPath) {
reservedTraceApplication = true;
reservedDeviceName = deviceName;
reservedProjectType = projectType;
- reservedBinaryOfTarget = binaryOfTarget;
+ reservedBinaryOfTarget = binaryOfTarget;
reservedExecutablePath = executablePath;
reservedLocalPackagePathList = localPackagePathList;
+ reservedInteractiveInfoSet = interactiveInfoSet;
+ reservedDebugBinaryPath = debugBinaryPath;
}
// main
@@ -159,10 +167,8 @@ public class DAServerManager extends Thread {
public static boolean checkDASingleton() {
boolean isActiveDA = false;
StringBuffer savePath = new StringBuffer();
- savePath.append(InstallPathConfig.getUserDataPath())
- .append(File.separatorChar).append(DANAIC_ANALYZER)
- .append(File.separatorChar).append(SAVE)
- .append(File.separatorChar);
+ savePath.append(InstallPathConfig.getUserDataPath()).append(File.separatorChar).append(DANAIC_ANALYZER)
+ .append(File.separatorChar).append(SAVE).append(File.separatorChar);
File folder = new File(savePath.toString());
if (!folder.exists()) {
@@ -171,12 +177,12 @@ public class DAServerManager extends Thread {
return false;
}
}
-
+
savePath.append(ACTIVE_DA_PLUGIN);
-
+
FileLock fileLock = null;
FileChannel fchannel = null;
-
+
File file = new File(savePath.toString());
try {
fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
@@ -213,8 +219,9 @@ public class DAServerManager extends Thread {
private void checkReservedTraceApplication() {
if (reservedTraceApplication == true) {
reservedTraceApplication = false;
- runTraceApplication(reservedDeviceName, reservedProjectType, reservedBinaryOfTarget,
- reservedExecutablePath, reservedLocalPackagePathList);
+ runTraceApplication(reservedDeviceName, reservedProjectType, reservedBinaryOfTarget,
+ reservedExecutablePath, reservedLocalPackagePathList, reservedInteractiveInfoSet,
+ reservedDebugBinaryPath);
}
}
@@ -241,14 +248,13 @@ public class DAServerManager extends Thread {
public String getPortFile() {
StringBuffer savePath = new StringBuffer();
- savePath.append(InstallPathConfig.getUserDataPath())
- .append(File.separatorChar).append(DANAIC_ANALYZER)
+ savePath.append(InstallPathConfig.getUserDataPath()).append(File.separatorChar).append(DANAIC_ANALYZER)
.append(File.separatorChar).append(SAVE);
File saveDir = new File(savePath.toString());
if (!saveDir.exists()) {
if (!saveDir.mkdirs()) {
- // if it failed creating folder, Do nothing.
+ // if it failed creating folder, Do nothing.
// Exception should be handled in caller.
}
}
@@ -314,16 +320,14 @@ public class DAServerManager extends Thread {
public boolean sendDAStatusMessage() {
setRecvDAReadyStatus(false);
StringBuffer command = new StringBuffer();
- command.append(IDE_DA_COMMUNICATION_TYPE_1)
- .append(IDE_DA_COMMUNICATION_SEPARATOR)
+ command.append(IDE_DA_COMMUNICATION_TYPE_1).append(IDE_DA_COMMUNICATION_SEPARATOR)
.append("").append(IDE_DA_COMMUNICATION_SEPARATOR)//$NON-NLS-1$
.append("");//$NON-NLS-1$
try {
sendData(command.toString());
} catch (IOException e) {
DALog.printLog("DAServerManager - sendDAStatusMessage - IOException");
- DALog.dlgErrorMessage(Labels.MESSAGE_ERROR,
- Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
+ DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
}
synchronized (this) {
try {
@@ -336,45 +340,40 @@ public class DAServerManager extends Thread {
return getRecvDAReadyStatus();
}
- // Send Message Trace Application
-// public void runTraceApplication(final String strDevice, final String appID,
-// final String appName) {
-// StringBuffer command = new StringBuffer();
-// command.append(IDE_DA_COMMUNICATION_TYPE_2)
-// .append(IDE_DA_COMMUNICATION_SEPARATOR).append(strDevice)
-// .append(IDE_DA_COMMUNICATION_SEPARATOR).append(appID)
-// .append(IDE_DA_COMMUNICATION_SEPARATOR).append(appName);
-// try {
-// sendData(command.toString());
-// } catch (IOException e) {
-// DALog.printLog("DAServerManager - runTraceApplication - IOException");
-// DALog.dlgErrorMessage(Labels.MESSAGE_ERROR,
-// Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
-// }
-// }
-
- public void runTraceApplication(String strDevice, ProjectType projectType,
- String binaryOfTarget, String executablePath, List<String> localPackagePathList) {
+ public void runTraceApplication(String strDevice, ProjectType projectType, String binaryOfTarget,
+ String executablePath, List<String> localPackagePathList, Set<CheckPointInfo> interactiveInfoSet,
+ String debugBinaryPath) {
StringBuffer command = new StringBuffer();
- command.append(IDE_DA_COMMUNICATION_TYPE_2)
- .append(IDE_DA_COMMUNICATION_SEPARATOR).append(strDevice)
+ command.append(IDE_DA_COMMUNICATION_TYPE_2).append(IDE_DA_COMMUNICATION_SEPARATOR).append(strDevice)
.append(IDE_DA_COMMUNICATION_SEPARATOR).append(projectType.ordinal())
- .append(IDE_DA_COMMUNICATION_SEPARATOR).append(binaryOfTarget)
- .append(IDE_DA_COMMUNICATION_SEPARATOR).append(executablePath);
+ .append(IDE_DA_COMMUNICATION_SEPARATOR).append(binaryOfTarget).append(IDE_DA_COMMUNICATION_SEPARATOR)
+ .append(executablePath);
if (localPackagePathList != null) {
for (int i = 0; i < localPackagePathList.size(); i++) {
command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(localPackagePathList.get(i));
}
}
+ if (interactiveInfoSet != null) {
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(interactiveInfoSet.size());
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(debugBinaryPath);
+ Iterator<CheckPointInfo> iter = interactiveInfoSet.iterator();
+ while (iter.hasNext()) {
+ CheckPointInfo info = iter.next();
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getSourcePath());
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getVariableName());
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getLine());
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getArrayCount());
+ command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getCheckLocation());
+ }
+ }
try {
sendData(command.toString());
} catch (IOException e) {
DALog.printLog("DAServerManager - runTraceApplication - IOException");
- DALog.dlgErrorMessage(Labels.MESSAGE_ERROR,
- Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
+ DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
}
}
-
+
// Management Receive Message
private void commandReceiveMessage(final String msg) {
DALog.printLog("commandReceiveMessage : " + msg);//$NON-NLS-1$
@@ -393,7 +392,8 @@ public class DAServerManager extends Thread {
}
}
- private synchronized void setDAStatus(final String[] msgArray) { // DA Status
+ private synchronized void setDAStatus(final String[] msgArray) { // DA
+ // Status
if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_RECORD)) {
setRecvDAReadyStatus(false);
} else if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_STOP)) {
@@ -416,8 +416,7 @@ public class DAServerManager extends Thread {
boolean bSuccess = true;
try {
if (null != ideClientSocket) {
- writer = new BufferedWriter(new OutputStreamWriter(
- ideClientSocket.getOutputStream()));
+ writer = new BufferedWriter(new OutputStreamWriter(ideClientSocket.getOutputStream()));
writer.write(msg);
writer.flush();
}
@@ -447,6 +446,6 @@ public class DAServerManager extends Thread {
}
public void setRecvDAReadyStatus(boolean status) {
- recvDAReadyStatus = status;
+ recvDAReadyStatus = status;
}
} \ No newline at end of file
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java
new file mode 100644
index 0000000..c726721
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java
@@ -0,0 +1,85 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin.launch;
+
+
+public class CheckPointInfo {
+ private String sourcePath;
+ private String variableName;
+ private int line;
+ private int arrayCount;
+ private int checkLocation;
+
+ public CheckPointInfo(String sourcePath, String variableName, int line, int arrayCount, int checkLocation) {
+ this.sourcePath = sourcePath;
+ this.variableName = variableName;
+ this.line = line;
+ this.arrayCount = arrayCount;
+ this.checkLocation = checkLocation;
+ }
+
+ public String getSourcePath() {
+ return sourcePath;
+ }
+
+ public String getVariableName() {
+ return variableName;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public int getArrayCount() {
+ return arrayCount;
+ }
+
+ public int getCheckLocation() {
+ return checkLocation;
+ }
+
+ private String getStream() {
+ return variableName + "," + line + "," + sourcePath;
+ }
+
+ @Override
+ public int hashCode() {
+ return getStream().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof CheckPointInfo) {
+ return ((CheckPointInfo)o).getStream().equals(getStream());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getStream();
+ }
+}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java
index d03879f..5694edb 100644
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java
@@ -32,13 +32,19 @@ import static org.tizen.common.launch.LaunchesListener.LAUNCH_ATTR_VALUE_LAUNCHI
import java.io.File;
import java.io.IOException;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -50,6 +56,7 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
import org.tizen.common.IApplicationConfiguration;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.launch.LaunchMessages;
@@ -60,6 +67,7 @@ import org.tizen.common.util.log.LoggerConstants;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.common.util.log.UserLogger;
import org.tizen.dynamicanalysis.ide.eplugin.Activator;
+import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants;
import org.tizen.dynamicanalysis.ide.eplugin.DALog;
import org.tizen.dynamicanalysis.ide.eplugin.communication.DAServerManager;
import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;
@@ -133,12 +141,18 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate {
String binaryOfTarget = "";
String executablePath = "";
List<String> localPackagePathList = null;
+
if (isDAReady()) {
IApplicationConfiguration adapter = (IApplicationConfiguration) project
.getAdapter(IApplicationConfiguration.class);
binaryOfTarget = adapter.getAppId();
+ String debugBinaryPath = null;
+ IPath exePath = CDebugUtils.verifyProgramPath(config);
+ if (exePath != null) {
+ debugBinaryPath = exePath.toOSString();
+ }
runDynamicAnalyzer(device, projectType, binaryOfTarget,
- executablePath, localPackagePathList);
+ executablePath, localPackagePathList, getProfileVariableInfos(project, config), debugBinaryPath);
}
} finally {
endLaunchTime = System.currentTimeMillis();
@@ -165,6 +179,36 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate {
}
}
+ private Set<CheckPointInfo> getProfileVariableInfos(final IProject project, ILaunchConfiguration config) {
+ final Set<CheckPointInfo> profileVariableInfos = new HashSet<CheckPointInfo>();
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IMarker[] markers = project.findMarkers(CommonConstants.MARKER_ID, true, IResource.DEPTH_INFINITE);
+ synchronized(Activator.InteractiveValidCheckJobLock) {
+ for (int i = 0; i < markers.length; i++) {
+ boolean isChecked = (Boolean)markers[i].getAttribute(IMarker.DONE);
+ boolean isValid = (Boolean)markers[i].getAttribute(CommonConstants.MARKER_VALID_VARIABLE);
+ if (isChecked && isValid) {
+ String sourcePath = markers[i].getAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, "");
+ String variableName = markers[i].getAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, "");
+ int line = markers[i].getAttribute(IMarker.LINE_NUMBER, 0);
+ int arrayCount = markers[i].getAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, 0);
+ int checkLocation = markers[i].getAttribute(CommonConstants.MARKER_ATTR_CHECK_LOCATION, 0);
+ CheckPointInfo info = new CheckPointInfo(sourcePath, variableName, line, arrayCount, checkLocation);
+ profileVariableInfos.add(info);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ DALog.printLog(e);
+ }
+ }
+ });
+ return profileVariableInfos;
+ }
+
private boolean isDAReady() {
if (DAServerManager.getInstance().getClientSocket() != null) {
return DAServerManager.getInstance().sendDAStatusMessage();
@@ -204,7 +248,7 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate {
private void runDynamicAnalyzer(String device, ProjectType projectType,
String binaryOfTarget, String executablePath,
- List<String> localPackagePathList) {
+ List<String> localPackagePathList, Set<CheckPointInfo> interactiveInfoSet, String debugBinaryPath) {
if (DAServerManager.getInstance().getClientSocket() == null) {
StringBuffer command = new StringBuffer();
@@ -245,11 +289,11 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate {
DAServerManager.getInstance().reserveTraceApplication(device,
projectType, binaryOfTarget, executablePath,
- localPackagePathList);
+ localPackagePathList, interactiveInfoSet, debugBinaryPath);
} else {
DAServerManager.getInstance().runTraceApplication(device,
projectType, binaryOfTarget, executablePath,
- localPackagePathList);
+ localPackagePathList, interactiveInfoSet, debugBinaryPath);
}
}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java
index 443b619..b2d7996 100644
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java
@@ -45,6 +45,17 @@ public class Labels extends NLS {
public static String MESSAGE_ANOTHER_IDE_CONNECTED;
+ public static String INTERACTIVE_DIALOG_TITLE_SUCCESS;
+ public static String INTERACTIVE_DIALOG_MSG_SUCCESS;
+ public static String INTERACTIVE_DIALOG_TITLE_ERROR;
+ public static String INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE;
+ public static String INTERACTIVE_DIALOG_MSG_INVALID_LINE;
+
+ public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE;
+ public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION;
+ public static String INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION;
+ public static String INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Labels.class);
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties
index feec3f8..4de5131 100644
--- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties
@@ -10,4 +10,16 @@ MESSAGE_DYNAMIC_ANALYZER_IS_NOT_INSTALLED=Dynamic Analyzer is not installed.
MESSAGE_NOT_SUPPORT_UNIT_TEST_PROJECT=DA does not support tizen unit test project.
MESSAGE_NOT_SUPPORT_IME_PROJECT=Certain application categories, such as "ime", cannot be launched by "Profile As".
-MESSAGE_ANOTHER_IDE_CONNECTED= Dynamic Analyzer has been connected to another IDE\n You need to close the prior Dynamic Analyzer first. \ No newline at end of file
+MESSAGE_ANOTHER_IDE_CONNECTED= Dynamic Analyzer has been connected to another IDE\n You need to close the prior Dynamic Analyzer first.
+
+INTERACTIVE_DIALOG_TITLE_SUCCESS=Checkpoint is added successfully
+INTERACTIVE_DIALOG_MSG_SUCCESS=Variable is added to Checkpoint successfully.
+INTERACTIVE_DIALOG_TITLE_ERROR=Checkpoint is failed to be added
+INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE=Invalid variable. The word you selected is not variable.\nYou should select a variable.
+INTERACTIVE_DIALOG_MSG_INVALID_LINE=Invalid line. This line is not in function.\nYou should select line which belongs to function body.
+
+INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE=Select location of CheckPoint
+INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION=To use CheckPoint analysis, you should select at least one location of CheckPoint.\nTo get value before execution of the line you selected, you should check "Before line execution".\nOr if you want to get value after execution of the line, check "After line execution".
+
+INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION=Before line execution
+INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION=After line execution \ No newline at end of file
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java
new file mode 100644
index 0000000..4bee210
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java
@@ -0,0 +1,204 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin.popup.actions;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IArrayType;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CDTUITools;
+import org.eclipse.cdt.ui.ICEditor;
+import org.eclipse.cdt.ui.text.SharedASTJob;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionDelegate;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants;
+import org.tizen.dynamicanalysis.ide.eplugin.DALog;
+import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;
+import org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView;
+
+public class AddProfileVariableActionDelegate extends ActionDelegate implements IEditorActionDelegate {
+ /**
+ * @see ActionDelegate#run(IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (part instanceof ICEditor) {
+ final ICEditor editor = (ICEditor) part;
+ IEditorInput input = editor.getEditorInput();
+ final IFile file = ((FileEditorInput) input).getFile();
+ ISelection sel = editor.getSelectionProvider().getSelection();
+ if (sel instanceof TextSelection) {
+ final ITextSelection textSel = (ITextSelection) sel;
+ ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(part.getEditorInput());
+ IDocumentProvider prov = editor.getDocumentProvider();
+ IDocument doc = prov.getDocument(editor.getEditorInput());
+ /*
+ * Check valid line
+ */
+ int lineNum = textSel.getStartLine() + 1;
+ if (InteractiveUtil.isValidLine(tu, lineNum, textSel.getOffset(), doc) == false) {
+ notifyInvalidLine();
+ return;
+ }
+ /*
+ * Check validation
+ */
+ Job job = new SharedASTJob(CommonConstants.INTERACTIVE_VALIDATION_JOB_NAME, tu) {
+ @Override
+ public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
+ IASTNodeSelector nodeSelector = ast.getNodeSelector(null);
+ IASTName name = nodeSelector.findEnclosingName(textSel.getOffset(), textSel.getLength());
+ if (name != null) {
+ IBinding b = name.resolveBinding();
+ if (b == null || !(b instanceof IVariable)) {
+ notifyInvalidVariable();
+ } else {
+ int arrayCount = 0;
+ if (((IVariable) b).getType() instanceof IArrayType) {
+ arrayCount = ((IArrayType) (((IVariable) b).getType())).getSize().numericalValue()
+ .intValue();
+ }
+ int line = textSel.getStartLine() + 1; // getStartLine() return index. so plus 1.
+ int offset = textSel.getOffset();
+ int length = name.toString().length();
+ String fullName = InteractiveUtil.makeFullVariableName(name);
+ setInteractiveInfo(fullName, arrayCount, line, offset, length, file);
+ }
+ } else {
+ notifyInvalidVariable();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ }
+ }
+
+ private void setInteractiveInfo(final String varName, final int arrayCount, final int line, final int offset,
+ int length, final IFile file) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ InteractiveProfileView view = (InteractiveProfileView) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().showView(CommonConstants.INTERACTIVE_VIEW_ID);
+ view.showBusy(true);
+ } catch (PartInitException e) {
+ DALog.printLog(e);
+ }
+
+ SelectCheckpointDialog selectCheckPointDialog = new SelectCheckpointDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell());
+ int checkLocation = selectCheckPointDialog.getLocation();
+ if (checkLocation != CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_INVALID) {
+ // Create new marker
+ try {
+ IMarker marker = file.createMarker(CommonConstants.MARKER_ID);
+ if (marker != null) {
+ marker.setAttribute(IMarker.LINE_NUMBER, line);
+ marker.setAttribute(IMarker.CHAR_START, offset);
+ marker.setAttribute(IMarker.CHAR_END, offset);
+ marker.setAttribute(IMarker.USER_EDITABLE, true);
+ marker.setAttribute(IMarker.DONE, true); // Enable interactive
+ marker.setAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, varName);
+ marker.setAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, file.getLocation().toOSString());
+ marker.setAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, arrayCount);
+ marker.setAttribute(CommonConstants.MARKER_ATTR_CHECK_LOCATION, checkLocation);
+ marker.setAttribute(CommonConstants.MARKER_VALID_VARIABLE, true);
+ }
+ } catch (CoreException e) {
+ DALog.printLog(e);
+ }
+
+ MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ box.setText(Labels.INTERACTIVE_DIALOG_TITLE_SUCCESS);
+ box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_SUCCESS);
+ box.open();
+ }
+ }
+ });
+
+ }
+
+ /**
+ * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
+ */
+ @Override
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ }
+
+ private void notifyInvalidVariable() {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.ICON_ERROR);
+ box.setText(Labels.INTERACTIVE_DIALOG_TITLE_ERROR);
+ box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE);
+ box.open();
+ }
+ });
+ }
+
+ private void notifyInvalidLine() {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.ICON_ERROR);
+ box.setText(Labels.INTERACTIVE_DIALOG_TITLE_ERROR);
+ box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_INVALID_LINE);
+ box.open();
+ }
+ });
+ }
+}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java
new file mode 100644
index 0000000..1586ad1
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java
@@ -0,0 +1,142 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin.popup.actions;
+
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
+import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IPointerType;
+import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.tizen.dynamicanalysis.ide.eplugin.DALog;
+
+public class InteractiveUtil {
+ private static final int NOT_EXIST = -1;
+
+ public static IEditorInput getEditorInput(IResource resource){
+ if (resource instanceof IFile) {
+ return new FileEditorInput((IFile)resource);
+ }
+ return null;
+ }
+
+ public static boolean isValidVariable(IASTName name) {
+ if (name != null) {
+ IBinding b = name.resolveBinding();
+ if (b != null && (b instanceof IVariable)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isValidLine(ITranslationUnit tu, int line, int offset, IDocument doc) {
+ try {
+ ICElement[] celements = tu.getChildren();
+ for (ICElement celement : celements) {
+ ISourceRange range = ((ISourceReference)celement).getSourceRange();
+ int startLine = range.getStartLine();
+ int endLine = range.getEndLine();
+ if (line >= startLine && line <= endLine) {
+ if (celement.getElementType() == ICElement.C_FUNCTION) {
+ int functionBodyStartOffset = findFunctionBodyStartOffset(range.getStartPos(), doc);
+ if (functionBodyStartOffset == NOT_EXIST || offset <= functionBodyStartOffset) {
+ return false;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ } catch (CModelException e) {
+ DALog.printLog(e);
+ }
+ return false;
+ }
+
+ /*
+ * If checkpoint's variable is member of structure, make string with (-> or .)
+ * ex) Input target is "memberVal", OutPut string is "structVal->memberVal".
+ */
+ public static String makeFullVariableName(IASTName target) {
+ String fullName = target.toString();
+ if (target.getCompletionContext() == null || !(target.getCompletionContext() instanceof IASTExpression)) {
+ return fullName;
+ }
+ IASTExpression cursor = (IASTExpression)target.getCompletionContext();
+ if (cursor != null && cursor instanceof IASTFieldReference) {
+ cursor = ((IASTFieldReference)cursor).getFieldOwner();
+ while ((cursor != null)) {
+ if (cursor instanceof IASTFieldReference) {
+ if (cursor.getExpressionType() instanceof IPointerType) {
+ fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "->" + fullName;
+ } else {
+ fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "." + fullName;
+ }
+ cursor = ((IASTFieldReference)cursor).getFieldOwner();
+ } else if (cursor instanceof IASTIdExpression) {
+ if (cursor.getExpressionType() instanceof IPointerType) {
+ fullName = ((IASTIdExpression)cursor).getName().toString() + "->" + fullName;
+ } else {
+ fullName = ((IASTIdExpression)cursor).getName().toString() + "." + fullName;
+ }
+ break;
+ } else {
+ break;
+ }
+ }
+ }
+ return fullName;
+ }
+
+ private static int findFunctionBodyStartOffset(int functionStartOffset, IDocument doc) {
+ int cursorOffset = functionStartOffset;
+ while (cursorOffset < doc.getLength()) {
+ try {
+ if (doc.getChar(cursorOffset) == '{') {
+ return cursorOffset;
+ }
+ cursorOffset++;
+ } catch (BadLocationException e) {
+ DALog.printLog(e);
+ }
+ }
+ return NOT_EXIST;
+ }
+}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java
new file mode 100644
index 0000000..a1bf745
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java
@@ -0,0 +1,190 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalysis.ide.eplugin.popup.actions;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants;
+import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;
+
+/*
+ * This class is made reference by "org.eclipse.ui.dialogs.ListSelectionDialog.java".
+ */
+public class SelectCheckpointDialog extends SelectionDialog {
+
+ private static class CheckPointColumn {
+ String description;
+ int code;
+ CheckPointColumn(String description, int code) {
+ this.description = description;
+ this.code = code;
+ }
+ @Override
+ public String toString() {
+ return description;
+ }
+ }
+
+ private static final CheckPointColumn[] inputElement = {
+ new CheckPointColumn(Labels.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION,
+ CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE),
+ new CheckPointColumn(Labels.INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION,
+ CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_AFTER) };
+
+ // providers for populating this dialog
+ private ILabelProvider labelProvider;
+
+ private IStructuredContentProvider contentProvider;
+
+ // the visual selection widget group
+ CheckboxTableViewer listViewer;
+
+ // sizing constants
+ private final static int SIZING_SELECTION_WIDGET_HEIGHT = 50;
+ private final static int SIZING_SELECTION_WIDGET_WIDTH = 350;
+
+ public SelectCheckpointDialog(Shell parentShell) {
+ this(parentShell, inputElement, ArrayContentProvider.getInstance(), new LabelProvider(),
+ Labels.INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION);
+ }
+
+ public SelectCheckpointDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider,
+ ILabelProvider labelProvider, String message) {
+ super(parentShell);
+ setTitle(Labels.INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE);
+ this.contentProvider = contentProvider;
+ this.labelProvider = labelProvider;
+ setMessage(message);
+ }
+
+ public int getLocation() {
+ setHelpAvailable(false);
+ int resultCode = open(); // dialog open
+ if (resultCode == SelectionDialog.OK) {
+ Object[] checkedElements = getResult();
+ if (checkedElements.length == 2) {
+ return CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_AFTER;
+ } else {
+ return ((CheckPointColumn)(checkedElements[0])).code;
+ }
+ }
+ return CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_INVALID;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ // page group
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ initializeDialogUnits(composite);
+
+ createMessageArea(composite);
+
+ listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.Deactivate);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ listViewer.getTable().setLayoutData(data);
+
+ listViewer.setLabelProvider(labelProvider);
+ listViewer.setContentProvider(contentProvider);
+
+ initializeViewer();
+
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+ }
+
+ private void initializeViewer() {
+ listViewer.setInput(inputElement);
+ listViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ listViewer.getTable().deselectAll();
+ Object[] checkedElements = listViewer.getCheckedElements();
+ if (checkedElements == null || checkedElements.length == 0) {
+ SelectCheckpointDialog.this.getOkButton().setEnabled(false);
+ } else {
+ SelectCheckpointDialog.this.getOkButton().setEnabled(true);
+ }
+ }
+ });
+ listViewer.getTable().addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ listViewer.getTable().deselectAll();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ listViewer.getTable().deselectAll();
+ }
+ });
+ }
+
+ @Override
+ protected void okPressed() {
+ // Get the input children.
+ Object[] children = contentProvider.getElements(inputElement);
+
+ // Build a list of selected children.
+ if (children != null) {
+ ArrayList list = new ArrayList();
+ for (int i = 0; i < children.length; ++i) {
+ Object element = children[i];
+ if (listViewer.getChecked(element)) {
+ list.add(element);
+ }
+ }
+ setResult(list);
+ }
+
+ super.okPressed();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = (Composite) super.createContents(parent);
+ getOkButton().setEnabled(false);
+ return composite;
+ }
+}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/InteractiveProfileView.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/InteractiveProfileView.java
new file mode 100644
index 0000000..a05038b
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/InteractiveProfileView.java
@@ -0,0 +1,36 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin.views;
+
+
+import org.eclipse.ui.views.markers.MarkerSupportView;
+import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants;
+
+public class InteractiveProfileView extends MarkerSupportView {
+ public InteractiveProfileView() {
+ super(CommonConstants.MARKER_GENERATOR_ID);
+ }
+}
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java
new file mode 100644
index 0000000..29c28d4
--- /dev/null
+++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java
@@ -0,0 +1,64 @@
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalysis.ide.eplugin.views;
+
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
+import org.eclipse.ui.views.markers.MarkerField;
+import org.eclipse.ui.views.markers.MarkerItem;
+import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants;
+
+public class VariableNameField extends MarkerField{
+ // If this name is shown, It's error situation.
+ private final static String INVALID_VARIABLE_NAME = "-";
+
+ @Override
+ public String getValue(MarkerItem item) {
+ return item.getAttributeValue(CommonConstants.MARKER_ATTR_VARIABLE_NAME, INVALID_VARIABLE_NAME);
+ }
+
+ @Override
+ public int getDefaultColumnWidth(final Control control) {
+ return 300;
+ }
+
+ @Override
+ public void update(ViewerCell cell) {
+ super.update(cell);
+ MarkerItem item = (MarkerItem) cell.getElement();
+ cell.setImage(annotateImage(item, getImage(item)));
+ }
+
+ private Image getImage(MarkerItem item) {
+ if (item.getAttributeValue(CommonConstants.MARKER_VALID_VARIABLE, false) == false) {
+ return MarkerSupportInternalUtilities.getSeverityImage(2); // Error image is shown to user.
+ } else {
+ return null;
+ }
+ }
+}