diff options
3 files changed, 74 insertions, 25 deletions
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 5694edb..d325e1e 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 @@ -55,8 +55,10 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; import org.tizen.common.IApplicationConfiguration; import org.tizen.common.core.application.InstallPathConfig; import org.tizen.common.launch.LaunchMessages; @@ -72,6 +74,7 @@ import org.tizen.dynamicanalysis.ide.eplugin.DALog; import org.tizen.dynamicanalysis.ide.eplugin.communication.DAServerManager; import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels; import org.tizen.nativecommon.ProjectUtil; +import org.tizen.nativecommon.build.CommonConfigurationManager; import org.tizen.nativecommon.launch.LaunchUtils; import org.tizen.nativecommon.launch.TizenLaunchCommand; import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants; @@ -81,10 +84,48 @@ import org.tizen.nativecommon.launch.TizenLaunchMessages; public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate { private final static String TOOLS = "tools";// $NON_NLS-1$ private final static String DYNAMIC_ANALYZER = "dynamic-analyzer";// $NON_NLS-1$ - IProject project; - + private boolean doProfileWithCheckPoint = false; + private boolean doProfile = true; + + @Override + public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { + IProject project = ProjectUtil.getProject(configuration); + // Checking build mode + boolean isDebug = CommonConfigurationManager.isDebugMode(getBuildConfiguration( + getBuildConfigName(configuration), project)); + if (isDebug) { // Case : Debug mode build + doProfile = true; + doProfileWithCheckPoint = true; + return super.buildForLaunch(configuration, mode, monitor); + } else { // Case : Release mode build + doProfileWithCheckPoint = false; + // Checking whether CheckPoint is exist. If there is no CheckPoint, just pass without dialog pop up. + IMarker[] markers = project.findMarkers(CommonConstants.MARKER_ID, true, IResource.DEPTH_INFINITE); + if (markers == null || markers.length == 0) { + doProfile = true; + return doProfile; + } + // Pop up dialog to choice profiling + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + doProfile = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + Labels.INTERACTIVE_DIALOG_TITLE_WARNING_BUILD_MODE, + Labels.INTERACTIVE_DIALOG_MSG_WARNING_BUILD_MODE); + } + }); + return doProfile; // Return whether to do build. + } + } + public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { + if (doProfile == false) { + ILaunchManager launchManager = DebugPlugin.getDefault() + .getLaunchManager(); + launchManager.removeLaunch(launch); + return; + } UserLogger.start(UserInteraction.CATE_NATIVE_LAUNCH); if (monitor == null) monitor = new NullProgressMonitor(); @@ -181,31 +222,33 @@ 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); + if (doProfileWithCheckPoint) { + 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); } - } catch (CoreException e) { - DALog.printLog(e); } - } - }); + }); + } return profileVariableInfos; } @@ -310,6 +353,7 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate { ""); if (buildConfigName.isEmpty()) { + IProject project = ProjectUtil.getProject(config); IConfiguration configuration = ManagedBuildManager.getBuildInfo( project).getDefaultConfiguration(); return configuration.getName(); 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 b2d7996..58b51e1 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 @@ -50,7 +50,9 @@ public class Labels extends NLS { 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_DIALOG_TITLE_WARNING_BUILD_MODE; + public static String INTERACTIVE_DIALOG_MSG_WARNING_BUILD_MODE; + public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE; public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION; public static String INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION; 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 4de5131..3f5e518 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 @@ -17,7 +17,10 @@ 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_DIALOG_TITLE_WARNING_BUILD_MODE=Release Build +INTERACTIVE_DIALOG_MSG_WARNING_BUILD_MODE=This project will be built with release mode which CheckPoint analysis does not support. If you want to use CheckPoint analysis feature, you must change build mode to Debug. However, you can use other analysis features except CheckPoint analysis with release mode.\nWould you like to profile without CheckPoint analysis this time? + + 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". |