import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
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.nativecommon.build.CommonBuildMessages;
import org.tizen.nativecommon.build.CommonConfigurationManager;
import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
import org.tizen.nativeplatform.launch.wizards.ShowPackageStatusDialog;
import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
-import org.tizen.nativeplatform.rootstrap.RootstrapManager;
-import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.IDevice.Arch;
import org.tizen.sdblib.SdbCommandRejectedException;
}
protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+
try {
monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
- monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
+ monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
- IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
- PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
- launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
-
- String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " :" + gdbserverPort;
- String execArg = setArguments(config);
- String envCmd = setEnvironments(config);
- String command = envCmd + gdbserverCmd + " " + execArg;
- serverProc = currentDevice.executeShellCommand(command);
- } catch (TimeoutException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } catch (SdbCommandRejectedException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
+ PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+ launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
+
+ String gdbserverRunCommand = getGdbserverRunCommand(config);
+ String resultCommand = null;
+
+ // is gdbserver running now ? then
+ resultCommand = String.format(TizenPlatformConstants.PROCESS_GET_PROCESS_ID_COMMAND, gdbserverRunCommand.trim());
+ tizenCommand.run(resultCommand, null);
+ if (tizenCommand.getEndLine() != null) {
+ if (StringUtil.isInteger(tizenCommand.getEndLine().trim())) {
+ resultCommand = String.format(TizenPlatformConstants.PROCESS_SIGKILL_COMMAND, tizenCommand.getEndLine() + TizenPlatformConstants.CMD_RESULT_CHECK);
+ try {
+ tizenCommand.run(resultCommand, "0");
+ } catch (CoreException e) {
+ newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
+ } catch (Exception e) {
+ newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
+ }
+ }
+ }
+ // Run gdbserver as blocking mode!
+ tizenCommand.run(gdbserverRunCommand, null, true);
} catch (CoreException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } catch (IOException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
} catch (Exception e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
} finally {
monitor.done();
}
monitor.done();
}
}
+
+ protected String getGdbserverRunCommand(ILaunchConfiguration config)
+ throws CoreException, Exception {
+
+ String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+ String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " :" + gdbserverPort;
+ String execArg = setArguments(config);
+ String envCmd = setEnvironments(config);
+ String command = envCmd + gdbserverCmd + " " + execArg;
+
+ return command;
+ }
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
import org.eclipse.debug.core.ILaunchManager;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.StringUtil;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.build.exception.SBIException;
import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
-import org.tizen.nativeplatform.rootstrap.RootstrapManager;
import org.tizen.sdblib.SdbCommandRejectedException;
import org.tizen.sdblib.TimeoutException;
}
@Override
- protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+ protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+
try {
monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
- IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
- PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
- launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
-
+ IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
+ PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+ launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
+
if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0))) {
newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER + ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID, null);
}
- String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- String commandArguments = ":" + gdbserverPort + TizenPlatformConstants.ATTACH_OPTION + pid;
- String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " " + commandArguments;
- String envCmd = setEnvironments(config);
- String command = envCmd + gdbserverCmd;
- serverProc = currentDevice.executeShellCommand(command);
- } catch (TimeoutException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } catch (SdbCommandRejectedException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ String gdbserverRunCommand = getGdbserverRunCommand(config);
+ String resultCommand = null;
+
+ // is gdbserver running now ? then
+ resultCommand = String.format(TizenPlatformConstants.PROCESS_GET_PROCESS_ID_COMMAND, gdbserverRunCommand.trim());
+ tizenCommand.run(resultCommand, null);
+ if (tizenCommand.getEndLine() != null) {
+ if (StringUtil.isInteger(tizenCommand.getEndLine().trim())) {
+ resultCommand = String.format(TizenPlatformConstants.PROCESS_SIGKILL_COMMAND, tizenCommand.getEndLine() + TizenPlatformConstants.CMD_RESULT_CHECK);
+ try {
+ tizenCommand.run(resultCommand, "0");
+ } catch (CoreException e) {
+ newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
+ } catch (Exception e) {
+ newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
+ }
+ }
+ }
+ // Run gdbserver as blocking mode!
+ tizenCommand.run(gdbserverRunCommand, null, true);
} catch (CoreException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } catch (IOException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
} catch (Exception e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+ newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
} finally {
monitor.done();
}
}
+ protected String getGdbserverRunCommand(ILaunchConfiguration config)
+ throws CoreException, Exception {
+
+ String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+ String commandArguments = ":" + gdbserverPort + TizenPlatformConstants.ATTACH_OPTION + pid;
+ String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " " + commandArguments;
+ String envCmd = setEnvironments(config);
+ String command = envCmd + gdbserverCmd;
+
+ return command;
+ }
+
private void setAttachProcess(ILaunchConfiguration config) throws CoreException {
final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
String processName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, "");
String result = rec.getLog()[0];
int firstIndex = result.indexOf("<pkg>");
int lastIndex = result.lastIndexOf("</pkg>");
- result = result.substring(firstIndex, lastIndex);
- String[] splitStr = result.split("</pkg>");
-
- for (String s : splitStr) {
- s = s.replaceAll(" ", "").replaceAll("<pkg>", "");
- String[] part = s.split(",");
- if (part.length == 3) {
- String name = part[0];
- String version = part[1];
- String arch = part[2];
- Package pkg = packageHash.get(name);
- if (pkg == null) {
- packageHash.put(name, new Package(name, version, "", arch));
- } else {
- pkg.setInstalledVersion(version);
+ if (firstIndex >= 0 || lastIndex >= 0 ) {
+ result = result.substring(firstIndex, lastIndex);
+ String[] splitStr = result.split("</pkg>");
+ for (String s : splitStr) {
+ s = s.replaceAll(" ", "").replaceAll("<pkg>", "");
+ String[] part = s.split(",");
+ if (part.length == 3) {
+ String name = part[0];
+ String version = part[1];
+ String arch = part[2];
+ Package pkg = packageHash.get(name);
+ if (pkg == null) {
+ packageHash.put(name, new Package(name, version, "", arch));
+ } else {
+ pkg.setInstalledVersion(version);
+ }
}
}
}
+
Enumeration<Package> e = packageHash.elements();
while (e.hasMoreElements()) {
private static void actionBeforeUseZypperDevice(IDevice device) {
if (device.isEmulator()) {
- PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
//rec.cleanLog();
String command = String
.format("sed -i \"s/# arch = s390/arch = i686/g\" /etc/zypp/zypp.conf");