import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
-import org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PartInitException;
import org.slf4j.LoggerFactory;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.sdb.command.SdbCommand;
-import org.tizen.common.sdb.command.message.PkgcmdErrorType;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.LocalPortChecker;
import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.StringUtil;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.common.util.log.UserLogger;
-import org.tizen.nativecommon.ProjectUtil;
import org.tizen.nativecommon.build.CommonBuildMessages;
import org.tizen.nativecommon.build.CommonConfigurationManager;
-import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
-import org.tizen.nativecommon.build.ProjectTypeManager;
import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativecommon.launch.IProjectLaunchCommand;
import org.tizen.nativecommon.launch.LaunchUtils;
import org.tizen.nativecommon.launch.TizenDebugger;
import org.tizen.nativecommon.launch.TizenLaunchCommand;
import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativecommon.launch.TizenLaunchMessages;
import org.tizen.nativecommon.launch.TizenUIThreadForConfirmMessage;
-import org.tizen.nativecommon.launch.ui.LaunchConfigurationLinkDialog;
import org.tizen.nativecommon.launch.ui.TizenLaunchDeviceSelectionDialog;
import org.tizen.nativeplatform.Activator;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException,
OperationCanceledException {
try {
- if (!gdbServerPortIsAvailable(launch, config)) {
+ if (!LaunchUtils.setAvailableGdbServerPort(launch, config, currentDevice)) {
return;
}
monitor.beginTask("", 2);
}
}
- private boolean gdbServerPortIsAvailable(ILaunch launch, final ILaunchConfiguration config)
- throws NumberFormatException, CoreException {
- boolean result = true;
- final int gdbserverPort = Integer.parseInt(config.getAttribute(
- TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT,
- TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT));
- boolean isRemotePortAvailable = LaunchUtils.isRemotePortAvailable(currentDevice,
- gdbserverPort);
- if (!isRemotePortAvailable) {
- SWTUtil.asyncExec(new Runnable() {
- @Override
- public void run() {
- String title = TizenLaunchMessages.LAUNCH_ERROR;
- String message = NLS.bind(TizenLaunchMessages.GDBSERVER_PORT_ALREADY_USED, gdbserverPort);
- LaunchConfigurationLinkDialog dialog = new LaunchConfigurationLinkDialog(
- SWTUtil.getShell(), config, title, message);
- dialog.open();
- }
- });
-
- logger.error("RemoteGDBServerPort: " + gdbserverPort + " is busy");
- launch.terminate();
- result = false;
- }
- return result;
- }
-
protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config,
IProgressMonitor monitor) throws CoreException {